Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 12334:50946802593d
bundle: refactor progress callback
This lets us eliminate the chunk iterator so we can have the bundle class
parse headers.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 19 Sep 2010 12:38:44 -0500 |
parents | 44c7dfc2f6a3 |
children | e21fe9c5fb25 |
comparison
equal
deleted
inserted
replaced
12333:44c7dfc2f6a3 | 12334:50946802593d |
---|---|
1672 def __call__(self): | 1672 def __call__(self): |
1673 self.ui.progress(self.step, self.count, unit=_('chunks'), | 1673 self.ui.progress(self.step, self.count, unit=_('chunks'), |
1674 total=self.total) | 1674 total=self.total) |
1675 self.count += 1 | 1675 self.count += 1 |
1676 pr = prog() | 1676 pr = prog() |
1677 if (cl.addgroup(source.chunks(pr), csmap, trp) is None | 1677 source.callback = pr |
1678 | |
1679 if (cl.addgroup(source.chunks(), csmap, trp) is None | |
1678 and not emptyok): | 1680 and not emptyok): |
1679 raise util.Abort(_("received changelog group is empty")) | 1681 raise util.Abort(_("received changelog group is empty")) |
1680 clend = len(cl) | 1682 clend = len(cl) |
1681 changesets = clend - clstart | 1683 changesets = clend - clstart |
1682 for c in xrange(clstart, clend): | 1684 for c in xrange(clstart, clend): |
1691 pr.total = changesets # manifests <= changesets | 1693 pr.total = changesets # manifests <= changesets |
1692 # no need to check for empty manifest group here: | 1694 # no need to check for empty manifest group here: |
1693 # if the result of the merge of 1 and 2 is the same in 3 and 4, | 1695 # if the result of the merge of 1 and 2 is the same in 3 and 4, |
1694 # no new manifest will be created and the manifest group will | 1696 # no new manifest will be created and the manifest group will |
1695 # be empty during the pull | 1697 # be empty during the pull |
1696 self.manifest.addgroup(source.chunks(pr), revmap, trp) | 1698 self.manifest.addgroup(source.chunks(), revmap, trp) |
1697 self.ui.progress(_('manifests'), None) | 1699 self.ui.progress(_('manifests'), None) |
1698 | 1700 |
1699 needfiles = {} | 1701 needfiles = {} |
1700 if self.ui.configbool('server', 'validate', default=False): | 1702 if self.ui.configbool('server', 'validate', default=False): |
1701 # validate incoming csets have their manifests | 1703 # validate incoming csets have their manifests |
1709 # process the files | 1711 # process the files |
1710 self.ui.status(_("adding file changes\n")) | 1712 self.ui.status(_("adding file changes\n")) |
1711 pr.step = 'files' | 1713 pr.step = 'files' |
1712 pr.count = 1 | 1714 pr.count = 1 |
1713 pr.total = efiles | 1715 pr.total = efiles |
1716 source.callback = None | |
1717 | |
1714 while 1: | 1718 while 1: |
1715 f = source.chunk() | 1719 f = source.chunk() |
1716 if not f: | 1720 if not f: |
1717 break | 1721 break |
1718 self.ui.debug("adding %s revisions\n" % f) | 1722 self.ui.debug("adding %s revisions\n" % f) |