Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 10888:5e18023820a9
progress: show approximate progress info for pull
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 10 Apr 2010 17:20:43 -0500 |
parents | 38f2ef9c134b |
children | e39e94377eb2 |
comparison
equal
deleted
inserted
replaced
10887:3a1a1077f177 | 10888:5e18023820a9 |
---|---|
2009 return 0 | 2009 return 0 |
2010 | 2010 |
2011 self.hook('prechangegroup', throw=True, source=srctype, url=url) | 2011 self.hook('prechangegroup', throw=True, source=srctype, url=url) |
2012 | 2012 |
2013 changesets = files = revisions = 0 | 2013 changesets = files = revisions = 0 |
2014 efiles = set() | |
2014 | 2015 |
2015 # write changelog data to temp files so concurrent readers will not see | 2016 # write changelog data to temp files so concurrent readers will not see |
2016 # inconsistent view | 2017 # inconsistent view |
2017 cl = self.changelog | 2018 cl = self.changelog |
2018 cl.delayupdate() | 2019 cl.delayupdate() |
2026 clstart = len(cl) | 2027 clstart = len(cl) |
2027 class prog(object): | 2028 class prog(object): |
2028 step = _('changesets') | 2029 step = _('changesets') |
2029 count = 1 | 2030 count = 1 |
2030 ui = self.ui | 2031 ui = self.ui |
2032 total = None | |
2031 def __call__(self): | 2033 def __call__(self): |
2032 self.ui.progress(self.step, self.count, unit=_('chunks')) | 2034 self.ui.progress(self.step, self.count, unit=_('chunks'), |
2035 total=self.total) | |
2033 self.count += 1 | 2036 self.count += 1 |
2034 pr = prog() | 2037 pr = prog() |
2035 chunkiter = changegroup.chunkiter(source, progress=pr) | 2038 chunkiter = changegroup.chunkiter(source, progress=pr) |
2036 if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok: | 2039 if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok: |
2037 raise util.Abort(_("received changelog group is empty")) | 2040 raise util.Abort(_("received changelog group is empty")) |
2038 clend = len(cl) | 2041 clend = len(cl) |
2039 changesets = clend - clstart | 2042 changesets = clend - clstart |
2043 for c in xrange(clstart, clend): | |
2044 efiles.update(self[c].files()) | |
2045 efiles = len(efiles) | |
2040 self.ui.progress(_('changesets'), None) | 2046 self.ui.progress(_('changesets'), None) |
2041 | 2047 |
2042 # pull off the manifest group | 2048 # pull off the manifest group |
2043 self.ui.status(_("adding manifests\n")) | 2049 self.ui.status(_("adding manifests\n")) |
2044 pr.step = _('manifests') | 2050 pr.step = _('manifests') |
2045 pr.count = 1 | 2051 pr.count = 1 |
2052 pr.total = changesets # manifests <= changesets | |
2046 chunkiter = changegroup.chunkiter(source, progress=pr) | 2053 chunkiter = changegroup.chunkiter(source, progress=pr) |
2047 # no need to check for empty manifest group here: | 2054 # no need to check for empty manifest group here: |
2048 # if the result of the merge of 1 and 2 is the same in 3 and 4, | 2055 # if the result of the merge of 1 and 2 is the same in 3 and 4, |
2049 # no new manifest will be created and the manifest group will | 2056 # no new manifest will be created and the manifest group will |
2050 # be empty during the pull | 2057 # be empty during the pull |
2063 | 2070 |
2064 # process the files | 2071 # process the files |
2065 self.ui.status(_("adding file changes\n")) | 2072 self.ui.status(_("adding file changes\n")) |
2066 pr.step = 'files' | 2073 pr.step = 'files' |
2067 pr.count = 1 | 2074 pr.count = 1 |
2075 pr.total = efiles | |
2068 while 1: | 2076 while 1: |
2069 f = changegroup.getchunk(source) | 2077 f = changegroup.getchunk(source) |
2070 if not f: | 2078 if not f: |
2071 break | 2079 break |
2072 self.ui.debug("adding %s revisions\n" % f) | 2080 self.ui.debug("adding %s revisions\n" % f) |
2081 pr() | |
2073 fl = self.file(f) | 2082 fl = self.file(f) |
2074 o = len(fl) | 2083 o = len(fl) |
2075 chunkiter = changegroup.chunkiter(source, progress=pr) | 2084 chunkiter = changegroup.chunkiter(source) |
2076 if fl.addgroup(chunkiter, revmap, trp) is None: | 2085 if fl.addgroup(chunkiter, revmap, trp) is None: |
2077 raise util.Abort(_("received file revlog group is empty")) | 2086 raise util.Abort(_("received file revlog group is empty")) |
2078 revisions += len(fl) - o | 2087 revisions += len(fl) - o |
2079 files += 1 | 2088 files += 1 |
2080 if f in needfiles: | 2089 if f in needfiles: |