hgext/git/gitutil.py
changeset 44496 ec54b3d2af0b
parent 44489 ad718271a9eb
child 45965 c7c1efdfd4de
equal deleted inserted replaced
44495:2e464925f662 44496:ec54b3d2af0b
     2 from __future__ import absolute_import
     2 from __future__ import absolute_import
     3 
     3 
     4 from mercurial.node import bin, hex, nullid
     4 from mercurial.node import bin, hex, nullid
     5 
     5 
     6 from mercurial import pycompat
     6 from mercurial import pycompat
       
     7 
       
     8 pygit2_module = None
       
     9 
       
    10 
       
    11 def get_pygit2():
       
    12     global pygit2_module
       
    13     if pygit2_module is None:
       
    14         try:
       
    15             import pygit2 as pygit2_module
       
    16 
       
    17             pygit2_module.InvalidSpecError
       
    18         except (ImportError, AttributeError):
       
    19             pass
       
    20     return pygit2_module
     7 
    21 
     8 
    22 
     9 def togitnode(n):
    23 def togitnode(n):
    10     """Wrapper to convert a Mercurial binary node to a unicode hexlified node.
    24     """Wrapper to convert a Mercurial binary node to a unicode hexlified node.
    11 
    25