changeset 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 4554e2e965e2
children c463f45fa114
files hgext/git/gitutil.py mercurial/branchmap.py mercurial/obsolete.py
diffstat 3 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/git/gitutil.py	Tue May 31 02:47:22 2022 +0200
+++ b/hgext/git/gitutil.py	Tue May 31 03:06:05 2022 +0200
@@ -1,8 +1,6 @@
 """utilities to assist in working with pygit2"""
 
-from mercurial.node import bin, hex, sha1nodeconstants
-
-from mercurial import pycompat
+from mercurial.node import bin, sha1nodeconstants
 
 pygit2_module = None
 
@@ -38,7 +36,7 @@
     pygit2 and sqlite both need nodes as strings, not bytes.
     """
     assert len(n) == 20
-    return pycompat.sysstr(hex(n))
+    return n.hex()
 
 
 def fromgitnode(n):
--- a/mercurial/branchmap.py	Tue May 31 02:47:22 2022 +0200
+++ b/mercurial/branchmap.py	Tue May 31 03:06:05 2022 +0200
@@ -159,7 +159,7 @@
 
 def _unknownnode(node):
     """raises ValueError when branchcache found a node which does not exists"""
-    raise ValueError('node %s does not exist' % pycompat.sysstr(hex(node)))
+    raise ValueError('node %s does not exist' % node.hex())
 
 
 def _branchcachedesc(repo):
--- a/mercurial/obsolete.py	Tue May 31 02:47:22 2022 +0200
+++ b/mercurial/obsolete.py	Tue May 31 03:06:05 2022 +0200
@@ -647,9 +647,7 @@
                 if len(succ) != 20:
                     raise ValueError(succ)
         if prec in succs:
-            raise ValueError(
-                'in-marker cycle with %s' % pycompat.sysstr(hex(prec))
-            )
+            raise ValueError('in-marker cycle with %s' % prec.hex())
 
         metadata = tuple(sorted(metadata.items()))
         for k, v in metadata: