Show More
@@ -554,6 +554,40 b' def _sortnodesellipsis(store, nodes, cln' | |||||
554 | key = lambda n: clnodetorev[lookup(n)] |
|
554 | key = lambda n: clnodetorev[lookup(n)] | |
555 | return [store.rev(n) for n in sorted(nodes, key=key)] |
|
555 | return [store.rev(n) for n in sorted(nodes, key=key)] | |
556 |
|
556 | |||
|
557 | def _revisiondeltanormal(store, rev, prev, linknode, deltaparentfn): | |||
|
558 | """Construct a revision delta for non-ellipses changegroup generation.""" | |||
|
559 | node = store.node(rev) | |||
|
560 | p1, p2 = store.parentrevs(rev) | |||
|
561 | base = deltaparentfn(store, rev, p1, p2, prev) | |||
|
562 | ||||
|
563 | prefix = '' | |||
|
564 | if store.iscensored(base) or store.iscensored(rev): | |||
|
565 | try: | |||
|
566 | delta = store.revision(node, raw=True) | |||
|
567 | except error.CensoredNodeError as e: | |||
|
568 | delta = e.tombstone | |||
|
569 | if base == nullrev: | |||
|
570 | prefix = mdiff.trivialdiffheader(len(delta)) | |||
|
571 | else: | |||
|
572 | baselen = store.rawsize(base) | |||
|
573 | prefix = mdiff.replacediffheader(baselen, len(delta)) | |||
|
574 | elif base == nullrev: | |||
|
575 | delta = store.revision(node, raw=True) | |||
|
576 | prefix = mdiff.trivialdiffheader(len(delta)) | |||
|
577 | else: | |||
|
578 | delta = store.revdiff(base, rev) | |||
|
579 | p1n, p2n = store.parents(node) | |||
|
580 | ||||
|
581 | return revisiondelta( | |||
|
582 | node=node, | |||
|
583 | p1node=p1n, | |||
|
584 | p2node=p2n, | |||
|
585 | basenode=store.node(base), | |||
|
586 | linknode=linknode, | |||
|
587 | flags=store.flags(rev), | |||
|
588 | deltachunks=(prefix, delta), | |||
|
589 | ) | |||
|
590 | ||||
557 | class cgpacker(object): |
|
591 | class cgpacker(object): | |
558 | def __init__(self, repo, filematcher, version, allowreorder, |
|
592 | def __init__(self, repo, filematcher, version, allowreorder, | |
559 | deltaparentfn, builddeltaheader, manifestsend, |
|
593 | deltaparentfn, builddeltaheader, manifestsend, | |
@@ -679,8 +713,8 b' class cgpacker(object):' | |||||
679 | delta = self._revisiondeltanarrow(store, ischangelog, |
|
713 | delta = self._revisiondeltanarrow(store, ischangelog, | |
680 | curr, prev, linknode) |
|
714 | curr, prev, linknode) | |
681 | else: |
|
715 | else: | |
682 |
delta = |
|
716 | delta = _revisiondeltanormal(store, curr, prev, linknode, | |
683 |
|
|
717 | self._deltaparentfn) | |
684 |
|
718 | |||
685 | if not delta: |
|
719 | if not delta: | |
686 | continue |
|
720 | continue | |
@@ -1010,39 +1044,6 b' class cgpacker(object):' | |||||
1010 | self._verbosenote(_('%8.i %s\n') % (size, fname)) |
|
1044 | self._verbosenote(_('%8.i %s\n') % (size, fname)) | |
1011 | progress.complete() |
|
1045 | progress.complete() | |
1012 |
|
1046 | |||
1013 | def _revisiondeltanormal(self, store, ischangelog, rev, prev, linknode): |
|
|||
1014 | node = store.node(rev) |
|
|||
1015 | p1, p2 = store.parentrevs(rev) |
|
|||
1016 | base = self._deltaparentfn(store, rev, p1, p2, prev) |
|
|||
1017 |
|
||||
1018 | prefix = '' |
|
|||
1019 | if store.iscensored(base) or store.iscensored(rev): |
|
|||
1020 | try: |
|
|||
1021 | delta = store.revision(node, raw=True) |
|
|||
1022 | except error.CensoredNodeError as e: |
|
|||
1023 | delta = e.tombstone |
|
|||
1024 | if base == nullrev: |
|
|||
1025 | prefix = mdiff.trivialdiffheader(len(delta)) |
|
|||
1026 | else: |
|
|||
1027 | baselen = store.rawsize(base) |
|
|||
1028 | prefix = mdiff.replacediffheader(baselen, len(delta)) |
|
|||
1029 | elif base == nullrev: |
|
|||
1030 | delta = store.revision(node, raw=True) |
|
|||
1031 | prefix = mdiff.trivialdiffheader(len(delta)) |
|
|||
1032 | else: |
|
|||
1033 | delta = store.revdiff(base, rev) |
|
|||
1034 | p1n, p2n = store.parents(node) |
|
|||
1035 |
|
||||
1036 | return revisiondelta( |
|
|||
1037 | node=node, |
|
|||
1038 | p1node=p1n, |
|
|||
1039 | p2node=p2n, |
|
|||
1040 | basenode=store.node(base), |
|
|||
1041 | linknode=linknode, |
|
|||
1042 | flags=store.flags(rev), |
|
|||
1043 | deltachunks=(prefix, delta), |
|
|||
1044 | ) |
|
|||
1045 |
|
||||
1046 | def _revisiondeltanarrow(self, store, ischangelog, rev, prev, linknode): |
|
1047 | def _revisiondeltanarrow(self, store, ischangelog, rev, prev, linknode): | |
1047 | # build up some mapping information that's useful later. See |
|
1048 | # build up some mapping information that's useful later. See | |
1048 | # the local() nested function below. |
|
1049 | # the local() nested function below. | |
@@ -1057,8 +1058,8 b' class cgpacker(object):' | |||||
1057 | # This is a node to send in full, because the changeset it |
|
1058 | # This is a node to send in full, because the changeset it | |
1058 | # corresponds to was a full changeset. |
|
1059 | # corresponds to was a full changeset. | |
1059 | if linknode in self._fullnodes: |
|
1060 | if linknode in self._fullnodes: | |
1060 |
return |
|
1061 | return _revisiondeltanormal(store, rev, prev, linknode, | |
1061 |
|
|
1062 | self._deltaparentfn) | |
1062 |
|
1063 | |||
1063 | # At this point, a node can either be one we should skip or an |
|
1064 | # At this point, a node can either be one we should skip or an | |
1064 | # ellipsis. If it's not an ellipsis, bail immediately. |
|
1065 | # ellipsis. If it's not an ellipsis, bail immediately. |
General Comments 0
You need to be logged in to leave comments.
Login now