Patchwork [4,of,4] py3: fix formatting of path-auditing errors

login
register
mail settings
Submitter Yuya Nishihara
Date March 3, 2018, 7:38 p.m.
Message ID <909f05717864c68eb0d6.1520105895@mimosa>
Download mbox | patch
Permalink /patch/28813/
State Accepted
Headers show

Comments

Yuya Nishihara - March 3, 2018, 7:38 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1520097783 18000
#      Sat Mar 03 12:23:03 2018 -0500
# Node ID 909f05717864c68eb0d60af3e6204afd83f29d87
# Parent  2222c0fd1e4f0e387a841794b7542c12d15f40c1
py3: fix formatting of path-auditing errors

Patch

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -6,6 +6,8 @@  test-amend-subrepo.t
 test-ancestor.py
 test-annotate.py
 test-annotate.t
+test-audit-path.t
+test-audit-subrepo.t
 test-automv.t
 test-backout.t
 test-backwards-remove.t
diff --git a/mercurial/pathutil.py b/mercurial/pathutil.py
--- a/mercurial/pathutil.py
+++ b/mercurial/pathutil.py
@@ -81,7 +81,7 @@  class pathauditor(object):
                     pos = lparts.index(p)
                     base = os.path.join(*parts[:pos])
                     raise error.Abort(_("path '%s' is inside nested repo %r")
-                                     % (path, base))
+                                      % (path, pycompat.bytestr(base)))
 
         normparts = util.splitpath(normpath)
         assert len(parts) == len(normparts)
@@ -119,13 +119,14 @@  class pathauditor(object):
                 raise
         else:
             if stat.S_ISLNK(st.st_mode):
-                msg = _('path %r traverses symbolic link %r') % (path, prefix)
+                msg = (_('path %r traverses symbolic link %r')
+                       % (pycompat.bytestr(path), pycompat.bytestr(prefix)))
                 raise error.Abort(msg)
             elif (stat.S_ISDIR(st.st_mode) and
                   os.path.isdir(os.path.join(curpath, '.hg'))):
                 if not self.callback or not self.callback(curpath):
                     msg = _("path '%s' is inside nested repo %r")
-                    raise error.Abort(msg % (path, prefix))
+                    raise error.Abort(msg % (path, pycompat.bytestr(prefix)))
 
     def check(self, path):
         try: