This is an archive of the discontinued Mercurial Phabricator instance.

git: don't fail import when pygit2 is not install
ClosedPublic

Authored by martinvonz on Mar 9 2020, 5:18 PM.

Details

Summary

test-duplicateoptions.py was failing on py2 for be because I didn't
have pygit2 installed. It failed because we depend on pygit2 at import
time. This patch makes it so we successfully load the git extension
even if pygit2 doesn't exist -- we just won't be able to use it in
that case.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Mar 9 2020, 5:18 PM
mharbison72 added inline comments.
hgext/git/__init__.py
95

s/py2git2/pygit2/ ? Pip isn't finding the former for me.

martinvonz updated this revision to Diff 20646.Mar 9 2020, 6:38 PM
martinvonz marked an inline comment as done.Mar 9 2020, 6:38 PM
martinvonz added inline comments.
hgext/git/__init__.py
95

That was just a typo (a typo that I made many times while writing these two patches).

martinvonz marked an inline comment as done.Mar 9 2020, 6:58 PM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.