py3: fix progress() functions to not use "%s" with int
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 11 Jul 2019 15:30:43 -0700
changeset 4755 8664231b47ac
parent 4754 75307f276a79
child 4756 22ffbbba695d
py3: fix progress() functions to not use "%s" with int Python3 doesn't support "%s" with int arguments (and not with None arguments either, which this code was also using).
hgext3rd/evolve/depthcache.py
hgext3rd/evolve/firstmergecache.py
hgext3rd/evolve/obsdiscovery.py
hgext3rd/evolve/stablesort.py
--- a/hgext3rd/evolve/depthcache.py	Wed Jul 17 11:45:37 2019 -0700
+++ b/hgext3rd/evolve/depthcache.py	Thu Jul 11 15:30:43 2019 -0700
@@ -112,16 +112,17 @@
         cl = repo.unfiltered().changelog
         total = len(data)
 
-        def progress(pos, rev):
+        def progress(pos, rev=None):
+            revstr = '' if rev is None else ('rev %d' % rev)
             compat.progress(repo.ui, 'updating depth cache',
-                            pos, 'rev %s' % rev, unit='revision', total=total)
-        progress(0, '')
+                            pos, revstr, unit='revision', total=total)
+        progress(0)
         for idx, rev in enumerate(data, 1):
             assert rev == len(self._data), (rev, len(self._data))
             self._data.append(self._depth(cl, rev))
             if not (idx % 10000): # progress as a too high performance impact
                 progress(idx, rev)
-        progress(None, '')
+        progress(None)
 
     def _depth(self, changelog, rev):
         cl = changelog
--- a/hgext3rd/evolve/firstmergecache.py	Wed Jul 17 11:45:37 2019 -0700
+++ b/hgext3rd/evolve/firstmergecache.py	Thu Jul 11 15:30:43 2019 -0700
@@ -74,16 +74,17 @@
         cl = repo.unfiltered().changelog
         total = len(data)
 
-        def progress(pos, rev):
+        def progress(pos, rev=None):
+            revstr = '' if rev is None else ('rev %d' % rev)
             compat.progress(repo.ui, 'updating firstmerge cache',
-                            pos, 'rev %s' % rev, unit='revision', total=total)
-        progress(0, '')
+                            pos, revstr, unit='revision', total=total)
+        progress(0)
         for idx, rev in enumerate(data, 1):
             assert rev == len(self._data), (rev, len(self._data))
             self._data.append(self._firstmerge(cl, rev))
             if not (idx % 10000): # progress as a too high performance impact
                 progress(idx, rev)
-        progress(None, '')
+        progress(None)
 
     def _firstmerge(self, changelog, rev):
         cl = changelog
--- a/hgext3rd/evolve/obsdiscovery.py	Wed Jul 17 11:45:37 2019 -0700
+++ b/hgext3rd/evolve/obsdiscovery.py	Thu Jul 11 15:30:43 2019 -0700
@@ -466,15 +466,16 @@
         repo.depthcache.update(repo)
         total = len(revs)
 
-        def progress(pos, rev):
+        def progress(pos, rev=None):
+            revstr = '' if rev is None else ('rev %d' % rev)
             compat.progress(repo.ui, 'updating obshashrange cache',
-                            pos, 'rev %s' % rev, unit='revision', total=total)
+                            pos, revstr, unit='revision', total=total)
         # warm the cache for the new revs
-        progress(0, '')
+        progress(0)
         for idx, r in enumerate(revs):
             _obshashrange(repo, (r, 0))
             progress(idx, r)
-        progress(None, '')
+        progress(None)
 
         del self._updating
 
--- a/hgext3rd/evolve/stablesort.py	Wed Jul 17 11:45:37 2019 -0700
+++ b/hgext3rd/evolve/stablesort.py	Thu Jul 11 15:30:43 2019 -0700
@@ -578,11 +578,11 @@
 
         total = len(data)
 
-        def progress(pos, rev):
+        def progress(pos, rev=None):
+            revstr = '' if rev is None else ('rev %d' % rev)
             compat.progress(repo.ui, 'updating stablesort cache',
-                            pos, 'rev %s' % rev, unit='revision', total=total)
+                            pos, revstr, unit='revision', total=total)
 
-        progress(0, '')
         for idx, rev in enumerate(data):
             parents = filterparents(repo.changelog.parentrevs(rev))
             if len(parents) <= 1:
@@ -596,7 +596,7 @@
                         break
             if not (idx % 1000): # progress as a too high performance impact
                 progress(idx, rev)
-        progress(None, '')
+        progress(None)
 
     def clear(self, reset=False):
         super(ondiskstablesortcache, self).clear()