comparison mercurial/changegroup.py @ 30339:6cdfb7e15a35

changegroup: remove remaining uses of repo.manifest The remaining uses of repo.manifest in the changegroup module are treating the manifest exclusively as a revlog, so let's replace them with instances of the revlog directly. This is part of dropping all dependencies on repo.manifest in favor of repo.manifestlog.
author Durham Goode <durham@fb.com>
date Tue, 08 Nov 2016 08:03:43 -0800
parents bce79dfcf5e4
children a37a96d838b9
comparison
equal deleted inserted replaced
30338:b0ca939414ea 30339:6cdfb7e15a35
248 # no need to check for empty manifest group here: 248 # no need to check for empty manifest group here:
249 # if the result of the merge of 1 and 2 is the same in 3 and 4, 249 # if the result of the merge of 1 and 2 is the same in 3 and 4,
250 # no new manifest will be created and the manifest group will 250 # no new manifest will be created and the manifest group will
251 # be empty during the pull 251 # be empty during the pull
252 self.manifestheader() 252 self.manifestheader()
253 repo.manifest.addgroup(self, revmap, trp) 253 repo.manifestlog._revlog.addgroup(self, revmap, trp)
254 repo.ui.progress(_('manifests'), None) 254 repo.ui.progress(_('manifests'), None)
255 self.callback = None 255 self.callback = None
256 256
257 def apply(self, repo, srctype, url, emptyok=False, 257 def apply(self, repo, srctype, url, emptyok=False,
258 targetphase=phases.draft, expectedtotal=None): 258 targetphase=phases.draft, expectedtotal=None):
478 numchanges) 478 numchanges)
479 for chunkdata in iter(self.filelogheader, {}): 479 for chunkdata in iter(self.filelogheader, {}):
480 # If we get here, there are directory manifests in the changegroup 480 # If we get here, there are directory manifests in the changegroup
481 d = chunkdata["filename"] 481 d = chunkdata["filename"]
482 repo.ui.debug("adding %s revisions\n" % d) 482 repo.ui.debug("adding %s revisions\n" % d)
483 dirlog = repo.manifest.dirlog(d) 483 dirlog = repo.manifestlog._revlog.dirlog(d)
484 if not dirlog.addgroup(self, revmap, trp): 484 if not dirlog.addgroup(self, revmap, trp):
485 raise error.Abort(_("received dir revlog group is empty")) 485 raise error.Abort(_("received dir revlog group is empty"))
486 486
487 class headerlessfixup(object): 487 class headerlessfixup(object):
488 def __init__(self, fh, h): 488 def __init__(self, fh, h):
586 return [n for n in missing if rl(rr(n)) not in commonrevs] 586 return [n for n in missing if rl(rr(n)) not in commonrevs]
587 587
588 def _packmanifests(self, dir, mfnodes, lookuplinknode): 588 def _packmanifests(self, dir, mfnodes, lookuplinknode):
589 """Pack flat manifests into a changegroup stream.""" 589 """Pack flat manifests into a changegroup stream."""
590 assert not dir 590 assert not dir
591 for chunk in self.group(mfnodes, self._repo.manifest, 591 for chunk in self.group(mfnodes, self._repo.manifestlog._revlog,
592 lookuplinknode, units=_('manifests')): 592 lookuplinknode, units=_('manifests')):
593 yield chunk 593 yield chunk
594 594
595 def _manifestsdone(self): 595 def _manifestsdone(self):
596 return '' 596 return ''
850 deltaheader = _CHANGEGROUPV3_DELTA_HEADER 850 deltaheader = _CHANGEGROUPV3_DELTA_HEADER
851 851
852 def _packmanifests(self, dir, mfnodes, lookuplinknode): 852 def _packmanifests(self, dir, mfnodes, lookuplinknode):
853 if dir: 853 if dir:
854 yield self.fileheader(dir) 854 yield self.fileheader(dir)
855 for chunk in self.group(mfnodes, self._repo.manifest.dirlog(dir), 855
856 lookuplinknode, units=_('manifests')): 856 dirlog = self._repo.manifestlog._revlog.dirlog(dir)
857 for chunk in self.group(mfnodes, dirlog, lookuplinknode,
858 units=_('manifests')):
857 yield chunk 859 yield chunk
858 860
859 def _manifestsdone(self): 861 def _manifestsdone(self):
860 return self.close() 862 return self.close()
861 863