Mercurial > hg
diff mercurial/localrepo.py @ 20932:0ac83e4e4f7c
localrepo: move the addchangegroupfiles method in changegroup module
This is a gratuitous code move aimed at reducing the localrepo bloatness.
The method had a single caller, far too few for being kept in local repo.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 01 Apr 2014 15:21:56 -0700 |
parents | de60ca3a390e |
children | d3775db748a0 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Tue Apr 01 15:08:27 2014 -0700 +++ b/mercurial/localrepo.py Tue Apr 01 15:21:56 2014 -0700 @@ -1775,8 +1775,12 @@ pr.total = efiles source.callback = None - newrevs, newfiles = self.addchangegroupfiles(source, revmap, trp, - pr, needfiles) + newrevs, newfiles = changegroup.addchangegroupfiles(self, + source, + revmap, + trp, + pr, + needfiles) revisions += newrevs files += newfiles @@ -1864,46 +1868,6 @@ else: return dh + 1 - def addchangegroupfiles(self, source, revmap, trp, pr, needfiles): - revisions = 0 - files = 0 - while True: - chunkdata = source.filelogheader() - if not chunkdata: - break - f = chunkdata["filename"] - self.ui.debug("adding %s revisions\n" % f) - pr() - fl = self.file(f) - o = len(fl) - if not fl.addgroup(source, revmap, trp): - raise util.Abort(_("received file revlog group is empty")) - revisions += len(fl) - o - files += 1 - if f in needfiles: - needs = needfiles[f] - for new in xrange(o, len(fl)): - n = fl.node(new) - if n in needs: - needs.remove(n) - else: - raise util.Abort( - _("received spurious file revlog entry")) - if not needs: - del needfiles[f] - self.ui.progress(_('files'), None) - - for f, needs in needfiles.iteritems(): - fl = self.file(f) - for n in needs: - try: - fl.rev(n) - except error.LookupError: - raise util.Abort( - _('missing file data for %s:%s - run hg verify') % - (f, hex(n))) - - return revisions, files def stream_in(self, remote, requirements): lock = self.lock()