Patchwork [04,of,10,py3] bundle2: correct %s to %d since part ids are integers

login
register
mail settings
Submitter Augie Fackler
Date Aug. 1, 2017, 8:34 p.m.
Message ID <73208fb1aea975f0d501.1501619672@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/22614/
State Accepted
Headers show

Comments

Augie Fackler - Aug. 1, 2017, 8:34 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1500909392 14400
#      Mon Jul 24 11:16:32 2017 -0400
# Node ID 73208fb1aea975f0d50168860d5bd691cbbad7e7
# Parent  f50da59f7977c7d796850b95ac7c80a4fd92bd18
bundle2: correct %s to %d since part ids are integers

Fixes some Python 3 regressions.
Yuya Nishihara - Aug. 2, 2017, 3:34 p.m.
On Tue, 01 Aug 2017 16:34:32 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1500909392 14400
> #      Mon Jul 24 11:16:32 2017 -0400
> # Node ID 73208fb1aea975f0d50168860d5bd691cbbad7e7
> # Parent  f50da59f7977c7d796850b95ac7c80a4fd92bd18
> bundle2: correct %s to %d since part ids are integers
> 
> Fixes some Python 3 regressions.
> 
> diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
> --- a/mercurial/bundle2.py
> +++ b/mercurial/bundle2.py
> @@ -976,7 +976,7 @@ class bundlepart(object):
>              parttype = self.type.upper()
>          else:
>              parttype = self.type.lower()
> -        outdebug(ui, 'part %s: "%s"' % (self.id, parttype))
> +        outdebug(ui, 'part %d: "%s"' % (self.id, parttype))
>          ## parttype
>          header = [_pack(_fparttypesize, len(parttype)),
>                    parttype, _pack(_fpartid, self.id),
> @@ -1213,7 +1213,7 @@ class unbundlepart(unpackermixin):
>          self.type = self._fromheader(typesize)
>          indebug(self.ui, 'part type: "%s"' % self.type)
>          self.id = self._unpackheader(_fpartid)[0]
> -        indebug(self.ui, 'part id: "%s"' % self.id)
> +        indebug(self.ui, 'part id: "%d"' % self.id)

self.id is initialized to None. I'm not pretty sure self.id has an integer
value here. Maybe it's better to use bytestr() instead.

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -976,7 +976,7 @@  class bundlepart(object):
             parttype = self.type.upper()
         else:
             parttype = self.type.lower()
-        outdebug(ui, 'part %s: "%s"' % (self.id, parttype))
+        outdebug(ui, 'part %d: "%s"' % (self.id, parttype))
         ## parttype
         header = [_pack(_fparttypesize, len(parttype)),
                   parttype, _pack(_fpartid, self.id),
@@ -1213,7 +1213,7 @@  class unbundlepart(unpackermixin):
         self.type = self._fromheader(typesize)
         indebug(self.ui, 'part type: "%s"' % self.type)
         self.id = self._unpackheader(_fpartid)[0]
-        indebug(self.ui, 'part id: "%s"' % self.id)
+        indebug(self.ui, 'part id: "%d"' % self.id)
         # extract mandatory bit from type
         self.mandatory = (self.type != self.type.lower())
         self.type = self.type.lower()