hgext/git/gitutil.py
changeset 49300 227124098e14
parent 49290 76f56d69a457
child 49849 de9ffb82ef4d
equal deleted inserted replaced
49299:4554e2e965e2 49300:227124098e14
     1 """utilities to assist in working with pygit2"""
     1 """utilities to assist in working with pygit2"""
     2 
     2 
     3 from mercurial.node import bin, hex, sha1nodeconstants
     3 from mercurial.node import bin, sha1nodeconstants
     4 
       
     5 from mercurial import pycompat
       
     6 
     4 
     7 pygit2_module = None
     5 pygit2_module = None
     8 
     6 
     9 
     7 
    10 def get_pygit2():
     8 def get_pygit2():
    36     """Wrapper to convert a Mercurial binary node to a unicode hexlified node.
    34     """Wrapper to convert a Mercurial binary node to a unicode hexlified node.
    37 
    35 
    38     pygit2 and sqlite both need nodes as strings, not bytes.
    36     pygit2 and sqlite both need nodes as strings, not bytes.
    39     """
    37     """
    40     assert len(n) == 20
    38     assert len(n) == 20
    41     return pycompat.sysstr(hex(n))
    39     return n.hex()
    42 
    40 
    43 
    41 
    44 def fromgitnode(n):
    42 def fromgitnode(n):
    45     """Opposite of togitnode."""
    43     """Opposite of togitnode."""
    46     assert len(n) == 40
    44     assert len(n) == 40