Mercurial > hg-stable
changeset 10430:5cef810e588f
localrepo: show indeterminate progress for incoming data
This has some quirks, like showing progress bars for importing
bundles, including during rebase.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Sun, 07 Feb 2010 12:00:40 -0600 |
parents | 1c50a954a524 |
children | ba5e508b5e92 |
files | mercurial/changegroup.py mercurial/localrepo.py tests/test-acl.out |
diffstat | 3 files changed, 147 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changegroup.py Sat Feb 13 02:06:13 2010 +0100 +++ b/mercurial/changegroup.py Sun Feb 07 12:00:40 2010 -0600 @@ -24,13 +24,15 @@ % (len(d), l - 4)) return d -def chunkiter(source): +def chunkiter(source, progress=None): """iterate through the chunks in source, yielding a sequence of chunks (strings)""" while 1: c = getchunk(source) if not c: break + elif progress is not None: + progress() yield c def chunkheader(length):
--- a/mercurial/localrepo.py Sat Feb 13 02:06:13 2010 +0100 +++ b/mercurial/localrepo.py Sun Feb 07 12:00:40 2010 -0600 @@ -1994,20 +1994,32 @@ # pull off the changeset group self.ui.status(_("adding changesets\n")) clstart = len(cl) - chunkiter = changegroup.chunkiter(source) + class prog(object): + step = 'changesets' + count = 1 + ui = self.ui + def __call__(self): + self.ui.progress(self.step, self.count, unit='chunks') + self.count += 1 + pr = prog() + chunkiter = changegroup.chunkiter(source, progress=pr) if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok: raise util.Abort(_("received changelog group is empty")) clend = len(cl) changesets = clend - clstart + self.ui.progress('changesets', None) # pull off the manifest group self.ui.status(_("adding manifests\n")) - chunkiter = changegroup.chunkiter(source) + pr.step = 'manifests' + pr.count = 1 + chunkiter = changegroup.chunkiter(source, progress=pr) # no need to check for empty manifest group here: # if the result of the merge of 1 and 2 is the same in 3 and 4, # no new manifest will be created and the manifest group will # be empty during the pull self.manifest.addgroup(chunkiter, revmap, trp) + self.ui.progress('manifests', None) needfiles = {} if self.ui.configbool('server', 'validate', default=False): @@ -2021,6 +2033,8 @@ # process the files self.ui.status(_("adding file changes\n")) + pr.step = 'files' + pr.count = 1 while 1: f = changegroup.getchunk(source) if not f: @@ -2028,7 +2042,7 @@ self.ui.debug("adding %s revisions\n" % f) fl = self.file(f) o = len(fl) - chunkiter = changegroup.chunkiter(source) + chunkiter = changegroup.chunkiter(source, progress=pr) if fl.addgroup(chunkiter, revmap, trp) is None: raise util.Abort(_("received file revlog group is empty")) revisions += len(fl) - o @@ -2041,6 +2055,7 @@ needs.remove(n) if not needs: del needfiles[f] + self.ui.progress('files', None) for f, needs in needfiles.iteritems(): fl = self.file(f)
--- a/tests/test-acl.out Sat Feb 13 02:06:13 2010 +0100 +++ b/tests/test-acl.out Sun Feb 07 12:00:40 2010 -0600 @@ -20,14 +20,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files updating the branch cache rolling back last transaction @@ -49,14 +58,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: changes have source "push" - skipping @@ -82,14 +100,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow not enabled @@ -120,14 +147,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 0 entries for user fred @@ -159,14 +195,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user fred @@ -201,14 +246,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 0 entries for user barney @@ -242,14 +296,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user fred @@ -286,14 +349,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user fred @@ -329,14 +401,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 0 entries for user barney @@ -373,14 +454,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user barney @@ -418,14 +508,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user wilma @@ -467,14 +566,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook error: pretxnchangegroup.acl hook raised an exception: [Errno 2] No such file or directory: '../acl.config' @@ -515,14 +623,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user betty @@ -570,14 +687,23 @@ f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd 911600dab2ae7a9baff75958b84fe606851ce955 adding changesets +changesets: 1 chunks add changeset ef1ea85a6374 +changesets: 2 chunks add changeset f9cafe1212c8 +changesets: 3 chunks add changeset 911600dab2ae adding manifests +manifests: 1 chunks +manifests: 2 chunks +manifests: 3 chunks adding file changes adding foo/Bar/file.txt revisions +files: 1 chunks adding foo/file.txt revisions +files: 2 chunks adding quux/file.py revisions +files: 3 chunks added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user barney