Mercurial > hg
comparison mercurial/revlogutils/deltas.py @ 51323:87fce139e927
delta-find: move snapshot_cache in the _DeltaSearch.__init__
Now that we have an object we can initialize that attribute at initialization
time.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 20 Nov 2023 05:03:21 +0100 |
parents | a227e061bb4b |
children | 047358417d01 |
comparison
equal
deleted
inserted
replaced
51322:a227e061bb4b | 51323:87fce139e927 |
---|---|
698 self.p1 = p1 | 698 self.p1 = p1 |
699 self.p2 = p2 | 699 self.p2 = p2 |
700 self.cachedelta = cachedelta | 700 self.cachedelta = cachedelta |
701 self.excluded_bases = excluded_bases | 701 self.excluded_bases = excluded_bases |
702 self.target_rev = target_rev | 702 self.target_rev = target_rev |
703 if snapshot_cache is None: | |
704 # map: base-rev: [snapshot-revs] | |
705 snapshot_cache = SnapshotCache() | |
703 self.snapshot_cache = snapshot_cache | 706 self.snapshot_cache = snapshot_cache |
704 | 707 |
705 def candidate_groups(self): | 708 def candidate_groups(self): |
706 """Provides group of revision to be tested as delta base | 709 """Provides group of revision to be tested as delta base |
707 | 710 |
884 if good is not None: | 887 if good is not None: |
885 if debug_info is not None: | 888 if debug_info is not None: |
886 debug_info['cached-delta.accepted'] += 1 | 889 debug_info['cached-delta.accepted'] += 1 |
887 yield None | 890 yield None |
888 return | 891 return |
889 if self.snapshot_cache is None: | |
890 self.snapshot_cache = SnapshotCache() | |
891 groups = self._raw_groups() | 892 groups = self._raw_groups() |
892 for candidates in groups: | 893 for candidates in groups: |
893 good = yield candidates | 894 good = yield candidates |
894 if good is not None: | 895 if good is not None: |
895 break | 896 break |
963 elif len(parents) > 0: | 964 elif len(parents) > 0: |
964 # Test all parents (1 or 2), and keep the best candidate | 965 # Test all parents (1 or 2), and keep the best candidate |
965 yield parents | 966 yield parents |
966 | 967 |
967 if sparse and parents: | 968 if sparse and parents: |
968 if self.snapshot_cache is None: | |
969 # map: base-rev: [snapshot-revs] | |
970 self.snapshot_cache = SnapshotCache() | |
971 # See if we can use an existing snapshot in the parent chains to | 969 # See if we can use an existing snapshot in the parent chains to |
972 # use as a base for a new intermediate-snapshot | 970 # use as a base for a new intermediate-snapshot |
973 # | 971 # |
974 # search for snapshot in parents delta chain map: snapshot-level: | 972 # search for snapshot in parents delta chain map: snapshot-level: |
975 # snapshot-rev | 973 # snapshot-rev |