py3: fix formatting of path-auditing errors
authorYuya Nishihara <yuya@tcha.org>
Sat, 03 Mar 2018 12:23:03 -0500
changeset 36649 d3b893ec5f08
parent 36648 6585ac350fd9
child 36650 9318babff83b
py3: fix formatting of path-auditing errors
contrib/python3-whitelist
mercurial/pathutil.py
--- a/contrib/python3-whitelist	Sat Mar 03 12:36:05 2018 -0500
+++ b/contrib/python3-whitelist	Sat Mar 03 12:23:03 2018 -0500
@@ -6,6 +6,8 @@
 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
--- a/mercurial/pathutil.py	Sat Mar 03 12:36:05 2018 -0500
+++ b/mercurial/pathutil.py	Sat Mar 03 12:23:03 2018 -0500
@@ -81,7 +81,7 @@
                     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 @@
                 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: