mercurial/changegroup.py
changeset 38983 fbbda9ff3deb
parent 38982 037debbf869c
child 38984 a3105433ecc4
equal deleted inserted replaced
38982:037debbf869c 38983:fbbda9ff3deb
   751 
   751 
   752         for chunk in self.generatemanifests(commonrevs, clrevorder,
   752         for chunk in self.generatemanifests(commonrevs, clrevorder,
   753                 fastpathlinkrev, mfs, fnodes, source):
   753                 fastpathlinkrev, mfs, fnodes, source):
   754             yield chunk
   754             yield chunk
   755 
   755 
   756         if self._ellipses:
   756         mfdicts = None
   757             mfdicts = None
   757         if self._ellipses and self._isshallow:
   758             if self._isshallow:
   758             mfdicts = [(self._repo.manifestlog[n].read(), lr)
   759                 mfdicts = [(self._repo.manifestlog[n].read(), lr)
   759                        for (n, lr) in mfs.iteritems()]
   760                            for (n, lr) in mfs.iteritems()]
       
   761 
   760 
   762         mfs.clear()
   761         mfs.clear()
   763         clrevs = set(cl.rev(x) for x in clnodes)
   762         clrevs = set(cl.rev(x) for x in clnodes)
   764 
   763 
   765         if not fastpathlinkrev:
   764         if not fastpathlinkrev:
   771                 llr = filerevlog.linkrev
   770                 llr = filerevlog.linkrev
   772                 fln = filerevlog.node
   771                 fln = filerevlog.node
   773                 revs = ((r, llr(r)) for r in filerevlog)
   772                 revs = ((r, llr(r)) for r in filerevlog)
   774                 return dict((fln(r), cln(lr)) for r, lr in revs if lr in clrevs)
   773                 return dict((fln(r), cln(lr)) for r, lr in revs if lr in clrevs)
   775 
   774 
   776         if self._ellipses:
       
   777             # We need to pass the mfdicts variable down into
       
   778             # generatefiles(), but more than one command might have
       
   779             # wrapped generatefiles so we can't modify the function
       
   780             # signature. Instead, we pass the data to ourselves using an
       
   781             # instance attribute. I'm sorry.
       
   782             self._mfdicts = mfdicts
       
   783 
       
   784         for chunk in self.generatefiles(changedfiles, linknodes, commonrevs,
   775         for chunk in self.generatefiles(changedfiles, linknodes, commonrevs,
   785                                         source):
   776                                         source, mfdicts):
   786             yield chunk
   777             yield chunk
   787 
   778 
   788         yield self._close()
   779         yield self._close()
   789 
   780 
   790         if clnodes:
   781         if clnodes:
   933                     yield x
   924                     yield x
   934         self._verbosenote(_('%8.i (manifests)\n') % size)
   925         self._verbosenote(_('%8.i (manifests)\n') % size)
   935         yield self._manifestsend
   926         yield self._manifestsend
   936 
   927 
   937     # The 'source' parameter is useful for extensions
   928     # The 'source' parameter is useful for extensions
   938     def generatefiles(self, changedfiles, linknodes, commonrevs, source):
   929     def generatefiles(self, changedfiles, linknodes, commonrevs, source,
       
   930                       mfdicts):
   939         changedfiles = list(filter(self._filematcher, changedfiles))
   931         changedfiles = list(filter(self._filematcher, changedfiles))
   940 
   932 
   941         if self._isshallow:
   933         if self._isshallow:
   942             # See comment in generate() for why this sadness is a thing.
       
   943             mfdicts = self._mfdicts
       
   944             del self._mfdicts
       
   945             # In a shallow clone, the linknodes callback needs to also include
   934             # In a shallow clone, the linknodes callback needs to also include
   946             # those file nodes that are in the manifests we sent but weren't
   935             # those file nodes that are in the manifests we sent but weren't
   947             # introduced by those manifests.
   936             # introduced by those manifests.
   948             commonctxs = [self._repo[c] for c in commonrevs]
   937             commonctxs = [self._repo[c] for c in commonrevs]
   949             oldlinknodes = linknodes
   938             oldlinknodes = linknodes