Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hg.py @ 38386:63e6f5ae84bc
copystore: use progress helper
Differential Revision: https://phab.mercurial-scm.org/D3781
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 17 Jun 2018 22:57:34 -0700 |
parents | 0664be4f0c1f |
children | e06a10d3b926 |
line wrap: on
line diff
--- a/mercurial/hg.py Sun Jun 17 22:09:15 2018 -0700 +++ b/mercurial/hg.py Sun Jun 17 22:57:34 2018 -0700 @@ -372,13 +372,9 @@ destlock = None try: hardlink = None + topic = _('linking') if hardlink else _('copying') + progress = ui.makeprogress(topic) num = 0 - closetopic = [None] - def prog(topic, pos): - if pos is None: - closetopic[0] = topic - else: - ui.progress(topic, pos + num) srcpublishing = srcrepo.publishing() srcvfs = vfsmod.vfs(srcrepo.sharedpath) dstvfs = vfsmod.vfs(destpath) @@ -395,16 +391,13 @@ # lock to avoid premature writing to the target destlock = lock.lock(dstvfs, lockfile) hardlink, n = util.copyfiles(srcvfs.join(f), dstvfs.join(f), - hardlink, progress=prog) + hardlink, progress) num += n if hardlink: ui.debug("linked %d files\n" % num) - if closetopic[0]: - ui.progress(closetopic[0], None) else: ui.debug("copied %d files\n" % num) - if closetopic[0]: - ui.progress(closetopic[0], None) + progress.complete() return destlock except: # re-raises release(destlock)