comparison mercurial/revlog.py @ 49877:152d9c011bcd

changegroup: add `delta_base_reuse_policy` argument The argument available through function from changegroup.apply to `revlog.apply` allow to override the revlog configuration in terms of delta-base-reuse policy when searching for a delta to store a revision. It will be put to use in the next changesets.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 03 Dec 2022 01:31:23 +0100
parents 05db41701ece
children 9854a9adc466
comparison
equal deleted inserted replaced
49876:4188e75af983 49877:152d9c011bcd
2661 transaction, 2661 transaction,
2662 alwayscache=False, 2662 alwayscache=False,
2663 addrevisioncb=None, 2663 addrevisioncb=None,
2664 duplicaterevisioncb=None, 2664 duplicaterevisioncb=None,
2665 debug_info=None, 2665 debug_info=None,
2666 delta_base_reuse_policy=None,
2666 ): 2667 ):
2667 """ 2668 """
2668 add a delta group 2669 add a delta group
2669 2670
2670 given a set of deltas, add them to the revision log. the 2671 given a set of deltas, add them to the revision log. the
2675 this revlog and the node that was added. 2676 this revlog and the node that was added.
2676 """ 2677 """
2677 2678
2678 if self._adding_group: 2679 if self._adding_group:
2679 raise error.ProgrammingError(b'cannot nest addgroup() calls') 2680 raise error.ProgrammingError(b'cannot nest addgroup() calls')
2681
2682 # read the default delta-base reuse policy from revlog config if the
2683 # group did not specify one.
2684 if delta_base_reuse_policy is None:
2685 if self._generaldelta and self._lazydeltabase:
2686 delta_base_reuse_policy = DELTA_BASE_REUSE_TRY
2687 else:
2688 delta_base_reuse_policy = DELTA_BASE_REUSE_NO
2680 2689
2681 self._adding_group = True 2690 self._adding_group = True
2682 empty = True 2691 empty = True
2683 try: 2692 try:
2684 with self._writing(transaction): 2693 with self._writing(transaction):
2756 transaction, 2765 transaction,
2757 link, 2766 link,
2758 p1, 2767 p1,
2759 p2, 2768 p2,
2760 flags, 2769 flags,
2761 (baserev, delta), 2770 (baserev, delta, delta_base_reuse_policy),
2762 alwayscache=alwayscache, 2771 alwayscache=alwayscache,
2763 deltacomputer=deltacomputer, 2772 deltacomputer=deltacomputer,
2764 sidedata=sidedata, 2773 sidedata=sidedata,
2765 ) 2774 )
2766 2775