Patchwork [8,of,9,py3,v2] branchmap: stringify int in a portable way

login
register
mail settings
Submitter Augie Fackler
Date March 12, 2017, 5:38 p.m.
Message ID <91aa8772d4445d6dbb77.1489340302@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19186/
State Superseded
Headers show

Comments

Augie Fackler - March 12, 2017, 5:38 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489297366 18000
#      Sun Mar 12 00:42:46 2017 -0500
# Node ID 91aa8772d4445d6dbb771b6e31a78529eb8a4f6c
# Parent  5295e63c3fa2fd37c4736c69e6caeb573ccaced5
branchmap: stringify int in a portable way

We actually need a bytes in Python 3, and thanks to our nasty source
loader this will portably do the right thing.

Patch

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -233,7 +233,7 @@  class branchcache(dict):
     def write(self, repo):
         try:
             f = repo.vfs(_filename(repo), "w", atomictemp=True)
-            cachekey = [hex(self.tipnode), str(self.tiprev)]
+            cachekey = [hex(self.tipnode), '%d' % self.tiprev]
             if self.filteredhash is not None:
                 cachekey.append(hex(self.filteredhash))
             f.write(" ".join(cachekey) + '\n')