Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 38736:93777d16a25d
aggressivemergedeltas: rename variable internally
The "aggressivemergedeltas" name is not great. First, it is quite long,
second, we would rather have less "Aggressive" names within the project. We
are about to rename the config option, so it seems the appropriate time to
rename the internal variable.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 19 Jul 2018 10:06:58 +0200 |
parents | f8762ea73e0d |
children | 33ac6a72308a |
comparison
equal
deleted
inserted
replaced
38735:8891dc15b327 | 38736:93777d16a25d |
---|---|
626 if gdelta: | 626 if gdelta: |
627 # exclude already lazy tested base if any | 627 # exclude already lazy tested base if any |
628 parents = [p for p in (p1r, p2r) | 628 parents = [p for p in (p1r, p2r) |
629 if p != nullrev and p not in tested] | 629 if p != nullrev and p not in tested] |
630 | 630 |
631 if not revlog._aggressivemergedeltas and len(parents) == 2: | 631 if not revlog._deltabothparents and len(parents) == 2: |
632 parents.sort() | 632 parents.sort() |
633 # To minimize the chance of having to build a fulltext, | 633 # To minimize the chance of having to build a fulltext, |
634 # pick first whichever parent is closest to us (max rev) | 634 # pick first whichever parent is closest to us (max rev) |
635 yield (parents[1],) | 635 yield (parents[1],) |
636 # then the other one (min rev) if the first did not fit | 636 # then the other one (min rev) if the first did not fit |
913 # 2-tuple of (offset, data) of raw data from the revlog at an offset. | 913 # 2-tuple of (offset, data) of raw data from the revlog at an offset. |
914 self._chunkcache = (0, '') | 914 self._chunkcache = (0, '') |
915 # How much data to read and cache into the raw revlog data cache. | 915 # How much data to read and cache into the raw revlog data cache. |
916 self._chunkcachesize = 65536 | 916 self._chunkcachesize = 65536 |
917 self._maxchainlen = None | 917 self._maxchainlen = None |
918 self._aggressivemergedeltas = True | 918 self._deltabothparents = True |
919 self.index = [] | 919 self.index = [] |
920 # Mapping of partial identifiers to full nodes. | 920 # Mapping of partial identifiers to full nodes. |
921 self._pcache = {} | 921 self._pcache = {} |
922 # Mapping of revision integer to full node. | 922 # Mapping of revision integer to full node. |
923 self._nodecache = {nullid: nullrev} | 923 self._nodecache = {nullid: nullrev} |
943 v = 0 | 943 v = 0 |
944 if 'chunkcachesize' in opts: | 944 if 'chunkcachesize' in opts: |
945 self._chunkcachesize = opts['chunkcachesize'] | 945 self._chunkcachesize = opts['chunkcachesize'] |
946 if 'maxchainlen' in opts: | 946 if 'maxchainlen' in opts: |
947 self._maxchainlen = opts['maxchainlen'] | 947 self._maxchainlen = opts['maxchainlen'] |
948 if 'aggressivemergedeltas' in opts: | 948 if 'deltabothparents' in opts: |
949 self._aggressivemergedeltas = opts['aggressivemergedeltas'] | 949 self._deltabothparents = opts['deltabothparents'] |
950 self._lazydeltabase = bool(opts.get('lazydeltabase', False)) | 950 self._lazydeltabase = bool(opts.get('lazydeltabase', False)) |
951 if 'compengine' in opts: | 951 if 'compengine' in opts: |
952 self._compengine = opts['compengine'] | 952 self._compengine = opts['compengine'] |
953 if 'maxdeltachainspan' in opts: | 953 if 'maxdeltachainspan' in opts: |
954 self._maxdeltachainspan = opts['maxdeltachainspan'] | 954 self._maxdeltachainspan = opts['maxdeltachainspan'] |
2841 DELTAREUSEFULLADD = 'fulladd' | 2841 DELTAREUSEFULLADD = 'fulladd' |
2842 | 2842 |
2843 DELTAREUSEALL = {'always', 'samerevs', 'never', 'fulladd'} | 2843 DELTAREUSEALL = {'always', 'samerevs', 'never', 'fulladd'} |
2844 | 2844 |
2845 def clone(self, tr, destrevlog, addrevisioncb=None, | 2845 def clone(self, tr, destrevlog, addrevisioncb=None, |
2846 deltareuse=DELTAREUSESAMEREVS, aggressivemergedeltas=None): | 2846 deltareuse=DELTAREUSESAMEREVS, deltabothparents=None): |
2847 """Copy this revlog to another, possibly with format changes. | 2847 """Copy this revlog to another, possibly with format changes. |
2848 | 2848 |
2849 The destination revlog will contain the same revisions and nodes. | 2849 The destination revlog will contain the same revisions and nodes. |
2850 However, it may not be bit-for-bit identical due to e.g. delta encoding | 2850 However, it may not be bit-for-bit identical due to e.g. delta encoding |
2851 differences. | 2851 differences. |
2875 delta could choose a better revision, it will do so. This means if you | 2875 delta could choose a better revision, it will do so. This means if you |
2876 are converting a non-generaldelta revlog to a generaldelta revlog, | 2876 are converting a non-generaldelta revlog to a generaldelta revlog, |
2877 deltas will be recomputed if the delta's parent isn't a parent of the | 2877 deltas will be recomputed if the delta's parent isn't a parent of the |
2878 revision. | 2878 revision. |
2879 | 2879 |
2880 In addition to the delta policy, the ``aggressivemergedeltas`` argument | 2880 In addition to the delta policy, the ``deltabothparents`` argument |
2881 controls whether to compute deltas against both parents for merges. | 2881 controls whether to compute deltas against both parents for merges. |
2882 By default, the current default is used. | 2882 By default, the current default is used. |
2883 """ | 2883 """ |
2884 if deltareuse not in self.DELTAREUSEALL: | 2884 if deltareuse not in self.DELTAREUSEALL: |
2885 raise ValueError(_('value for deltareuse invalid: %s') % deltareuse) | 2885 raise ValueError(_('value for deltareuse invalid: %s') % deltareuse) |
2892 if getattr(destrevlog, 'filteredrevs', None): | 2892 if getattr(destrevlog, 'filteredrevs', None): |
2893 raise ValueError(_('destination revlog has filtered revisions')) | 2893 raise ValueError(_('destination revlog has filtered revisions')) |
2894 | 2894 |
2895 # lazydeltabase controls whether to reuse a cached delta, if possible. | 2895 # lazydeltabase controls whether to reuse a cached delta, if possible. |
2896 oldlazydeltabase = destrevlog._lazydeltabase | 2896 oldlazydeltabase = destrevlog._lazydeltabase |
2897 oldamd = destrevlog._aggressivemergedeltas | 2897 oldamd = destrevlog._deltabothparents |
2898 | 2898 |
2899 try: | 2899 try: |
2900 if deltareuse == self.DELTAREUSEALWAYS: | 2900 if deltareuse == self.DELTAREUSEALWAYS: |
2901 destrevlog._lazydeltabase = True | 2901 destrevlog._lazydeltabase = True |
2902 elif deltareuse == self.DELTAREUSESAMEREVS: | 2902 elif deltareuse == self.DELTAREUSESAMEREVS: |
2903 destrevlog._lazydeltabase = False | 2903 destrevlog._lazydeltabase = False |
2904 | 2904 |
2905 destrevlog._aggressivemergedeltas = aggressivemergedeltas or oldamd | 2905 destrevlog._deltabothparents = deltabothparents or oldamd |
2906 | 2906 |
2907 populatecachedelta = deltareuse in (self.DELTAREUSEALWAYS, | 2907 populatecachedelta = deltareuse in (self.DELTAREUSEALWAYS, |
2908 self.DELTAREUSESAMEREVS) | 2908 self.DELTAREUSESAMEREVS) |
2909 | 2909 |
2910 deltacomputer = _deltacomputer(destrevlog) | 2910 deltacomputer = _deltacomputer(destrevlog) |
2955 | 2955 |
2956 if addrevisioncb: | 2956 if addrevisioncb: |
2957 addrevisioncb(self, rev, node) | 2957 addrevisioncb(self, rev, node) |
2958 finally: | 2958 finally: |
2959 destrevlog._lazydeltabase = oldlazydeltabase | 2959 destrevlog._lazydeltabase = oldlazydeltabase |
2960 destrevlog._aggressivemergedeltas = oldamd | 2960 destrevlog._deltabothparents = oldamd |