Commit 46b0b0f1 authored by Anton Shestakov's avatar Anton Shestakov
Browse files

pullbundle: compatibility for progress in hg <= 4.6

parent db341dafdccb
......@@ -87,6 +87,7 @@ from mercurial import (
node as nodemod,
registrar,
scmutil,
ui as uimod,
util,
)
......@@ -508,7 +509,7 @@ def debugpullbundlecacheoverlap(ui, repo, *revs, **opts):
if 1 < min_cache:
repo.ui.write(b" not caching ranges smaller than %d changesets\n" % min_cache)
for i in range(count):
repo.ui.progress(b'gathering data', i, total=count)
progress(repo.ui, b'gathering data', i, total=count)
outgoing = takeonesample(repo, actionrevs)
ranges = sliceoutgoing(repo, outgoing)
hitranges = 0
......@@ -532,7 +533,7 @@ def debugpullbundlecacheoverlap(ui, repo, *revs, **opts):
hitranges,
)
pullstats.append(stats)
repo.ui.progress(b'gathering data', None)
progress(repo.ui, b'gathering data', None)
sizes = []
changesmissing = []
......@@ -624,6 +625,18 @@ STATSFORMAT = b"""{name}:
def fmtdist(name, data):
return STATSFORMAT.format(name=name, **data)
# hg <= 4.6 (bec1212eceaa)
if util.safehasattr(uimod.ui, 'makeprogress'):
def progress(ui, topic, pos, item=b"", unit=b"", total=None):
progress = ui.makeprogress(topic, unit, total)
if pos is not None:
progress.update(pos, item=item)
else:
progress.complete()
else:
def progress(ui, topic, pos, item=b"", unit=b"", total=None):
ui.progress(topic, pos, item, unit, total)
# nodemap.get and index.[has_node|rev|get_rev]
# hg <= 5.3 (02802fa87b74)
def getgetrev(cl):
......
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