Patchwork [8,of,8,py3] branchmap: be more careful about using %d on ints

login
register
mail settings
Submitter Augie Fackler
Date March 19, 2017, 6:11 a.m.
Message ID <4ba8cf639ae4fb512d75.1489903899@imladris.local>
Download mbox | patch
Permalink /patch/19445/
State Accepted
Headers show

Comments

Augie Fackler - March 19, 2017, 6:11 a.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489899685 14400
#      Sun Mar 19 01:01:25 2017 -0400
# Node ID 4ba8cf639ae4fb512d755e7eaa4286d5ee5c9513
# Parent  71e1dc3a007cb77ca1db3c6c8d73acf94b0be653
branchmap: be more careful about using %d on ints

Not doing so breaks Python 3.

Patch

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -426,7 +426,7 @@  class revbranchcache(object):
         else:
             # rev/node map has changed, invalidate the cache from here up
             self._repo.ui.debug("history modification detected - truncating "
-                "revision branch cache to revision %s\n" % rev)
+                "revision branch cache to revision %d\n" % rev)
             truncate = rbcrevidx + _rbcrecsize
             del self._rbcrevs[truncate:]
             self._rbcrevslen = min(self._rbcrevslen, truncate)
@@ -503,7 +503,7 @@  class revbranchcache(object):
                            len(self._rbcrevs) // _rbcrecsize)
                 f = repo.vfs.open(_rbcrevs, 'ab')
                 if f.tell() != start:
-                    repo.ui.debug("truncating %s to %s\n" % (_rbcrevs, start))
+                    repo.ui.debug("truncating %s to %d\n" % (_rbcrevs, start))
                     f.seek(start)
                     if f.tell() != start:
                         start = 0