##// END OF EJS Templates
addrevision: use general delta when the incoming base delta is bad...
Pierre-Yves David -
r27191:20a9226b default
parent child Browse files
Show More
@@ -1424,22 +1424,23 b' class revlog(object):'
1424
1424
1425 # should we try to build a delta?
1425 # should we try to build a delta?
1426 if prev != nullrev:
1426 if prev != nullrev:
1427 tested = set()
1427 if cachedelta and self._generaldelta and self._lazydeltabase:
1428 if cachedelta and self._generaldelta and self._lazydeltabase:
1428 # Assume what we received from the server is a good choice
1429 # Assume what we received from the server is a good choice
1429 # build delta will reuse the cache
1430 # build delta will reuse the cache
1430 candidatedelta = builddelta(cachedelta[0])
1431 candidatedelta = builddelta(cachedelta[0])
1432 tested.add(candidatedelta[3])
1431 if self._isgooddelta(candidatedelta, textlen):
1433 if self._isgooddelta(candidatedelta, textlen):
1432 delta = candidatedelta
1434 delta = candidatedelta
1433 elif prev != candidatedelta[3]:
1435 if delta is None and self._generaldelta:
1434 # Try against prev to hopefully save us a fulltext.
1435 delta = builddelta(prev)
1436 elif self._generaldelta:
1437 parents = [p1r, p2r]
1436 parents = [p1r, p2r]
1438 if not self._aggressivemergedeltas:
1437 # exclude already lazy tested base if any
1438 parents = [p for p in parents if p not in tested]
1439 if parents and not self._aggressivemergedeltas:
1439 # Pick whichever parent is closer to us (to minimize the
1440 # Pick whichever parent is closer to us (to minimize the
1440 # chance of having to build a fulltext). Since
1441 # chance of having to build a fulltext).
1441 # nullrev == -1, any non-merge commit will always pick p1r.
1442 parents = [max(parents)]
1442 parents = [max(parents)]
1443 tested.update(parents)
1443 pdeltas = []
1444 pdeltas = []
1444 for p in parents:
1445 for p in parents:
1445 pd = builddelta(p)
1446 pd = builddelta(p)
@@ -1447,11 +1448,9 b' class revlog(object):'
1447 pdeltas.append(pd)
1448 pdeltas.append(pd)
1448 if pdeltas:
1449 if pdeltas:
1449 delta = min(pdeltas, key=lambda x: x[1])
1450 delta = min(pdeltas, key=lambda x: x[1])
1450 elif prev not in parents:
1451 if delta is None and prev not in tested:
1451 # Neither is good, try against prev to hopefully save us
1452 # other approach failed try against prev to hopefully save us a
1452 # a fulltext.
1453 # fulltext.
1453 delta = builddelta(prev)
1454 else:
1455 delta = builddelta(prev)
1454 delta = builddelta(prev)
1456 if delta is not None:
1455 if delta is not None:
1457 dist, l, data, base, chainbase, chainlen, compresseddeltalen = delta
1456 dist, l, data, base, chainbase, chainlen, compresseddeltalen = delta
@@ -266,13 +266,13 b' Cannot produce streaming clone bundles w'
266 packed1 is produced properly
266 packed1 is produced properly
267
267
268 $ hg -R test debugcreatestreamclonebundle packed.hg
268 $ hg -R test debugcreatestreamclonebundle packed.hg
269 writing 2663 bytes for 6 files
269 writing 2667 bytes for 6 files
270 bundle requirements: generaldelta, revlogv1
270 bundle requirements: generaldelta, revlogv1
271
271
272 $ f -B 64 --size --sha1 --hexdump packed.hg
272 $ f -B 64 --size --sha1 --hexdump packed.hg
273 packed.hg: size=2826, sha1=e139f97692a142b19cdcff64a69697d5307ce6d4
273 packed.hg: size=2830, sha1=c28255110a88ffa52ddc44985cad295b1ab349bc
274 0000: 48 47 53 31 55 4e 00 00 00 00 00 00 00 06 00 00 |HGS1UN..........|
274 0000: 48 47 53 31 55 4e 00 00 00 00 00 00 00 06 00 00 |HGS1UN..........|
275 0010: 00 00 00 00 0a 67 00 16 67 65 6e 65 72 61 6c 64 |.....g..generald|
275 0010: 00 00 00 00 0a 6b 00 16 67 65 6e 65 72 61 6c 64 |.....k..generald|
276 0020: 65 6c 74 61 2c 72 65 76 6c 6f 67 76 31 00 64 61 |elta,revlogv1.da|
276 0020: 65 6c 74 61 2c 72 65 76 6c 6f 67 76 31 00 64 61 |elta,revlogv1.da|
277 0030: 74 61 2f 61 64 69 66 66 65 72 65 6e 74 66 69 6c |ta/adifferentfil|
277 0030: 74 61 2f 61 64 69 66 66 65 72 65 6e 74 66 69 6c |ta/adifferentfil|
278
278
@@ -105,7 +105,7 b' delta coming from the server base delta '
105 0 0 104 -1 0 cef96823c800 000000000000 000000000000
105 0 0 104 -1 0 cef96823c800 000000000000 000000000000
106 1 104 57 0 1 58ab9a8d541d cef96823c800 000000000000
106 1 104 57 0 1 58ab9a8d541d cef96823c800 000000000000
107 2 161 57 1 2 134fdc6fd680 cef96823c800 000000000000
107 2 161 57 1 2 134fdc6fd680 cef96823c800 000000000000
108 3 218 104 -1 3 723508934dad cef96823c800 000000000000
108 3 218 57 0 3 723508934dad cef96823c800 000000000000
109 $ hg -R full debugindex -m
109 $ hg -R full debugindex -m
110 rev offset length delta linkrev nodeid p1 p2
110 rev offset length delta linkrev nodeid p1 p2
111 0 0 104 -1 0 cef96823c800 000000000000 000000000000
111 0 0 104 -1 0 cef96823c800 000000000000 000000000000
General Comments 0
You need to be logged in to leave comments. Login now