# HG changeset patch # User Anton Shestakov # Date 1630772365 -10800 # Node ID 217828aa0e29a48b9706ea6fa8047117f45ba04e # Parent b1529f0a30ce4072c96730010e20e589161aae70 pullbundle: use ui.makeprogress() directly without 4.6 compatibility diff -r b1529f0a30ce -r 217828aa0e29 hgext3rd/pullbundle.py --- a/hgext3rd/pullbundle.py Sat Sep 04 19:17:46 2021 +0300 +++ b/hgext3rd/pullbundle.py Sat Sep 04 19:19:25 2021 +0300 @@ -87,7 +87,6 @@ node as nodemod, registrar, scmutil, - ui as uimod, util, ) @@ -513,10 +512,11 @@ repo.ui.write(b"gathering %d sample pulls within %d revisions\n" % (count, len(actionrevs))) + progress = repo.ui.makeprogress(b'gathering data', b'pulls', count) if 1 < min_cache: repo.ui.write(b" not caching ranges smaller than %d changesets\n" % min_cache) for i in range(count): - progress(repo.ui, b'gathering data', i, total=count) + progress.update(i) outgoing = takeonesample(repo, actionrevs) ranges = sliceoutgoing(repo, outgoing) hitranges = 0 @@ -540,7 +540,7 @@ hitranges, ) pullstats.append(stats) - progress(repo.ui, b'gathering data', None) + progress.complete() sizes = [] changesmissing = [] @@ -634,18 +634,6 @@ data[b'name'] = name return STATSFORMAT % 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.2 (02802fa87b74) def getgetrev(cl):