[PATCH 02 of 10] localrepo: bytes for errors

timeless timeless at fmr.im
Wed May 11 21:23:10 EDT 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1461035348 0
#      Tue Apr 19 03:09:08 2016 +0000
# Node ID 0669c0d7de92c4ef5207272ad17d1126338aa985
# Parent  c3476399e7a64ea562a2748d010aff57a884481f
# Available At bb://timeless/mercurial-crew
#              hg pull bb://timeless/mercurial-crew -r 0669c0d7de92
localrepo: bytes for errors

diff -r c3476399e7a6 -r 0669c0d7de92 mercurial/localrepo.py
--- a/mercurial/localrepo.py	Tue Apr 19 14:34:11 2016 +0000
+++ b/mercurial/localrepo.py	Tue Apr 19 03:09:08 2016 +0000
@@ -294,9 +294,9 @@
                         b' dummy changelog to prevent using the old repo layout'
                     )
             else:
-                raise error.RepoError(_("repository %s not found") % path)
+                raise error.RepoError(_("repository %s not found") % path.encode('utf-8'))
         elif create:
-            raise error.RepoError(_("repository %s already exists") % path)
+            raise error.RepoError(_("repository %s already exists") % path.encode('utf-8'))
         else:
             try:
                 self.requirements = scmutil.readrequires(
@@ -312,7 +312,7 @@
             s = vfs.base
             if not vfs.exists():
                 raise error.RepoError(
-                    _('.hg/sharedpath points to nonexistent directory %s') % s)
+                    _('.hg/sharedpath points to nonexistent directory %s') % s.encode('utf-8'))
             self.sharedpath = s
         except IOError as inst:
             if inst.errno != errno.ENOENT:
@@ -819,7 +819,7 @@
             return self.branchmap().branchtip(branch)
         except KeyError:
             if not ignoremissing:
-                raise error.RepoLookupError(_("unknown branch '%s'") % branch)
+                raise error.RepoLookupError(_("unknown branch '%s'") % branch.encode('utf-8'))
             else:
                 pass
 
@@ -1290,7 +1290,7 @@
             if not wait:
                 raise
             self.ui.warn(_("waiting for lock on %s held by %r\n") %
-                         (desc, inst.locker))
+                         (desc.encode('utf-8'), inst.locker))
             # default to 600 seconds timeout
             l = lockmod.lock(vfs, lockname,
                              int(self.ui.config("ui", "timeout", "600")),
@@ -1325,7 +1325,7 @@
             return l
 
         l = self._lock(self.svfs, "lock", wait, None,
-                       self.invalidate, _('repository %s') % self.origroot)
+                       self.invalidate, _('repository %s') % self.origroot.encode(('utf-8')))
         self._lockref = weakref.ref(l)
         return l
 
@@ -1365,7 +1365,7 @@
 
         l = self._lock(self.vfs, "wlock", wait, unlock,
                        self.invalidatedirstate, _('working directory of %s') %
-                       self.origroot,
+                       self.origroot.encode('utf-8'),
                        inheritchecker=self._wlockchecktransaction,
                        parentenvvar='HG_WLOCK_LOCKER')
         self._wlockref = weakref.ref(l)
@@ -1552,7 +1552,7 @@
                             continue
                         if not force:
                             raise error.Abort(
-                                _("commit with new subrepo %s excluded") % s)
+                                _("commit with new subrepo %s excluded") % s.encode('utf-8'))
                     dirtyreason = wctx.sub(s).dirtyreason(True)
                     if dirtyreason:
                         if not self.ui.configbool('ui', 'commitsubrepos'):
@@ -1624,7 +1624,7 @@
                 for s in sorted(commitsubs):
                     sub = wctx.sub(s)
                     self.ui.status(_('committing subrepository %s\n') %
-                        subrepo.subrelpath(sub))
+                        subrepo.subrelpath(sub).encode('utf-8'))
                     sr = sub.commit(cctx._text, user, date)
                     newstate[s] = (newstate[s][0], sr)
                 subrepo.writestate(self, newstate)
@@ -1639,7 +1639,7 @@
             except: # re-raises
                 if edited:
                     self.ui.write(
-                        _('note: commit message saved in %s\n') % msgfn)
+                        _('note: commit message saved in %s\n') % msgfn.encode('utf-8'))
                 raise
             # update bookmarks, dirstate and mergestate
             bookmarks.update(self, [p1, p2], ret)
@@ -1697,12 +1697,12 @@
                                                     trp, changed)
                             m.setflag(f, fctx.flags())
                     except OSError as inst:
-                        self.ui.warn(_("trouble committing %s!\n") % f)
+                        self.ui.warn(_("trouble committing %s!\n") % f.encode('utf-8'))
                         raise
                     except IOError as inst:
                         errcode = getattr(inst, 'errno', errno.ENOENT)
                         if error or errcode and errcode != errno.ENOENT:
-                            self.ui.warn(_("trouble committing %s!\n") % f)
+                            self.ui.warn(_("trouble committing %s!\n") % f.encode('utf-8'))
                         raise
 
                 # update manifest


More information about the Mercurial-devel mailing list