##// END OF EJS Templates
changegroup: move generate() modifications from narrow...
Gregory Szorc -
r38926:d706c774 default
parent child Browse files
Show More
@@ -24,7 +24,6 b' from mercurial import ('
24
24
25 from . import (
25 from . import (
26 narrowbundle2,
26 narrowbundle2,
27 narrowchangegroup,
28 narrowcommands,
27 narrowcommands,
29 narrowcopies,
28 narrowcopies,
30 narrowpatch,
29 narrowpatch,
@@ -62,7 +61,6 b' def uisetup(ui):'
62 narrowrevlog.setup()
61 narrowrevlog.setup()
63 narrowbundle2.setup()
62 narrowbundle2.setup()
64 narrowcommands.setup()
63 narrowcommands.setup()
65 narrowchangegroup.setup()
66 narrowwirepeer.uisetup()
64 narrowwirepeer.uisetup()
67
65
68 def reposetup(ui, repo):
66 def reposetup(ui, repo):
@@ -657,20 +657,52 b' class cg1packer(object):'
657 clrevorder = {}
657 clrevorder = {}
658 mfs = {} # needed manifests
658 mfs = {} # needed manifests
659 fnodes = {} # needed file nodes
659 fnodes = {} # needed file nodes
660 mfl = repo.manifestlog
661 # TODO violates storage abstraction.
662 mfrevlog = mfl._revlog
660 changedfiles = set()
663 changedfiles = set()
661
664
662 # Callback for the changelog, used to collect changed files and manifest
665 ellipsesmode = util.safehasattr(self, 'full_nodes')
663 # nodes.
666
667 # Callback for the changelog, used to collect changed files and
668 # manifest nodes.
664 # Returns the linkrev node (identity in the changelog case).
669 # Returns the linkrev node (identity in the changelog case).
665 def lookupcl(x):
670 def lookupcl(x):
666 c = cl.read(x)
671 c = cl.read(x)
667 clrevorder[x] = len(clrevorder)
672 clrevorder[x] = len(clrevorder)
673
674 if ellipsesmode:
675 # Only update mfs if x is going to be sent. Otherwise we
676 # end up with bogus linkrevs specified for manifests and
677 # we skip some manifest nodes that we should otherwise
678 # have sent.
679 if (x in self.full_nodes
680 or cl.rev(x) in self.precomputed_ellipsis):
681 n = c[0]
682 # Record the first changeset introducing this manifest
683 # version.
684 mfs.setdefault(n, x)
685 # Set this narrow-specific dict so we have the lowest
686 # manifest revnum to look up for this cl revnum. (Part of
687 # mapping changelog ellipsis parents to manifest ellipsis
688 # parents)
689 self.next_clrev_to_localrev.setdefault(cl.rev(x),
690 mfrevlog.rev(n))
691 # We can't trust the changed files list in the changeset if the
692 # client requested a shallow clone.
693 if self.is_shallow:
694 changedfiles.update(mfl[c[0]].read().keys())
695 else:
696 changedfiles.update(c[3])
697 else:
698
668 n = c[0]
699 n = c[0]
669 # record the first changeset introducing this manifest version
700 # record the first changeset introducing this manifest version
670 mfs.setdefault(n, x)
701 mfs.setdefault(n, x)
671 # Record a complete list of potentially-changed files in
702 # Record a complete list of potentially-changed files in
672 # this manifest.
703 # this manifest.
673 changedfiles.update(c[3])
704 changedfiles.update(c[3])
705
674 return x
706 return x
675
707
676 self._verbosenote(_('uncompressed size of bundle content:\n'))
708 self._verbosenote(_('uncompressed size of bundle content:\n'))
@@ -705,6 +737,13 b' class cg1packer(object):'
705 for chunk in self.generatemanifests(commonrevs, clrevorder,
737 for chunk in self.generatemanifests(commonrevs, clrevorder,
706 fastpathlinkrev, mfs, fnodes, source):
738 fastpathlinkrev, mfs, fnodes, source):
707 yield chunk
739 yield chunk
740
741 if ellipsesmode:
742 mfdicts = None
743 if self.is_shallow:
744 mfdicts = [(self._repo.manifestlog[n].read(), lr)
745 for (n, lr) in mfs.iteritems()]
746
708 mfs.clear()
747 mfs.clear()
709 clrevs = set(cl.rev(x) for x in clnodes)
748 clrevs = set(cl.rev(x) for x in clnodes)
710
749
@@ -719,6 +758,14 b' class cg1packer(object):'
719 revs = ((r, llr(r)) for r in filerevlog)
758 revs = ((r, llr(r)) for r in filerevlog)
720 return dict((fln(r), cln(lr)) for r, lr in revs if lr in clrevs)
759 return dict((fln(r), cln(lr)) for r, lr in revs if lr in clrevs)
721
760
761 if ellipsesmode:
762 # We need to pass the mfdicts variable down into
763 # generatefiles(), but more than one command might have
764 # wrapped generatefiles so we can't modify the function
765 # signature. Instead, we pass the data to ourselves using an
766 # instance attribute. I'm sorry.
767 self._mfdicts = mfdicts
768
722 for chunk in self.generatefiles(changedfiles, linknodes, commonrevs,
769 for chunk in self.generatefiles(changedfiles, linknodes, commonrevs,
723 source):
770 source):
724 yield chunk
771 yield chunk
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now