Read about our upcoming Code of Conduct on this issue

Commit 330ecd86 authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

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).
parent 75307f276a79
......@@ -112,16 +112,17 @@ class depthcache(genericcaches.changelogsourcebase):
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
......
......@@ -74,16 +74,17 @@ class firstmergecache(genericcaches.changelogsourcebase):
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
......
......@@ -466,15 +466,16 @@ class _obshashcache(obscache.dualsourcecache):
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
......
......@@ -578,11 +578,11 @@ class ondiskstablesortcache(stablesortcache, genericcaches.changelogsourcebase):
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 @@ class ondiskstablesortcache(stablesortcache, genericcaches.changelogsourcebase):
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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment