Show More
@@ -2542,6 +2542,7 b' class revlog(object):' | |||
|
2542 | 2542 | addrevisioncb=None, |
|
2543 | 2543 | deltareuse=DELTAREUSESAMEREVS, |
|
2544 | 2544 | forcedeltabothparents=None, |
|
2545 | sidedatacompanion=None, | |
|
2545 | 2546 | ): |
|
2546 | 2547 | """Copy this revlog to another, possibly with format changes. |
|
2547 | 2548 | |
@@ -2583,6 +2584,20 b' class revlog(object):' | |||
|
2583 | 2584 | In addition to the delta policy, the ``forcedeltabothparents`` |
|
2584 | 2585 | argument controls whether to force compute deltas against both parents |
|
2585 | 2586 | for merges. By default, the current default is used. |
|
2587 | ||
|
2588 | If not None, the `sidedatacompanion` is callable that accept two | |
|
2589 | arguments: | |
|
2590 | ||
|
2591 | (srcrevlog, rev) | |
|
2592 | ||
|
2593 | and return a triplet that control changes to sidedata content from the | |
|
2594 | old revision to the new clone result: | |
|
2595 | ||
|
2596 | (dropall, filterout, update) | |
|
2597 | ||
|
2598 | * if `dropall` is True, all sidedata should be dropped | |
|
2599 | * `filterout` is a set of sidedata keys that should be dropped | |
|
2600 | * `update` is a mapping of additionnal/new key -> value | |
|
2586 | 2601 | """ |
|
2587 | 2602 | if deltareuse not in self.DELTAREUSEALL: |
|
2588 | 2603 | raise ValueError( |
@@ -2617,7 +2632,12 b' class revlog(object):' | |||
|
2617 | 2632 | destrevlog._deltabothparents = forcedeltabothparents or oldamd |
|
2618 | 2633 | |
|
2619 | 2634 | self._clone( |
|
2620 | tr, destrevlog, addrevisioncb, deltareuse, forcedeltabothparents | |
|
2635 | tr, | |
|
2636 | destrevlog, | |
|
2637 | addrevisioncb, | |
|
2638 | deltareuse, | |
|
2639 | forcedeltabothparents, | |
|
2640 | sidedatacompanion, | |
|
2621 | 2641 | ) |
|
2622 | 2642 | |
|
2623 | 2643 | finally: |
@@ -2626,7 +2646,13 b' class revlog(object):' | |||
|
2626 | 2646 | destrevlog._deltabothparents = oldamd |
|
2627 | 2647 | |
|
2628 | 2648 | def _clone( |
|
2629 | self, tr, destrevlog, addrevisioncb, deltareuse, forcedeltabothparents | |
|
2649 | self, | |
|
2650 | tr, | |
|
2651 | destrevlog, | |
|
2652 | addrevisioncb, | |
|
2653 | deltareuse, | |
|
2654 | forcedeltabothparents, | |
|
2655 | sidedatacompanion, | |
|
2630 | 2656 | ): |
|
2631 | 2657 | """perform the core duty of `revlog.clone` after parameter processing""" |
|
2632 | 2658 | deltacomputer = deltautil.deltacomputer(destrevlog) |
@@ -2642,12 +2668,24 b' class revlog(object):' | |||
|
2642 | 2668 | p2 = index[entry[6]][7] |
|
2643 | 2669 | node = entry[7] |
|
2644 | 2670 | |
|
2671 | sidedataactions = (False, [], {}) | |
|
2672 | if sidedatacompanion is not None: | |
|
2673 | sidedataactions = sidedatacompanion(self, rev) | |
|
2674 | ||
|
2645 | 2675 | # (Possibly) reuse the delta from the revlog if allowed and |
|
2646 | 2676 | # the revlog chunk is a delta. |
|
2647 | 2677 | cachedelta = None |
|
2648 | 2678 | rawtext = None |
|
2649 | if deltareuse == self.DELTAREUSEFULLADD: | |
|
2650 | text = self.revision(rev) | |
|
2679 | if any(sidedataactions) or deltareuse == self.DELTAREUSEFULLADD: | |
|
2680 | dropall, filterout, update = sidedataactions | |
|
2681 | text, sidedata = self._revisiondata(rev) | |
|
2682 | if dropall: | |
|
2683 | sidedata = {} | |
|
2684 | for key in filterout: | |
|
2685 | sidedata.pop(key, None) | |
|
2686 | sidedata.update(update) | |
|
2687 | if not sidedata: | |
|
2688 | sidedata = None | |
|
2651 | 2689 | destrevlog.addrevision( |
|
2652 | 2690 | text, |
|
2653 | 2691 | tr, |
@@ -2658,6 +2696,7 b' class revlog(object):' | |||
|
2658 | 2696 | node=node, |
|
2659 | 2697 | flags=flags, |
|
2660 | 2698 | deltacomputer=deltacomputer, |
|
2699 | sidedata=sidedata, | |
|
2661 | 2700 | ) |
|
2662 | 2701 | else: |
|
2663 | 2702 | if destrevlog._lazydelta: |
General Comments 0
You need to be logged in to leave comments.
Login now