comparison hgext/git/gitutil.py @ 49308:227124098e14

py3: use `x.hex()` instead of `pycompat.sysstr(node.hex(x))`
author Manuel Jacob <me@manueljacob.de>
date Tue, 31 May 2022 03:06:05 +0200
parents 76f56d69a457
children de9ffb82ef4d
comparison
equal deleted inserted replaced
49307:4554e2e965e2 49308: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