Show More
@@ -741,13 +741,7 b' class _DeltaSearch:' | |||||
741 | group_chunk_size = self.revlog.delta_config.candidate_group_chunk_size |
|
741 | group_chunk_size = self.revlog.delta_config.candidate_group_chunk_size | |
742 |
|
742 | |||
743 | tested = {nullrev} |
|
743 | tested = {nullrev} | |
744 | candidates = _refinedgroups( |
|
744 | candidates = self._refined_groups() | |
745 | self.revlog, |
|
|||
746 | self.p1, |
|
|||
747 | self.p2, |
|
|||
748 | self.cachedelta, |
|
|||
749 | snapshot_cache=self.snapshot_cache, |
|
|||
750 | ) |
|
|||
751 | while True: |
|
745 | while True: | |
752 | temptative = candidates.send(good) |
|
746 | temptative = candidates.send(good) | |
753 | if temptative is None: |
|
747 | if temptative is None: | |
@@ -869,70 +863,79 b' class _DeltaSearch:' | |||||
869 |
|
863 | |||
870 | yield None |
|
864 | yield None | |
871 |
|
865 | |||
|
866 | def _refined_groups(self): | |||
|
867 | good = None | |||
|
868 | # First we try to reuse a the delta contained in the bundle. (or from | |||
|
869 | # the source revlog) | |||
|
870 | # | |||
|
871 | # This logic only applies to general delta repositories and can be | |||
|
872 | # disabled through configuration. Disabling reuse source delta is | |||
|
873 | # useful when we want to make sure we recomputed "optimal" deltas. | |||
|
874 | debug_info = None | |||
|
875 | if ( | |||
|
876 | self.cachedelta is not None | |||
|
877 | and self.cachedelta[2] > DELTA_BASE_REUSE_NO | |||
|
878 | ): | |||
|
879 | # Assume what we received from the server is a good choice | |||
|
880 | # build delta will reuse the cache | |||
|
881 | if debug_info is not None: | |||
|
882 | debug_info['cached-delta.tested'] += 1 | |||
|
883 | good = yield (self.cachedelta[0],) | |||
|
884 | if good is not None: | |||
|
885 | if debug_info is not None: | |||
|
886 | debug_info['cached-delta.accepted'] += 1 | |||
|
887 | yield None | |||
|
888 | return | |||
|
889 | if self.snapshot_cache is None: | |||
|
890 | self.snapshot_cache = SnapshotCache() | |||
|
891 | groups = _rawgroups( | |||
|
892 | self.revlog, | |||
|
893 | self.p1, | |||
|
894 | self.p2, | |||
|
895 | self.cachedelta, | |||
|
896 | self.snapshot_cache, | |||
|
897 | ) | |||
|
898 | for candidates in groups: | |||
|
899 | good = yield candidates | |||
|
900 | if good is not None: | |||
|
901 | break | |||
872 |
|
902 | |||
873 | def _refinedgroups(revlog, p1, p2, cachedelta, snapshot_cache=None): |
|
903 | # If sparse revlog is enabled, we can try to refine the available | |
874 | good = None |
|
904 | # deltas | |
875 | # First we try to reuse a the delta contained in the bundle. |
|
905 | if not self.revlog.delta_config.sparse_revlog: | |
876 | # (or from the source revlog) |
|
|||
877 | # |
|
|||
878 | # This logic only applies to general delta repositories and can be disabled |
|
|||
879 | # through configuration. Disabling reuse source delta is useful when |
|
|||
880 | # we want to make sure we recomputed "optimal" deltas. |
|
|||
881 | debug_info = None |
|
|||
882 | if cachedelta is not None and cachedelta[2] > DELTA_BASE_REUSE_NO: |
|
|||
883 | # Assume what we received from the server is a good choice |
|
|||
884 | # build delta will reuse the cache |
|
|||
885 | if debug_info is not None: |
|
|||
886 | debug_info['cached-delta.tested'] += 1 |
|
|||
887 | good = yield (cachedelta[0],) |
|
|||
888 | if good is not None: |
|
|||
889 | if debug_info is not None: |
|
|||
890 | debug_info['cached-delta.accepted'] += 1 |
|
|||
891 | yield None |
|
906 | yield None | |
892 | return |
|
907 | return | |
893 | if snapshot_cache is None: |
|
|||
894 | snapshot_cache = SnapshotCache() |
|
|||
895 | groups = _rawgroups( |
|
|||
896 | revlog, |
|
|||
897 | p1, |
|
|||
898 | p2, |
|
|||
899 | cachedelta, |
|
|||
900 | snapshot_cache, |
|
|||
901 | ) |
|
|||
902 | for candidates in groups: |
|
|||
903 | good = yield candidates |
|
|||
904 | if good is not None: |
|
|||
905 | break |
|
|||
906 |
|
||||
907 | # If sparse revlog is enabled, we can try to refine the available deltas |
|
|||
908 | if not revlog.delta_config.sparse_revlog: |
|
|||
909 | yield None |
|
|||
910 | return |
|
|||
911 |
|
908 | |||
912 | # if we have a refinable value, try to refine it |
|
909 | # if we have a refinable value, try to refine it | |
913 | if good is not None and good not in (p1, p2) and revlog.issnapshot(good): |
|
910 | if ( | |
914 | # refine snapshot down |
|
911 | good is not None | |
915 | previous = None |
|
912 | and good not in (self.p1, self.p2) | |
916 | while previous != good: |
|
913 | and self.revlog.issnapshot(good) | |
917 | previous = good |
|
914 | ): | |
918 | base = revlog.deltaparent(good) |
|
915 | # refine snapshot down | |
919 | if base == nullrev: |
|
916 | previous = None | |
920 | break |
|
917 | while previous != good: | |
921 | good = yield (base,) |
|
918 | previous = good | |
922 | # refine snapshot up |
|
919 | base = self.revlog.deltaparent(good) | |
923 | if not snapshot_cache.snapshots: |
|
920 | if base == nullrev: | |
924 | snapshot_cache.update(revlog, good + 1) |
|
921 | break | |
925 | previous = None |
|
922 | good = yield (base,) | |
926 | while good != previous: |
|
923 | # refine snapshot up | |
927 | previous = good |
|
924 | if not self.snapshot_cache.snapshots: | |
928 | children = tuple(sorted(c for c in snapshot_cache.snapshots[good])) |
|
925 | self.snapshot_cache.update(self.revlog, good + 1) | |
929 | good = yield children |
|
926 | previous = None | |
|
927 | while good != previous: | |||
|
928 | previous = good | |||
|
929 | children = tuple( | |||
|
930 | sorted(c for c in self.snapshot_cache.snapshots[good]) | |||
|
931 | ) | |||
|
932 | good = yield children | |||
930 |
|
933 | |||
931 | if debug_info is not None: |
|
934 | if debug_info is not None: | |
932 | if good is None: |
|
935 | if good is None: | |
933 | debug_info['no-solution'] += 1 |
|
936 | debug_info['no-solution'] += 1 | |
934 |
|
937 | |||
935 | yield None |
|
938 | yield None | |
936 |
|
939 | |||
937 |
|
940 | |||
938 | def _rawgroups(revlog, p1, p2, cachedelta, snapshot_cache=None): |
|
941 | def _rawgroups(revlog, p1, p2, cachedelta, snapshot_cache=None): |
General Comments 0
You need to be logged in to leave comments.
Login now