changeset 44484 | ec54b3d2af0b |
parent 44477 | ad718271a9eb |
child 45950 | c7c1efdfd4de |
--- a/hgext/git/gitutil.py Mon Mar 09 12:53:21 2020 -0700 +++ b/hgext/git/gitutil.py Mon Mar 09 11:18:33 2020 -0700 @@ -5,6 +5,20 @@ from mercurial import pycompat +pygit2_module = None + + +def get_pygit2(): + global pygit2_module + if pygit2_module is None: + try: + import pygit2 as pygit2_module + + pygit2_module.InvalidSpecError + except (ImportError, AttributeError): + pass + return pygit2_module + def togitnode(n): """Wrapper to convert a Mercurial binary node to a unicode hexlified node.