[PATCH 2 of 3 py3] bundles: turn nbchanges int into a bytestr using pycompat.bytestr

Augie Fackler raf at durin42.com
Sat Sep 16 11:09:47 EDT 2017


# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1505515116 14400
#      Fri Sep 15 18:38:36 2017 -0400
# Node ID 5b03ae7d026bb4d14e3a8aaa391654987f8169c7
# Parent  dc9245ad5a97f90930367bbfc56ed8fc76f41e7c
bundles: turn nbchanges int into a bytestr using pycompat.bytestr

Fixes some python 3 failures.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1444,7 +1444,7 @@ def _addpartsfromopts(ui, repo, bundler,
     part = bundler.newpart('changegroup', data=cg.getchunks())
     part.addparam('version', cg.version)
     if 'clcount' in cg.extras:
-        part.addparam('nbchanges', str(cg.extras['clcount']),
+        part.addparam('nbchanges', '%d' % cg.extras['clcount'],
                       mandatory=False)
     if opts.get('phases') and repo.revs('%ln and secret()',
                                         outgoing.missingheads):
@@ -1520,7 +1520,7 @@ def writebundle(ui, cg, filename, bundle
         part = bundle.newpart('changegroup', data=cg.getchunks())
         part.addparam('version', cg.version)
         if 'clcount' in cg.extras:
-            part.addparam('nbchanges', str(cg.extras['clcount']),
+            part.addparam('nbchanges', '%d' % cg.extras['clcount'],
                           mandatory=False)
         chunkiter = bundle.getchunks()
     else:
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1640,7 +1640,8 @@ def _getbundlechangegrouppart(bundler, r
         part = bundler.newpart('changegroup', data=cgstream)
         if cgversions:
             part.addparam('version', version)
-        part.addparam('nbchanges', str(len(outgoing.missing)), mandatory=False)
+        part.addparam('nbchanges', '%d' % len(outgoing.missing),
+                      mandatory=False)
         if 'treemanifest' in repo.requirements:
             part.addparam('treemanifest', '1')
 


More information about the Mercurial-devel mailing list