comparison mercurial/changegroup.py @ 27946:ca8d2b73155d stable

changegroup: fix treemanifest exchange code (issue5061) There were two mistakes: one was accidental reuse of the fclnode variable from the loop gathering file nodes, and the other (masked by that bug) was not correctly handling deleted directories. Both cases are now fixed and the test passes.
author Augie Fackler <augie@google.com>
date Wed, 27 Jan 2016 10:24:25 -0500
parents 1289a122cf3f
children 88609cfa3745
comparison
equal deleted inserted replaced
27945:4186d359046a 27946:ca8d2b73155d
776 fclnodes[n] = clnode 776 fclnodes[n] = clnode
777 # gather list of changed treemanifest nodes 777 # gather list of changed treemanifest nodes
778 if 'treemanifest' in repo.requirements: 778 if 'treemanifest' in repo.requirements:
779 submfs = {'/': mdata} 779 submfs = {'/': mdata}
780 for dn, bn in _moddirs(mfchangedfiles[x]): 780 for dn, bn in _moddirs(mfchangedfiles[x]):
781 submf = submfs[dn] 781 try:
782 submf = submf._dirs[bn] 782 submf = submfs[dn]
783 submf = submf._dirs[bn]
784 except KeyError:
785 continue # deleted directory, so nothing to send
783 submfs[submf.dir()] = submf 786 submfs[submf.dir()] = submf
784 tmfclnodes = tmfnodes.setdefault(submf.dir(), {}) 787 tmfclnodes = tmfnodes.setdefault(submf.dir(), {})
785 tmfclnodes.setdefault(submf._node, clnode) 788 tmfclnode = tmfclnodes.setdefault(submf._node, clnode)
786 if clrevorder[clnode] < clrevorder[fclnode]: 789 if clrevorder[clnode] < clrevorder[tmfclnode]:
787 tmfclnodes[n] = clnode 790 tmfclnodes[n] = clnode
788 return clnode 791 return clnode
789 792
790 mfnodes = self.prune(ml, mfs, commonrevs) 793 mfnodes = self.prune(ml, mfs, commonrevs)
791 for x in self._packmanifests( 794 for x in self._packmanifests(