progress: show approximate progress info for pull
authorMatt Mackall <mpm@selenic.com>
Sat, 10 Apr 2010 17:20:43 -0500
changeset 10888 5e18023820a9
parent 10887 3a1a1077f177
child 10889 e25c450c351e
progress: show approximate progress info for pull
mercurial/localrepo.py
tests/test-acl.out
--- a/mercurial/localrepo.py	Mon Apr 12 21:55:34 2010 +0200
+++ b/mercurial/localrepo.py	Sat Apr 10 17:20:43 2010 -0500
@@ -2011,6 +2011,7 @@
         self.hook('prechangegroup', throw=True, source=srctype, url=url)
 
         changesets = files = revisions = 0
+        efiles = set()
 
         # write changelog data to temp files so concurrent readers will not see
         # inconsistent view
@@ -2028,8 +2029,10 @@
                 step = _('changesets')
                 count = 1
                 ui = self.ui
+                total = None
                 def __call__(self):
-                    self.ui.progress(self.step, self.count, unit=_('chunks'))
+                    self.ui.progress(self.step, self.count, unit=_('chunks'),
+                                     total=self.total)
                     self.count += 1
             pr = prog()
             chunkiter = changegroup.chunkiter(source, progress=pr)
@@ -2037,12 +2040,16 @@
                 raise util.Abort(_("received changelog group is empty"))
             clend = len(cl)
             changesets = clend - clstart
+            for c in xrange(clstart, clend):
+                efiles.update(self[c].files())
+            efiles = len(efiles)
             self.ui.progress(_('changesets'), None)
 
             # pull off the manifest group
             self.ui.status(_("adding manifests\n"))
             pr.step = _('manifests')
             pr.count = 1
+            pr.total = changesets # manifests <= changesets
             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,
@@ -2065,14 +2072,16 @@
             self.ui.status(_("adding file changes\n"))
             pr.step = 'files'
             pr.count = 1
+            pr.total = efiles
             while 1:
                 f = changegroup.getchunk(source)
                 if not f:
                     break
                 self.ui.debug("adding %s revisions\n" % f)
+                pr()
                 fl = self.file(f)
                 o = len(fl)
-                chunkiter = changegroup.chunkiter(source, progress=pr)
+                chunkiter = changegroup.chunkiter(source)
                 if fl.addgroup(chunkiter, revmap, trp) is None:
                     raise util.Abort(_("received file revlog group is empty"))
                 revisions += len(fl) - o
--- a/tests/test-acl.out	Mon Apr 12 21:55:34 2010 +0200
+++ b/tests/test-acl.out	Sat Apr 10 17:20:43 2010 -0500
@@ -59,16 +59,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 added 3 changesets with 3 changes to 3 files
 updating the branch cache
 rolling back push to revision 1
@@ -129,16 +129,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 added 3 changesets with 3 changes to 3 files
 calling hook pretxnchangegroup.acl: hgext.acl.hook
 acl: changes have source "push" - skipping
@@ -203,16 +203,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 added 3 changesets with 3 changes to 3 files
 calling hook pretxnchangegroup.acl: hgext.acl.hook
 acl: acl.allow not enabled
@@ -282,16 +282,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 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
@@ -362,16 +362,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 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
@@ -445,16 +445,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 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
@@ -527,16 +527,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 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
@@ -612,16 +612,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 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
@@ -696,16 +696,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 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
@@ -781,16 +781,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 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
@@ -867,16 +867,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 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
@@ -957,16 +957,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 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'
@@ -1046,16 +1046,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 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
@@ -1142,16 +1142,16 @@
 changesets: 3 chunks
 add changeset 911600dab2ae
 adding manifests
-manifests: 1 chunks
-manifests: 2 chunks
-manifests: 3 chunks
+manifests: 1/3 chunks (33.33%)
+manifests: 2/3 chunks (66.67%)
+manifests: 3/3 chunks (100.00%)
 adding file changes
 adding foo/Bar/file.txt revisions
-files: 1 chunks
+files: 1/3 chunks (33.33%)
 adding foo/file.txt revisions
-files: 2 chunks
+files: 2/3 chunks (66.67%)
 adding quux/file.py revisions
-files: 3 chunks
+files: 3/3 chunks (100.00%)
 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