diff --git a/remotefilelog/shallowbundle.py b/remotefilelog/shallowbundle.py --- a/remotefilelog/shallowbundle.py +++ b/remotefilelog/shallowbundle.py @@ -193,52 +193,52 @@ if util.safehasattr(changegroup, 'cg1packer'): shallowutil.interposeclass(changegroup, cgpacker.__name__)(shallowcg1packer) -if util.safehasattr(changegroup, 'cg2packer'): - # Mercurial >= 3.3 - cg2packer = changegroup.cg2packer -elif util.safehasattr(changegroup, 'cgpacker'): - # Since Mercurial 4c99c6d1ef95 - cg2packer = changegroup.cgpacker + if util.safehasattr(changegroup, 'cg2packer'): + # Mercurial >= 3.3 + cg2packer = changegroup.cg2packer + elif util.safehasattr(changegroup, 'cgpacker'): + # Since Mercurial 4c99c6d1ef95 + cg2packer = changegroup.cgpacker -if cg2packer: - @shallowutil.interposeclass(changegroup, cg2packer.__name__) - class shallowcg2packer(cg2packer): - def group(self, nodelist, rlog, lookup, units=None, reorder=None): - # for revlogs, shallowgroup will be called twice in the same stack - # -- once here, once up the inheritance hierarchy in - # shallowcg1packer. That's fine though because for revlogs, - # shallowgroup doesn't do anything on top of the usual group - # function. If that assumption changes this will have to be - # revisited. - return shallowgroup(shallowcg2packer, self, nodelist, rlog, lookup, - units=units) + if cg2packer: + @shallowutil.interposeclass(changegroup, cg2packer.__name__) + class shallowcg2packer(cg2packer): + def group(self, nodelist, rlog, lookup, units=None, reorder=None): + # for revlogs, shallowgroup will be called twice in the same stack + # -- once here, once up the inheritance hierarchy in + # shallowcg1packer. That's fine though because for revlogs, + # shallowgroup doesn't do anything on top of the usual group + # function. If that assumption changes this will have to be + # revisited. + return shallowgroup(shallowcg2packer, self, nodelist, rlog, lookup, + units=units) -if util.safehasattr(changegroup, 'cg3packer'): - cg3packer = changegroup.cg3packer -elif util.safehasattr(changegroup, 'cgpacker'): - # Since Mercurial 4c99c6d1ef95 - cg3packer = changegroup.cgpacker + if util.safehasattr(changegroup, 'cg3packer'): + cg3packer = changegroup.cg3packer + elif util.safehasattr(changegroup, 'cgpacker'): + # Since Mercurial 4c99c6d1ef95 + cg3packer = changegroup.cgpacker -if cgpacker: - @shallowutil.interposeclass(changegroup, cg3packer.__name__) - class shallowcg3packer(cg3packer): - def generatemanifests(self, commonrevs, clrevorder, fastpathlinkrev, - mfs, fnodes, *args, **kwargs): - chunks = super(shallowcg3packer, self).generatemanifests( - commonrevs, - clrevorder, - fastpathlinkrev, - mfs, - fnodes, - *args, **kwargs) - for chunk in chunks: - yield chunk + if cgpacker: + @shallowutil.interposeclass(changegroup, cg3packer.__name__) + class shallowcg3packer(cg3packer): + def generatemanifests(self, commonrevs, clrevorder, fastpathlinkrev, + mfs, fnodes, *args, **kwargs): + chunks = super(shallowcg3packer, self).generatemanifests( + commonrevs, + clrevorder, + fastpathlinkrev, + mfs, + fnodes, + *args, **kwargs) + for chunk in chunks: + yield chunk - # If we're not sending flat manifests, then the subclass - # generatemanifests call did not add the appropriate closing chunk - # for a changegroup3. - if not _cansendflat(self._repo, mfs.keys()): - yield self._manifestsdone() + # If we're not sending flat manifests, then the subclass + # generatemanifests call did not add the appropriate closing chunk + # for a changegroup3. + if not _cansendflat(self._repo, mfs.keys()): + yield self._manifestsdone() # Unused except in older versions of Mercurial def getchangegroup(orig, repo, source, outgoing, bundlecaps=None, version='01'):