mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
datapack: remove delta reuse
Summary: This code that reused deltas if the delta parent wasn't available was bugged because it meant you could end up with a cycle in the delta chains. This was an old optimization from before trees had history, so let's drop the optimization (since trees now have history and can be correctly repacked). Test Plan: Ran repack on a packfile that previously caused cycles. Verified the new version did not with `hg debugdatapack foo.datapack' Reviewers: #mercurial Subscribers: mjpieters Differential Revision: https://phabricator.intern.facebook.com/D4724520
This commit is contained in:
parent
efed1f1209
commit
63f4fa69a0
@ -332,20 +332,16 @@ class repacker(object):
|
||||
deltabases[p2] = node
|
||||
|
||||
# Compute delta
|
||||
# TODO: Optimize the deltachain fetching. Since we're
|
||||
# iterating over the different version of the file, we may
|
||||
# be fetching the same deltachain over and over again.
|
||||
# TODO: reuse existing deltas if it matches our deltabase
|
||||
if deltabase != nullid:
|
||||
deltabasetext = self.data.get(filename, deltabase)
|
||||
original = self.data.get(filename, node)
|
||||
delta = mdiff.textdiff(deltabasetext, original)
|
||||
else:
|
||||
# TODO: Optimize the deltachain fetching. Since we're
|
||||
# iterating over the different version of the file, we may
|
||||
# be fetching the same deltachain over and over again.
|
||||
chain = self.data.getdeltachain(filename, node)
|
||||
x, x, deltabasename, deltabase, delta = chain[0]
|
||||
if deltabasename != filename:
|
||||
deltabase = nullid
|
||||
delta = self.data.get(filename, node)
|
||||
delta = self.data.get(filename, node)
|
||||
|
||||
# TODO: don't use the delta if it's larger than the fulltext
|
||||
# TODO: don't use the delta if the chain is already long
|
||||
|
@ -232,13 +232,13 @@
|
||||
# Test repacking datapack without history
|
||||
$ rm -rf $CACHEDIR/master/packs/*hist*
|
||||
$ hg repack
|
||||
$ hg debugdatapack $TESTTMP/hgcache/master/packs/1c6261363473d5595d26728c201e1395d39bf94e
|
||||
$ hg debugdatapack $TESTTMP/hgcache/master/packs/60ed975b3589fc9708a374155083fbdc7da397cb
|
||||
|
||||
x
|
||||
Node Delta Base Delta Length
|
||||
1bb2e6237e03 000000000000 8
|
||||
aee31534993a d4a3ed9310e5 12
|
||||
d4a3ed9310e5 1bb2e6237e03 12
|
||||
aee31534993a 000000000000 4
|
||||
d4a3ed9310e5 000000000000 6
|
||||
|
||||
y
|
||||
Node Delta Base Delta Length
|
||||
|
@ -231,13 +231,13 @@
|
||||
# Test repacking datapack without history
|
||||
$ rm -rf $CACHEDIR/master/packs/*hist*
|
||||
$ hg repack
|
||||
$ hg debugdatapack $TESTTMP/hgcache/master/packs/1c6261363473d5595d26728c201e1395d39bf94e
|
||||
$ hg debugdatapack $TESTTMP/hgcache/master/packs/60ed975b3589fc9708a374155083fbdc7da397cb
|
||||
|
||||
x
|
||||
Node Delta Base Delta Length
|
||||
1bb2e6237e03 000000000000 8
|
||||
aee31534993a d4a3ed9310e5 12
|
||||
d4a3ed9310e5 1bb2e6237e03 12
|
||||
aee31534993a 000000000000 4
|
||||
d4a3ed9310e5 000000000000 6
|
||||
|
||||
y
|
||||
Node Delta Base Delta Length
|
||||
|
Loading…
Reference in New Issue
Block a user