Mercurial > hg
comparison mercurial/changegroup.py @ 28232:829d369fc5a8
changegroup: write root manifests and subdir manifests in a single loop
This is another step towards making the manifest generation recurse
along the directory trees. The loop over 'tmfnodes' now takes the form
of a queue. At this point, we only add to the queue twice: we add the
root manifests, and, while visiting the root manifest revisions, we
add all subdirectory revisions (for treemanifest repos). Thus, any
iterations over 'tmfnodes' after the first will not add any items and
the "queue" will just keep shrinking.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 12 Feb 2016 23:30:18 -0800 |
parents | 3faba927dd93 |
children | 1ac8ce137377 |
comparison
equal
deleted
inserted
replaced
28231:3faba927dd93 | 28232:829d369fc5a8 |
---|---|
754 | 754 |
755 def generatemanifests(self, commonrevs, clrevorder, fastpathlinkrev, mfs, | 755 def generatemanifests(self, commonrevs, clrevorder, fastpathlinkrev, mfs, |
756 mfchangedfiles, fnodes): | 756 mfchangedfiles, fnodes): |
757 repo = self._repo | 757 repo = self._repo |
758 ml = repo.manifest | 758 ml = repo.manifest |
759 tmfnodes = {} | 759 tmfnodes = {'': mfs} |
760 | 760 |
761 # Callback for the manifest, used to collect linkrevs for filelog | 761 # Callback for the manifest, used to collect linkrevs for filelog |
762 # revisions. | 762 # revisions. |
763 # Returns the linkrev node (collected in lookupcl). | 763 # Returns the linkrev node (collected in lookupcl). |
764 def makelookupmflinknode(dir): | 764 def makelookupmflinknode(dir): |
823 if clrevorder[clnode] < clrevorder[tmfclnode]: | 823 if clrevorder[clnode] < clrevorder[tmfclnode]: |
824 tmfclnodes[n] = clnode | 824 tmfclnodes[n] = clnode |
825 return clnode | 825 return clnode |
826 return lookupmflinknode | 826 return lookupmflinknode |
827 | 827 |
828 mfnodes = self.prune(ml, mfs, commonrevs) | |
829 size = 0 | 828 size = 0 |
830 for x in self._packmanifests('', mfnodes, makelookupmflinknode('')): | 829 while tmfnodes: |
831 size += len(x) | 830 dir = min(tmfnodes) |
832 yield x | 831 nodes = tmfnodes[dir] |
833 for dir, nodes in tmfnodes.iteritems(): | |
834 prunednodes = self.prune(ml.dirlog(dir), nodes, commonrevs) | 832 prunednodes = self.prune(ml.dirlog(dir), nodes, commonrevs) |
835 for x in self._packmanifests(dir, prunednodes, | 833 for x in self._packmanifests(dir, prunednodes, |
836 makelookupmflinknode(dir)): | 834 makelookupmflinknode(dir)): |
837 size += len(x) | 835 size += len(x) |
838 yield x | 836 yield x |
837 del tmfnodes[dir] | |
839 self._verbosenote(_('%8.i (manifests)\n') % size) | 838 self._verbosenote(_('%8.i (manifests)\n') % size) |
840 yield self._manifestsdone() | 839 yield self._manifestsdone() |
841 | 840 |
842 # The 'source' parameter is useful for extensions | 841 # The 'source' parameter is useful for extensions |
843 def generatefiles(self, changedfiles, linknodes, commonrevs, source): | 842 def generatefiles(self, changedfiles, linknodes, commonrevs, source): |