Show More
@@ -354,6 +354,10 b' class localrepository(object):' | |||||
354 | manifestcachesize = self.ui.configint('format', 'manifestcachesize') |
|
354 | manifestcachesize = self.ui.configint('format', 'manifestcachesize') | |
355 | if manifestcachesize is not None: |
|
355 | if manifestcachesize is not None: | |
356 | self.svfs.options['manifestcachesize'] = manifestcachesize |
|
356 | self.svfs.options['manifestcachesize'] = manifestcachesize | |
|
357 | # experimental config: format.aggressivemergedeltas | |||
|
358 | aggressivemergedeltas = self.ui.configbool('format', | |||
|
359 | 'aggressivemergedeltas', False) | |||
|
360 | self.svfs.options['aggressivemergedeltas'] = aggressivemergedeltas | |||
357 |
|
361 | |||
358 | def _writerequirements(self): |
|
362 | def _writerequirements(self): | |
359 | scmutil.writerequires(self.vfs, self.requirements) |
|
363 | scmutil.writerequires(self.vfs, self.requirements) |
@@ -210,6 +210,7 b' class revlog(object):' | |||||
210 | self._chunkcache = (0, '') |
|
210 | self._chunkcache = (0, '') | |
211 | self._chunkcachesize = 65536 |
|
211 | self._chunkcachesize = 65536 | |
212 | self._maxchainlen = None |
|
212 | self._maxchainlen = None | |
|
213 | self._aggressivemergedeltas = False | |||
213 | self.index = [] |
|
214 | self.index = [] | |
214 | self._pcache = {} |
|
215 | self._pcache = {} | |
215 | self._nodecache = {nullid: nullrev} |
|
216 | self._nodecache = {nullid: nullrev} | |
@@ -227,6 +228,8 b' class revlog(object):' | |||||
227 | self._chunkcachesize = opts['chunkcachesize'] |
|
228 | self._chunkcachesize = opts['chunkcachesize'] | |
228 | if 'maxchainlen' in opts: |
|
229 | if 'maxchainlen' in opts: | |
229 | self._maxchainlen = opts['maxchainlen'] |
|
230 | self._maxchainlen = opts['maxchainlen'] | |
|
231 | if 'aggressivemergedeltas' in opts: | |||
|
232 | self._aggressivemergedeltas = opts['aggressivemergedeltas'] | |||
230 |
|
233 | |||
231 | if self._chunkcachesize <= 0: |
|
234 | if self._chunkcachesize <= 0: | |
232 | raise RevlogError(_('revlog chunk cache size %r is not greater ' |
|
235 | raise RevlogError(_('revlog chunk cache size %r is not greater ' | |
@@ -1343,6 +1346,25 b' class revlog(object):' | |||||
1343 | # should we try to build a delta? |
|
1346 | # should we try to build a delta? | |
1344 | if prev != nullrev: |
|
1347 | if prev != nullrev: | |
1345 | if self._generaldelta: |
|
1348 | if self._generaldelta: | |
|
1349 | if p2r != nullrev and self._aggressivemergedeltas: | |||
|
1350 | d = builddelta(p1r) | |||
|
1351 | d2 = builddelta(p2r) | |||
|
1352 | p1good = self._isgooddelta(d, textlen) | |||
|
1353 | p2good = self._isgooddelta(d2, textlen) | |||
|
1354 | if p1good and p2good: | |||
|
1355 | # If both are good deltas, choose the smallest | |||
|
1356 | if d2[1] < d[1]: | |||
|
1357 | d = d2 | |||
|
1358 | elif p2good: | |||
|
1359 | # If only p2 is good, use it | |||
|
1360 | d = d2 | |||
|
1361 | elif p1good: | |||
|
1362 | pass | |||
|
1363 | else: | |||
|
1364 | # Neither is good, try against prev to hopefully save us | |||
|
1365 | # a fulltext. | |||
|
1366 | d = builddelta(prev) | |||
|
1367 | else: | |||
1346 | # Pick whichever parent is closer to us (to minimize the |
|
1368 | # Pick whichever parent is closer to us (to minimize the | |
1347 | # chance of having to build a fulltext). Since |
|
1369 | # chance of having to build a fulltext). Since | |
1348 | # nullrev == -1, any non-merge commit will always pick p1r. |
|
1370 | # nullrev == -1, any non-merge commit will always pick p1r. |
@@ -69,3 +69,37 b' commit.' | |||||
69 | rev offset length base linkrev nodeid p1 p2 |
|
69 | rev offset length base linkrev nodeid p1 p2 | |
70 | 0 0 3 0 1 1406e7411862 000000000000 000000000000 |
|
70 | 0 0 3 0 1 1406e7411862 000000000000 000000000000 | |
71 |
|
71 | |||
|
72 | $ cd .. | |||
|
73 | ||||
|
74 | Test format.aggressivemergedeltas | |||
|
75 | ||||
|
76 | $ hg init --config format.generaldelta=1 aggressive | |||
|
77 | $ cd aggressive | |||
|
78 | $ touch a b c d e | |||
|
79 | $ hg commit -Aqm side1 | |||
|
80 | $ hg up -q null | |||
|
81 | $ touch x y | |||
|
82 | $ hg commit -Aqm side2 | |||
|
83 | ||||
|
84 | - Verify non-aggressive merge uses p1 (commit 1) as delta parent | |||
|
85 | $ hg merge -q 0 | |||
|
86 | $ hg commit -q -m merge | |||
|
87 | $ hg debugindex -m | |||
|
88 | rev offset length delta linkrev nodeid p1 p2 | |||
|
89 | 0 0 59 -1 0 8dde941edb6e 000000000000 000000000000 | |||
|
90 | 1 59 59 -1 1 315c023f341d 000000000000 000000000000 | |||
|
91 | 2 118 65 1 2 2ab389a983eb 315c023f341d 8dde941edb6e | |||
|
92 | ||||
|
93 | $ hg strip -q -r . --config extensions.strip= | |||
|
94 | ||||
|
95 | - Verify aggressive merge uses p2 (commit 0) as delta parent | |||
|
96 | $ hg up -q -C 1 | |||
|
97 | $ hg merge -q 0 | |||
|
98 | $ hg commit -q -m merge --config format.aggressivemergedeltas=True | |||
|
99 | $ hg debugindex -m | |||
|
100 | rev offset length delta linkrev nodeid p1 p2 | |||
|
101 | 0 0 59 -1 0 8dde941edb6e 000000000000 000000000000 | |||
|
102 | 1 59 59 -1 1 315c023f341d 000000000000 000000000000 | |||
|
103 | 2 118 62 0 2 2ab389a983eb 315c023f341d 8dde941edb6e | |||
|
104 | ||||
|
105 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now