Patchwork D2441: py3: convert known-int values to bytes using %d

login
register
mail settings
Submitter phabricator
Date Feb. 26, 2018, 5:43 a.m.
Message ID <f40b5fb06c23c8dbb2c3761ea919ef4e@localhost.localdomain>
Download mbox | patch
Permalink /patch/28375/
State Not Applicable
Headers show

Comments

phabricator - Feb. 26, 2018, 5:43 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2831d918e1b4: py3: convert known-int values to bytes using %d (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2441?vs=6088&id=6097

REVISION DETAIL
  https://phab.mercurial-scm.org/D2441

AFFECTED FILES
  mercurial/exchange.py
  mercurial/obsolete.py
  mercurial/patch.py
  mercurial/progress.py

CHANGE DETAILS




To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/mercurial/progress.py b/mercurial/progress.py
--- a/mercurial/progress.py
+++ b/mercurial/progress.py
@@ -121,7 +121,7 @@ 
                 if total:
                     add = b'%*d/%d' % (len(str(total)), pos, total)
                 else:
-                    add = str(pos)
+                    add = b'%d' % pos
             elif indicator.startswith('item') and item:
                 slice = 'end'
                 if '-' in indicator:
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -566,7 +566,7 @@ 
                 root = tempfile.mkdtemp(prefix='hg-patch-')
                 self.opener = vfsmod.vfs(root)
             # Avoid filename issues with these simple names
-            fn = str(self.created)
+            fn = '%d' % self.created
             self.opener.write(fn, data)
             self.created += 1
             self.files[fname] = (fn, mode, copied)
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -656,7 +656,7 @@ 
             self.caches.clear()
         # records the number of new markers for the transaction hooks
         previous = int(transaction.hookargs.get('new_obsmarkers', '0'))
-        transaction.hookargs['new_obsmarkers'] = str(previous + len(new))
+        transaction.hookargs['new_obsmarkers'] = '%d' % (previous + len(new))
         return len(new)
 
     def mergemarkers(self, transaction, data):
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1151,8 +1151,8 @@ 
         for newremotehead in outdated:
             r = pushop.remote.pushkey('phases',
                                       newremotehead.hex(),
-                                      str(phases.draft),
-                                      str(phases.public))
+                                      ('%d' % phases.draft),
+                                      ('%d' % phases.public))
             if not r:
                 pushop.ui.warn(_('updating %s to public failed!\n')
                                % newremotehead)