##// END OF EJS Templates
changegroup: capture base node instead of rev in delta request...
Gregory Szorc -
r39055:d0d197ab default
parent child Browse files
Show More
@@ -517,12 +517,12 b' class revisiondeltarequest(object):'
517 517 p1node = attr.ib()
518 518 p2node = attr.ib()
519 519
520 # Base revision that delta should be generated against. If nullrev,
520 # Base revision that delta should be generated against. If nullid,
521 521 # the full revision data should be populated. If None, the delta
522 522 # may be generated against any base revision that is an ancestor of
523 # this revision. If any other numeric value, the delta should be
524 # produced against that revision.
525 baserev = attr.ib()
523 # this revision. If any other value, the delta should be produced
524 # against that revision.
525 basenode = attr.ib()
526 526
527 527 # Whether this should be marked as an ellipsis revision.
528 528 ellipsis = attr.ib(default=False)
@@ -613,18 +613,18 b' def _sortnodesellipsis(store, nodes, cl,'
613 613 key = lambda n: cl.rev(lookup(n))
614 614 return [store.rev(n) for n in sorted(nodes, key=key)]
615 615
616 def _handlerevisiondeltarequest(store, request, prev):
616 def _handlerevisiondeltarequest(store, request, prevnode):
617 617 """Obtain a revisiondelta from a revisiondeltarequest"""
618 618
619 619 node = request.node
620 620 rev = store.rev(node)
621 621
622 622 # Requesting a full revision.
623 if request.baserev == nullrev:
624 base = nullrev
623 if request.basenode == nullid:
624 baserev = nullrev
625 625 # Requesting an explicit revision.
626 elif request.baserev is not None:
627 base = request.baserev
626 elif request.basenode is not None:
627 baserev = store.rev(request.basenode)
628 628 # Allowing us to choose.
629 629 else:
630 630 p1, p2 = store.parentrevs(rev)
@@ -638,37 +638,37 b' def _handlerevisiondeltarequest(store, r'
638 638 # expensive. The revlog caches should have prev cached, meaning
639 639 # less CPU for changegroup generation. There is likely room to add
640 640 # a flag and/or config option to control this behavior.
641 base = prev
641 baserev = store.rev(prevnode)
642 642 elif dp == nullrev:
643 643 # revlog is configured to use full snapshot for a reason,
644 644 # stick to full snapshot.
645 base = nullrev
646 elif dp not in (p1, p2, prev):
645 baserev = nullrev
646 elif dp not in (p1, p2, store.rev(prevnode)):
647 647 # Pick prev when we can't be sure remote has the base revision.
648 base = prev
648 baserev = store.rev(prevnode)
649 649 else:
650 base = dp
650 baserev = dp
651 651
652 if base != nullrev and not store.candelta(base, rev):
653 base = nullrev
652 if baserev != nullrev and not store.candelta(baserev, rev):
653 baserev = nullrev
654 654
655 655 revision = None
656 656 delta = None
657 657 baserevisionsize = None
658 658
659 if store.iscensored(base) or store.iscensored(rev):
659 if store.iscensored(baserev) or store.iscensored(rev):
660 660 try:
661 661 revision = store.revision(node, raw=True)
662 662 except error.CensoredNodeError as e:
663 663 revision = e.tombstone
664 664
665 if base != nullrev:
666 baserevisionsize = store.rawsize(base)
665 if baserev != nullrev:
666 baserevisionsize = store.rawsize(baserev)
667 667
668 elif base == nullrev:
668 elif baserev == nullrev:
669 669 revision = store.revision(node, raw=True)
670 670 else:
671 delta = store.revdiff(base, rev)
671 delta = store.revdiff(baserev, rev)
672 672
673 673 extraflags = revlog.REVIDX_ELLIPSIS if request.ellipsis else 0
674 674
@@ -677,7 +677,7 b' def _handlerevisiondeltarequest(store, r'
677 677 p1node=request.p1node,
678 678 p2node=request.p2node,
679 679 linknode=request.linknode,
680 basenode=store.node(base),
680 basenode=store.node(baserev),
681 681 flags=store.flags(rev) | extraflags,
682 682 baserevisionsize=baserevisionsize,
683 683 revision=revision,
@@ -767,7 +767,7 b' def _makenarrowdeltarequest(cl, store, i'
767 767 p1node=p1node,
768 768 p2node=p2node,
769 769 linknode=linknode,
770 baserev=nullrev,
770 basenode=nullid,
771 771 ellipsis=True,
772 772 )
773 773
@@ -824,7 +824,7 b' def deltagroup(repo, revs, store, ischan'
824 824 p1node=p1node,
825 825 p2node=p2node,
826 826 linknode=linknode,
827 baserev=None,
827 basenode=None,
828 828 ))
829 829
830 830 elif linkrev not in precomputedellipsis:
@@ -840,7 +840,7 b' def deltagroup(repo, revs, store, ischan'
840 840 p1node=p1node,
841 841 p2node=p2node,
842 842 linknode=linknode,
843 baserev=prev if forcedeltaparentprev else None,
843 basenode=store.node(prev) if forcedeltaparentprev else None,
844 844 ))
845 845
846 846 # We expect the first pass to be fast, so we only engage the progress
@@ -850,16 +850,16 b' def deltagroup(repo, revs, store, ischan'
850 850 progress = repo.ui.makeprogress(_('bundling'), unit=units,
851 851 total=len(requests))
852 852
853 prevrev = revs[0]
853 prevnode = store.node(revs[0])
854 854 for i, request in enumerate(requests):
855 855 if progress:
856 856 progress.update(i + 1)
857 857
858 delta = _handlerevisiondeltarequest(store, request, prevrev)
858 delta = _handlerevisiondeltarequest(store, request, prevnode)
859 859
860 860 yield delta
861 861
862 prevrev = store.rev(request.node)
862 prevnode = request.node
863 863
864 864 if progress:
865 865 progress.complete()
General Comments 0
You need to be logged in to leave comments. Login now