##// END OF EJS Templates
changegroup: factor changelogdone into an argument...
Gregory Szorc -
r39016:4a202bcc default
parent child Browse files
Show More
@@ -588,10 +588,6 b' class cgpacker(object):'
588 588 else:
589 589 self._verbosenote = lambda s: None
590 590
591 # TODO the functionality keyed off of this should probably be
592 # controlled via arguments to group() that influence behavior.
593 self._changelogdone = False
594
595 591 # Maps CL revs to per-revlog revisions. Cleared in close() at
596 592 # the end of each group.
597 593 self._clrevtolocalrev = {}
@@ -614,7 +610,7 b' class cgpacker(object):'
614 610 return chunkheader(len(fname)) + fname
615 611
616 612 # Extracted both for clarity and for overriding in extensions.
617 def _sortgroup(self, store, nodelist, lookup):
613 def _sortgroup(self, store, ischangelog, nodelist, lookup):
618 614 """Sort nodes for change group and turn them into revnums."""
619 615 # Ellipses serving mode.
620 616 #
@@ -632,7 +628,7 b' class cgpacker(object):'
632 628 # order that they're introduced in dramatis personae by the
633 629 # changelog, so what we do is we sort the non-changelog histories
634 630 # by the order in which they are used by the changelog.
635 if self._ellipses and self._changelogdone:
631 if self._ellipses and not ischangelog:
636 632 key = lambda n: self._clnodetorev[lookup(n)]
637 633 return [store.rev(n) for n in sorted(nodelist, key=key)]
638 634
@@ -644,7 +640,7 b' class cgpacker(object):'
644 640 else:
645 641 return sorted([store.rev(n) for n in nodelist])
646 642
647 def group(self, nodelist, store, lookup, units=None):
643 def group(self, nodelist, store, ischangelog, lookup, units=None):
648 644 """Calculate a delta group, yielding a sequence of changegroup chunks
649 645 (strings).
650 646
@@ -663,7 +659,7 b' class cgpacker(object):'
663 659 yield self._close()
664 660 return
665 661
666 revs = self._sortgroup(store, nodelist, lookup)
662 revs = self._sortgroup(store, ischangelog, nodelist, lookup)
667 663
668 664 # add the parent of the first rev
669 665 p = store.parentrevs(revs[0])[0]
@@ -679,7 +675,7 b' class cgpacker(object):'
679 675 progress.update(r + 1)
680 676 prev, curr = revs[r], revs[r + 1]
681 677 linknode = lookup(store.node(curr))
682 for c in self._revchunk(store, curr, prev, linknode):
678 for c in self._revchunk(store, ischangelog, curr, prev, linknode):
683 679 yield c
684 680
685 681 if progress:
@@ -709,7 +705,7 b' class cgpacker(object):'
709 705
710 706 # TODO violates storage abstractions by assuming revlogs.
711 707 dirlog = self._repo.manifestlog._revlog.dirlog(dir)
712 for chunk in self.group(mfnodes, dirlog, lookuplinknode,
708 for chunk in self.group(mfnodes, dirlog, False, lookuplinknode,
713 709 units=_('manifests')):
714 710 yield chunk
715 711
@@ -729,8 +725,6 b' class cgpacker(object):'
729 725
730 726 self._verbosenote(_('%8.i (changelog)\n') % size)
731 727
732 self._changelogdone = True
733
734 728 clrevorder = clstate['clrevorder']
735 729 mfs = clstate['mfs']
736 730 changedfiles = clstate['changedfiles']
@@ -861,7 +855,7 b' class cgpacker(object):'
861 855 'changedfiles': changedfiles,
862 856 }
863 857
864 gen = self.group(nodes, cl, lookupcl, units=_('changesets'))
858 gen = self.group(nodes, cl, True, lookupcl, units=_('changesets'))
865 859
866 860 return state, gen
867 861
@@ -990,19 +984,20 b' class cgpacker(object):'
990 984 h = self._fileheader(fname)
991 985 size = len(h)
992 986 yield h
993 for chunk in self.group(filenodes, filerevlog, lookupfilelog):
987 for chunk in self.group(filenodes, filerevlog, False,
988 lookupfilelog):
994 989 size += len(chunk)
995 990 yield chunk
996 991 self._verbosenote(_('%8.i %s\n') % (size, fname))
997 992 progress.complete()
998 993
999 def _revchunk(self, store, rev, prev, linknode):
994 def _revchunk(self, store, ischangelog, rev, prev, linknode):
1000 995 if self._ellipses:
1001 996 fn = self._revisiondeltanarrow
1002 997 else:
1003 998 fn = self._revisiondeltanormal
1004 999
1005 delta = fn(store, rev, prev, linknode)
1000 delta = fn(store, ischangelog, rev, prev, linknode)
1006 1001 if not delta:
1007 1002 return
1008 1003
@@ -1014,7 +1009,7 b' class cgpacker(object):'
1014 1009 for x in delta.deltachunks:
1015 1010 yield x
1016 1011
1017 def _revisiondeltanormal(self, store, rev, prev, linknode):
1012 def _revisiondeltanormal(self, store, ischangelog, rev, prev, linknode):
1018 1013 node = store.node(rev)
1019 1014 p1, p2 = store.parentrevs(rev)
1020 1015 base = self._deltaparentfn(store, rev, p1, p2, prev)
@@ -1047,10 +1042,10 b' class cgpacker(object):'
1047 1042 deltachunks=(prefix, delta),
1048 1043 )
1049 1044
1050 def _revisiondeltanarrow(self, store, rev, prev, linknode):
1045 def _revisiondeltanarrow(self, store, ischangelog, rev, prev, linknode):
1051 1046 # build up some mapping information that's useful later. See
1052 1047 # the local() nested function below.
1053 if not self._changelogdone:
1048 if ischangelog:
1054 1049 self._clnodetorev[linknode] = rev
1055 1050 linkrev = rev
1056 1051 self._clrevtolocalrev[linkrev] = rev
@@ -1061,7 +1056,8 b' class cgpacker(object):'
1061 1056 # This is a node to send in full, because the changeset it
1062 1057 # corresponds to was a full changeset.
1063 1058 if linknode in self._fullnodes:
1064 return self._revisiondeltanormal(store, rev, prev, linknode)
1059 return self._revisiondeltanormal(store, ischangelog, rev, prev,
1060 linknode)
1065 1061
1066 1062 # At this point, a node can either be one we should skip or an
1067 1063 # ellipsis. If it's not an ellipsis, bail immediately.
@@ -1082,7 +1078,7 b' class cgpacker(object):'
1082 1078 if clrev == nullrev:
1083 1079 return nullrev
1084 1080
1085 if not self._changelogdone:
1081 if ischangelog:
1086 1082 # If we're doing the changelog, it's possible that we
1087 1083 # have a parent that is already on the client, and we
1088 1084 # need to store some extra mapping information so that
General Comments 0
You need to be logged in to leave comments. Login now