Show More
@@ -38,6 +38,8 b' from .revlogutils.constants import (' | |||||
38 | COMP_MODE_DEFAULT, |
|
38 | COMP_MODE_DEFAULT, | |
39 | COMP_MODE_INLINE, |
|
39 | COMP_MODE_INLINE, | |
40 | COMP_MODE_PLAIN, |
|
40 | COMP_MODE_PLAIN, | |
|
41 | DELTA_BASE_REUSE_NO, | |||
|
42 | DELTA_BASE_REUSE_TRY, | |||
41 | ENTRY_RANK, |
|
43 | ENTRY_RANK, | |
42 | FEATURES_BY_VERSION, |
|
44 | FEATURES_BY_VERSION, | |
43 | FLAG_GENERALDELTA, |
|
45 | FLAG_GENERALDELTA, | |
@@ -2458,6 +2460,16 b' class revlog:' | |||||
2458 | self, write_debug=write_debug |
|
2460 | self, write_debug=write_debug | |
2459 | ) |
|
2461 | ) | |
2460 |
|
2462 | |||
|
2463 | if cachedelta is not None and len(cachedelta) == 2: | |||
|
2464 | # If the cached delta has no information about how it should be | |||
|
2465 | # reused, add the default reuse instruction according to the | |||
|
2466 | # revlog's configuration. | |||
|
2467 | if self._generaldelta and self._lazydeltabase: | |||
|
2468 | delta_base_reuse = DELTA_BASE_REUSE_TRY | |||
|
2469 | else: | |||
|
2470 | delta_base_reuse = DELTA_BASE_REUSE_NO | |||
|
2471 | cachedelta = (cachedelta[0], cachedelta[1], delta_base_reuse) | |||
|
2472 | ||||
2461 | revinfo = revlogutils.revisioninfo( |
|
2473 | revinfo = revlogutils.revisioninfo( | |
2462 | node, |
|
2474 | node, | |
2463 | p1, |
|
2475 | p1, |
@@ -67,7 +67,7 b' class revisioninfo:' | |||||
67 | node: expected hash of the revision |
|
67 | node: expected hash of the revision | |
68 | p1, p2: parent revs of the revision |
|
68 | p1, p2: parent revs of the revision | |
69 | btext: built text cache consisting of a one-element list |
|
69 | btext: built text cache consisting of a one-element list | |
70 | cachedelta: (baserev, uncompressed_delta) or None |
|
70 | cachedelta: (baserev, uncompressed_delta, usage_mode) or None | |
71 | flags: flags associated to the revision storage |
|
71 | flags: flags associated to the revision storage | |
72 |
|
72 | |||
73 | One of btext[0] or cachedelta must be set. |
|
73 | One of btext[0] or cachedelta must be set. |
@@ -301,3 +301,17 b' FEATURES_BY_VERSION = {' | |||||
301 |
|
301 | |||
302 |
|
302 | |||
303 | SPARSE_REVLOG_MAX_CHAIN_LENGTH = 1000 |
|
303 | SPARSE_REVLOG_MAX_CHAIN_LENGTH = 1000 | |
|
304 | ||||
|
305 | ### What should be done with a cached delta and its base ? | |||
|
306 | ||||
|
307 | # Ignore the cache when considering candidates. | |||
|
308 | # | |||
|
309 | # The cached delta might be used, but the delta base will not be scheduled for | |||
|
310 | # usage earlier than in "normal" order. | |||
|
311 | DELTA_BASE_REUSE_NO = 0 | |||
|
312 | ||||
|
313 | # Prioritize trying the cached delta base | |||
|
314 | # | |||
|
315 | # The delta base will be tested for validy first. So that the cached deltas get | |||
|
316 | # used when possible. | |||
|
317 | DELTA_BASE_REUSE_TRY = 1 |
@@ -646,7 +646,7 b' def debug_delta_find(ui, revlog, rev, ba' | |||||
646 | base_text = revlog.revision(base_rev) |
|
646 | base_text = revlog.revision(base_rev) | |
647 | delta = mdiff.textdiff(base_text, full_text) |
|
647 | delta = mdiff.textdiff(base_text, full_text) | |
648 |
|
648 | |||
649 | cachedelta = (base_rev, delta) |
|
649 | cachedelta = (base_rev, delta, constants.DELTA_BASE_REUSE_TRY) | |
650 | btext = [None] |
|
650 | btext = [None] | |
651 |
|
651 | |||
652 | revinfo = revlogutils.revisioninfo( |
|
652 | revinfo = revlogutils.revisioninfo( |
@@ -20,6 +20,7 b' from .constants import (' | |||||
20 | COMP_MODE_DEFAULT, |
|
20 | COMP_MODE_DEFAULT, | |
21 | COMP_MODE_INLINE, |
|
21 | COMP_MODE_INLINE, | |
22 | COMP_MODE_PLAIN, |
|
22 | COMP_MODE_PLAIN, | |
|
23 | DELTA_BASE_REUSE_NO, | |||
23 | KIND_CHANGELOG, |
|
24 | KIND_CHANGELOG, | |
24 | KIND_FILELOG, |
|
25 | KIND_FILELOG, | |
25 | KIND_MANIFESTLOG, |
|
26 | KIND_MANIFESTLOG, | |
@@ -819,7 +820,7 b' def _refinedgroups(revlog, p1, p2, cache' | |||||
819 | # through configuration. Disabling reuse source delta is useful when |
|
820 | # through configuration. Disabling reuse source delta is useful when | |
820 | # we want to make sure we recomputed "optimal" deltas. |
|
821 | # we want to make sure we recomputed "optimal" deltas. | |
821 | debug_info = None |
|
822 | debug_info = None | |
822 | if cachedelta and revlog._generaldelta and revlog._lazydeltabase: |
|
823 | if cachedelta is not None and cachedelta[2] > DELTA_BASE_REUSE_NO: | |
823 | # Assume what we received from the server is a good choice |
|
824 | # Assume what we received from the server is a good choice | |
824 | # build delta will reuse the cache |
|
825 | # build delta will reuse the cache | |
825 | if debug_info is not None: |
|
826 | if debug_info is not None: |
General Comments 0
You need to be logged in to leave comments.
Login now