Patchwork D1890: branchmap: make error messages consistent between Python 2 and 3

login
register
mail settings
Submitter phabricator
Date Feb. 1, 2018, 8:39 p.m.
Message ID <4116293ca54071f03e09a9869dd77f4d@localhost.localdomain>
Download mbox | patch
Permalink /patch/27129/
State Not Applicable
Headers show

Comments

phabricator - Feb. 1, 2018, 8:39 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd9ae54f7eed6: branchmap: make error messages consistent between Python 2 and 3 (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1890?vs=4880&id=5060

REVISION DETAIL
  https://phab.mercurial-scm.org/D1890

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS




To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -18,6 +18,7 @@ 
 from . import (
     encoding,
     error,
+    pycompat,
     scmutil,
     util,
 )
@@ -52,18 +53,19 @@ 
                               filteredhash=filteredhash)
         if not partial.validfor(repo):
             # invalidate the cache
-            raise ValueError('tip differs')
+            raise ValueError(r'tip differs')
         cl = repo.changelog
         for l in lines:
             if not l:
                 continue
             node, state, label = l.split(" ", 2)
             if state not in 'oc':
-                raise ValueError('invalid branch state')
+                raise ValueError(r'invalid branch state')
             label = encoding.tolocal(label.strip())
             node = bin(node)
             if not cl.hasnode(node):
-                raise ValueError('node %s does not exist' % hex(node))
+                raise ValueError(
+                    r'node %s does not exist' % pycompat.sysstr(hex(node)))
             partial.setdefault(label, []).append(node)
             if state == 'c':
                 partial._closednodes.add(node)
@@ -73,7 +75,7 @@ 
             if repo.filtername is not None:
                 msg += ' (%s)' % repo.filtername
             msg += ': %s\n'
-            repo.ui.debug(msg % inst)
+            repo.ui.debug(msg % pycompat.bytestr(inst))
         partial = None
     return partial