##// END OF EJS Templates
changegroup: extract generatemanifests()...
Martin von Zweigbergk -
r28227:1c36cc8e default
parent child Browse files
Show More
@@ -678,11 +678,9 b' class cg1packer(object):'
678 '''yield a sequence of changegroup chunks (strings)'''
678 '''yield a sequence of changegroup chunks (strings)'''
679 repo = self._repo
679 repo = self._repo
680 cl = repo.changelog
680 cl = repo.changelog
681 ml = repo.manifest
682
681
683 clrevorder = {}
682 clrevorder = {}
684 mfs = {} # needed manifests
683 mfs = {} # needed manifests
685 tmfnodes = {}
686 fnodes = {} # needed file nodes
684 fnodes = {} # needed file nodes
687 # maps manifest node id -> set(changed files)
685 # maps manifest node id -> set(changed files)
688 mfchangedfiles = {}
686 mfchangedfiles = {}
@@ -729,6 +727,42 b' class cg1packer(object):'
729 # send along with files. This could probably be fixed.
727 # send along with files. This could probably be fixed.
730 fastpathlinkrev = fastpathlinkrev and (
728 fastpathlinkrev = fastpathlinkrev and (
731 'treemanifest' not in repo.requirements)
729 'treemanifest' not in repo.requirements)
730
731 for chunk in self.generatemanifests(commonrevs, clrevorder,
732 fastpathlinkrev, mfs, mfchangedfiles, fnodes):
733 yield chunk
734 mfs.clear()
735 clrevs = set(cl.rev(x) for x in clnodes)
736
737 if not fastpathlinkrev:
738 def linknodes(unused, fname):
739 return fnodes.get(fname, {})
740 else:
741 cln = cl.node
742 def linknodes(filerevlog, fname):
743 llr = filerevlog.linkrev
744 fln = filerevlog.node
745 revs = ((r, llr(r)) for r in filerevlog)
746 return dict((fln(r), cln(lr)) for r, lr in revs if lr in clrevs)
747
748 changedfiles = set()
749 for x in mfchangedfiles.itervalues():
750 changedfiles.update(x)
751 for chunk in self.generatefiles(changedfiles, linknodes, commonrevs,
752 source):
753 yield chunk
754
755 yield self.close()
756
757 if clnodes:
758 repo.hook('outgoing', node=hex(clnodes[0]), source=source)
759
760 def generatemanifests(self, commonrevs, clrevorder, fastpathlinkrev, mfs,
761 mfchangedfiles, fnodes):
762 repo = self._repo
763 ml = repo.manifest
764 tmfnodes = {}
765
732 # Callback for the manifest, used to collect linkrevs for filelog
766 # Callback for the manifest, used to collect linkrevs for filelog
733 # revisions.
767 # revisions.
734 # Returns the linkrev node (collected in lookupcl).
768 # Returns the linkrev node (collected in lookupcl).
@@ -795,32 +829,6 b' class cg1packer(object):'
795 mfnodes, tmfnodes, lookupmflinknode):
829 mfnodes, tmfnodes, lookupmflinknode):
796 yield x
830 yield x
797
831
798 mfs.clear()
799 clrevs = set(cl.rev(x) for x in clnodes)
800
801 if not fastpathlinkrev:
802 def linknodes(unused, fname):
803 return fnodes.get(fname, {})
804 else:
805 cln = cl.node
806 def linknodes(filerevlog, fname):
807 llr = filerevlog.linkrev
808 fln = filerevlog.node
809 revs = ((r, llr(r)) for r in filerevlog)
810 return dict((fln(r), cln(lr)) for r, lr in revs if lr in clrevs)
811
812 changedfiles = set()
813 for x in mfchangedfiles.itervalues():
814 changedfiles.update(x)
815 for chunk in self.generatefiles(changedfiles, linknodes, commonrevs,
816 source):
817 yield chunk
818
819 yield self.close()
820
821 if clnodes:
822 repo.hook('outgoing', node=hex(clnodes[0]), source=source)
823
824 # The 'source' parameter is useful for extensions
832 # The 'source' parameter is useful for extensions
825 def generatefiles(self, changedfiles, linknodes, commonrevs, source):
833 def generatefiles(self, changedfiles, linknodes, commonrevs, source):
826 repo = self._repo
834 repo = self._repo
General Comments 0
You need to be logged in to leave comments. Login now