D4943: remotefilelog: bump pack file formats to version 2
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Thu Oct 11 12:23:24 UTC 2018
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Drop support for format 0 and 1 packs. Version 2 will be different in
that it'll use zlib compression instead of lz4, as the latter isn't
really suitable for core.
If I can make it work, I'll make compression engines pluggable, but
the logic for handling these files is spread out enough it's a little
tricky to get that right.
Test changes are only due to pack files being renamed. The contents of
the packs are the same.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D4943
AFFECTED FILES
hgext/remotefilelog/basepack.py
hgext/remotefilelog/datapack.py
hgext/remotefilelog/historypack.py
hgext/remotefilelog/repack.py
tests/test-remotefilelog-bgprefetch.t
tests/test-remotefilelog-gc.t
tests/test-remotefilelog-gcrepack.t
tests/test-remotefilelog-prefetch.t
tests/test-remotefilelog-repack-fast.t
tests/test-remotefilelog-repack.t
CHANGE DETAILS
diff --git a/tests/test-remotefilelog-repack.t b/tests/test-remotefilelog-repack.t
--- a/tests/test-remotefilelog-repack.t
+++ b/tests/test-remotefilelog-repack.t
@@ -45,19 +45,19 @@
$TESTTMP/hgcache
$TESTTMP/hgcache/master
$TESTTMP/hgcache/master/packs
- $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histidx
- $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histpack
- $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.dataidx
- $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.datapack
+ $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
+ $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
+ $TESTTMP/hgcache/master/packs/add67cb28ae0a2962111588ce49467ca9ebb9195.dataidx
+ $TESTTMP/hgcache/master/packs/add67cb28ae0a2962111588ce49467ca9ebb9195.datapack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
# Test that the packs are readonly
$ ls_l $CACHEDIR/master/packs
- -r--r--r-- 1145 276d308429d0303762befa376788300f0310f90e.histidx
- -r--r--r-- 172 276d308429d0303762befa376788300f0310f90e.histpack
- -r--r--r-- 1074 8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.dataidx
- -r--r--r-- 69 8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.datapack
+ -r--r--r-- 1145 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
+ -r--r--r-- 172 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
+ -r--r--r-- 1074 add67cb28ae0a2962111588ce49467ca9ebb9195.dataidx
+ -r--r--r-- 69 add67cb28ae0a2962111588ce49467ca9ebb9195.datapack
-rw-r--r-- 0 repacklock
# Test that the data in the new packs is accessible
@@ -78,10 +78,10 @@
$ find $CACHEDIR -type f | sort
$TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
- $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histidx
- $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histpack
- $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.dataidx
- $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.datapack
+ $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
+ $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
+ $TESTTMP/hgcache/master/packs/add67cb28ae0a2962111588ce49467ca9ebb9195.dataidx
+ $TESTTMP/hgcache/master/packs/add67cb28ae0a2962111588ce49467ca9ebb9195.datapack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
@@ -91,20 +91,20 @@
$ find $CACHEDIR -type f | sort
$TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
- $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histidx
- $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histpack
- $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.dataidx
- $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.datapack
+ $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
+ $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
+ $TESTTMP/hgcache/master/packs/add67cb28ae0a2962111588ce49467ca9ebb9195.dataidx
+ $TESTTMP/hgcache/master/packs/add67cb28ae0a2962111588ce49467ca9ebb9195.datapack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
$ hg repack --traceback
$ find $CACHEDIR -type f | sort
- $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histidx
- $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
- $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.dataidx
- $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.datapack
+ $TESTTMP/hgcache/master/packs/1bd27e610ee06450e5f3bb0cd3afb6870e4cf375.dataidx
+ $TESTTMP/hgcache/master/packs/1bd27e610ee06450e5f3bb0cd3afb6870e4cf375.datapack
+ $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx
+ $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
@@ -121,10 +121,10 @@
# and did not change the pack names
$ hg repack
$ find $CACHEDIR -type f | sort
- $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histidx
- $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
- $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.dataidx
- $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.datapack
+ $TESTTMP/hgcache/master/packs/1bd27e610ee06450e5f3bb0cd3afb6870e4cf375.dataidx
+ $TESTTMP/hgcache/master/packs/1bd27e610ee06450e5f3bb0cd3afb6870e4cf375.datapack
+ $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx
+ $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
@@ -145,47 +145,47 @@
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
$ find $CACHEDIR -type f | sort
$TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1bb2e6237e035c8f8ef508e281f1ce075bc6db72
- $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histidx
- $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
- $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.dataidx
- $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.datapack
+ $TESTTMP/hgcache/master/packs/1bd27e610ee06450e5f3bb0cd3afb6870e4cf375.dataidx
+ $TESTTMP/hgcache/master/packs/1bd27e610ee06450e5f3bb0cd3afb6870e4cf375.datapack
+ $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx
+ $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
$ hg repack --background
(running background repack)
$ sleep 0.5
$ hg debugwaitonrepack >/dev/null 2>&1
$ find $CACHEDIR -type f | sort
- $TESTTMP/hgcache/master/packs/094b530486dad4427a0faf6bcbc031571b99ca24.histidx
- $TESTTMP/hgcache/master/packs/094b530486dad4427a0faf6bcbc031571b99ca24.histpack
- $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.dataidx
- $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.datapack
+ $TESTTMP/hgcache/master/packs/06ae46494f0e3b9beda53eae8fc0e55139f13123.dataidx
+ $TESTTMP/hgcache/master/packs/06ae46494f0e3b9beda53eae8fc0e55139f13123.datapack
+ $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histidx
+ $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histpack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
# Test debug commands
$ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack
- $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15:
+ $TESTTMP/hgcache/master/packs/06ae46494f0e3b9beda53eae8fc0e55139f13123:
x:
Node Delta Base Delta Length Blob Size
1bb2e6237e03 000000000000 8 8
d4a3ed9310e5 1bb2e6237e03 12 6
aee31534993a d4a3ed9310e5 12 4
Total: 32 18 (77.8% bigger)
$ hg debugdatapack --long $TESTTMP/hgcache/master/packs/*.datapack
- $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15:
+ $TESTTMP/hgcache/master/packs/06ae46494f0e3b9beda53eae8fc0e55139f13123:
x:
Node Delta Base Delta Length Blob Size
1bb2e6237e035c8f8ef508e281f1ce075bc6db72 0000000000000000000000000000000000000000 8 8
d4a3ed9310e5bd9887e3bf779da5077efab28216 1bb2e6237e035c8f8ef508e281f1ce075bc6db72 12 6
aee31534993a501858fb6dd96a065671922e7d51 d4a3ed9310e5bd9887e3bf779da5077efab28216 12 4
Total: 32 18 (77.8% bigger)
$ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack --node d4a3ed9310e5bd9887e3bf779da5077efab28216
- $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15:
+ $TESTTMP/hgcache/master/packs/06ae46494f0e3b9beda53eae8fc0e55139f13123:
x
Node Delta Base Delta SHA1 Delta Length
@@ -234,10 +234,10 @@
2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over * (glob)
$ hg repack
$ ls $TESTTMP/hgcache/master/packs
- e8fdf7ae22b772dcc291f905b9c6e5f381d28739.dataidx
- e8fdf7ae22b772dcc291f905b9c6e5f381d28739.datapack
- ebbd7411e00456c0eec8d1150a77e2b3ef490f3f.histidx
- ebbd7411e00456c0eec8d1150a77e2b3ef490f3f.histpack
+ 308a7aba9c54a0b71ae5adbbccd00c0aff20876e.dataidx
+ 308a7aba9c54a0b71ae5adbbccd00c0aff20876e.datapack
+ bfd60adb76018bb952e27cd23fc151bf94865d7d.histidx
+ bfd60adb76018bb952e27cd23fc151bf94865d7d.histpack
repacklock
$ hg debughistorypack $TESTTMP/hgcache/master/packs/*.histidx
@@ -267,7 +267,7 @@
$ rm -rf $CACHEDIR/master/packs/*hist*
$ hg repack
$ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack
- $TESTTMP/hgcache/master/packs/a8d86ff8e1a11a77a85f5fea567f56a757583eda:
+ $TESTTMP/hgcache/master/packs/ba4649b56263282b0699f9a6e7e34a4a2bac1638:
x:
Node Delta Base Delta Length Blob Size
1bb2e6237e03 000000000000 8 8
@@ -300,14 +300,14 @@
$ hg prefetch -r 0
1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
+ -r--r--r-- 63 58e22edd74c967c52f2b1f2373881fbaa98787d3.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
+ -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack
$ hg repack --incremental
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
+ -r--r--r-- 63 58e22edd74c967c52f2b1f2373881fbaa98787d3.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
+ -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack
3 gen1 packs, 1 gen0 pack - packs 3 gen1 into 1
$ hg prefetch -r 1
@@ -317,15 +317,15 @@
$ hg prefetch -r 3
1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
- -r--r--r-- 65 6c499d21350d79f92fd556b4b7a902569d88e3c9.datapack
- -r--r--r-- 61 817d294043bd21a3de01f807721971abe45219ce.datapack
- -r--r--r-- 63 ff45add45ab3f59c4f75efc6a087d86c821219d6.datapack
+ -r--r--r-- 63 58e22edd74c967c52f2b1f2373881fbaa98787d3.datapack
+ -r--r--r-- 69 6de3ca4911c2538ef80b21da3f609ef10c13e862.datapack
+ -r--r--r-- 67 cb5646746462dac0bc71c160505bb87bc541e6a7.datapack
+ -r--r--r-- 65 e66a63fa5de1d49193dd019dcac55a0bc0411bad.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 254 077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
- -r--r--r-- 336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
- -r--r--r-- 172 276d308429d0303762befa376788300f0310f90e.histpack
- -r--r--r-- 90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
+ -r--r--r-- 172 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
+ -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack
+ -r--r--r-- 254 8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
+ -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack
For the data packs, setting the limit for the repackmaxpacksize to be 64 such
that data pack with size 65 is more than the limit. This effectively ensures
@@ -335,33 +335,34 @@
$ hg repack --incremental --config remotefilelog.data.repackmaxpacksize=64 \
> --config remotefilelog.history.repackmaxpacksize=0
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
- -r--r--r-- 65 6c499d21350d79f92fd556b4b7a902569d88e3c9.datapack
- -r--r--r-- 61 817d294043bd21a3de01f807721971abe45219ce.datapack
- -r--r--r-- 63 ff45add45ab3f59c4f75efc6a087d86c821219d6.datapack
+ -r--r--r-- 63 58e22edd74c967c52f2b1f2373881fbaa98787d3.datapack
+ -r--r--r-- 69 6de3ca4911c2538ef80b21da3f609ef10c13e862.datapack
+ -r--r--r-- 67 cb5646746462dac0bc71c160505bb87bc541e6a7.datapack
+ -r--r--r-- 65 e66a63fa5de1d49193dd019dcac55a0bc0411bad.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 254 077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
- -r--r--r-- 336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
- -r--r--r-- 172 276d308429d0303762befa376788300f0310f90e.histpack
- -r--r--r-- 90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
+ -r--r--r-- 172 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
+ -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack
+ -r--r--r-- 254 8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
+ -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack
Setting limit for the repackmaxpacksize to be the size of the biggest pack file
which ensures that it is effectively ignored in the incremental repacking.
$ hg repack --incremental --config remotefilelog.data.repackmaxpacksize=65 \
> --config remotefilelog.history.repackmaxpacksize=336
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
- -r--r--r-- 225 8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.datapack
+ -r--r--r-- 63 58e22edd74c967c52f2b1f2373881fbaa98787d3.datapack
+ -r--r--r-- 69 6de3ca4911c2538ef80b21da3f609ef10c13e862.datapack
+ -r--r--r-- 67 cb5646746462dac0bc71c160505bb87bc541e6a7.datapack
+ -r--r--r-- 65 e66a63fa5de1d49193dd019dcac55a0bc0411bad.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
+ -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack
1 gen3 pack, 1 gen0 pack - does nothing
$ hg repack --incremental
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
- -r--r--r-- 225 8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.datapack
+ -r--r--r-- 301 671913bebdb7b95aae52a546662753eac7606e40.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
+ -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack
Pull should run background repack
$ cat >> .hg/hgrc <<EOF
@@ -378,15 +379,15 @@
$ hg prefetch -r 3
1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
- -r--r--r-- 65 6c499d21350d79f92fd556b4b7a902569d88e3c9.datapack
- -r--r--r-- 61 817d294043bd21a3de01f807721971abe45219ce.datapack
- -r--r--r-- 63 ff45add45ab3f59c4f75efc6a087d86c821219d6.datapack
+ -r--r--r-- 63 58e22edd74c967c52f2b1f2373881fbaa98787d3.datapack
+ -r--r--r-- 69 6de3ca4911c2538ef80b21da3f609ef10c13e862.datapack
+ -r--r--r-- 67 cb5646746462dac0bc71c160505bb87bc541e6a7.datapack
+ -r--r--r-- 65 e66a63fa5de1d49193dd019dcac55a0bc0411bad.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 254 077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
- -r--r--r-- 336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
- -r--r--r-- 172 276d308429d0303762befa376788300f0310f90e.histpack
- -r--r--r-- 90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
+ -r--r--r-- 172 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
+ -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack
+ -r--r--r-- 254 8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
+ -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack
$ hg pull
pulling from ssh://user@dummy/master
@@ -396,22 +397,21 @@
$ sleep 0.5
$ hg debugwaitonrepack >/dev/null 2>&1
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
- -r--r--r-- 225 8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.datapack
+ -r--r--r-- 301 671913bebdb7b95aae52a546662753eac7606e40.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
+ -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack
Test environment variable resolution
$ CACHEPATH=$TESTTMP/envcache hg prefetch --config 'remotefilelog.cachepath=$CACHEPATH'
1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
$ find $TESTTMP/envcache | sort
$TESTTMP/envcache
$TESTTMP/envcache/master
$TESTTMP/envcache/master/packs
- $TESTTMP/envcache/master/packs/54afbfda203716c1aa2636029ccc0df18165129e.dataidx
- $TESTTMP/envcache/master/packs/54afbfda203716c1aa2636029ccc0df18165129e.datapack
- $TESTTMP/envcache/master/packs/dcebd8e8d4d97ee88e40dd8f92d8678c10e1a3ad.histidx
- $TESTTMP/envcache/master/packs/dcebd8e8d4d97ee88e40dd8f92d8678c10e1a3ad.histpack
+ $TESTTMP/envcache/master/packs/b295e4905380d54b349c640d13292f6ee52d9405.dataidx
+ $TESTTMP/envcache/master/packs/b295e4905380d54b349c640d13292f6ee52d9405.datapack
+ $TESTTMP/envcache/master/packs/ef5b32f44332771a1556ee47169ff28fdc2ca7e0.histidx
+ $TESTTMP/envcache/master/packs/ef5b32f44332771a1556ee47169ff28fdc2ca7e0.histpack
Test local remotefilelog blob is correct when based on a pack
$ hg prefetch -r .
@@ -434,7 +434,7 @@
Test limiting the max delta chain length
$ hg repack --config packs.maxchainlen=1
$ hg debugdatapack $TESTTMP/hgcache/master/packs/*.dataidx
- $TESTTMP/hgcache/master/packs/a2731c9a16403457b67337a620931797fce8c821:
+ $TESTTMP/hgcache/master/packs/802656378d1b6ebc79b58450e2eccf6e5dbc9b31:
x:
Node Delta Base Delta Length Blob Size
1bb2e6237e03 000000000000 8 8
@@ -452,16 +452,16 @@
Test huge pack cleanup using different values of packs.maxpacksize:
$ hg repack --incremental --debug
$ hg repack --incremental --debug --config packs.maxpacksize=512
- removing oversize packfile $TESTTMP/hgcache/master/packs/a2731c9a16403457b67337a620931797fce8c821.datapack (365 bytes)
- removing oversize packfile $TESTTMP/hgcache/master/packs/a2731c9a16403457b67337a620931797fce8c821.dataidx (1.21 KB)
+ removing oversize packfile $TESTTMP/hgcache/master/packs/802656378d1b6ebc79b58450e2eccf6e5dbc9b31.datapack (365 bytes)
+ removing oversize packfile $TESTTMP/hgcache/master/packs/802656378d1b6ebc79b58450e2eccf6e5dbc9b31.dataidx (1.21 KB)
Do a repack where the new pack reuses a delta from the old pack
$ clearcache
$ hg prefetch -r '2::3'
2 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
$ hg repack
$ hg debugdatapack $CACHEDIR/master/packs/*.datapack
- $TESTTMP/hgcache/master/packs/abf210f6c3aa4dd0ecc7033633ad73591be16c95:
+ $TESTTMP/hgcache/master/packs/90cfb1a45e2549500caace30add04b58a6b243af:
x:
Node Delta Base Delta Length Blob Size
1bb2e6237e03 000000000000 8 8
@@ -472,7 +472,7 @@
2 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
$ hg repack
$ hg debugdatapack $CACHEDIR/master/packs/*.datapack
- $TESTTMP/hgcache/master/packs/09b8bf49256b3fc2175977ba97d6402e91a9a604:
+ $TESTTMP/hgcache/master/packs/671913bebdb7b95aae52a546662753eac7606e40:
x:
Node Delta Base Delta Length Blob Size
1bb2e6237e03 000000000000 8 8
diff --git a/tests/test-remotefilelog-repack-fast.t b/tests/test-remotefilelog-repack-fast.t
--- a/tests/test-remotefilelog-repack-fast.t
+++ b/tests/test-remotefilelog-repack-fast.t
@@ -50,19 +50,19 @@
$TESTTMP/hgcache
$TESTTMP/hgcache/master
$TESTTMP/hgcache/master/packs
- $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histidx
- $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histpack
- $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.dataidx
- $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.datapack
+ $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
+ $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
+ $TESTTMP/hgcache/master/packs/add67cb28ae0a2962111588ce49467ca9ebb9195.dataidx
+ $TESTTMP/hgcache/master/packs/add67cb28ae0a2962111588ce49467ca9ebb9195.datapack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
# Test that the packs are readonly
$ ls_l $CACHEDIR/master/packs
- -r--r--r-- 1145 276d308429d0303762befa376788300f0310f90e.histidx
- -r--r--r-- 172 276d308429d0303762befa376788300f0310f90e.histpack
- -r--r--r-- 1074 8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.dataidx
- -r--r--r-- 69 8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.datapack
+ -r--r--r-- 1145 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
+ -r--r--r-- 172 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
+ -r--r--r-- 1074 add67cb28ae0a2962111588ce49467ca9ebb9195.dataidx
+ -r--r--r-- 69 add67cb28ae0a2962111588ce49467ca9ebb9195.datapack
-rw-r--r-- 0 repacklock
# Test that the data in the new packs is accessible
@@ -83,20 +83,20 @@
$ find $CACHEDIR -type f | sort
$TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
- $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histidx
- $TESTTMP/hgcache/master/packs/276d308429d0303762befa376788300f0310f90e.histpack
- $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.dataidx
- $TESTTMP/hgcache/master/packs/8e25dec685d5e0bb1f1b39df3acebda0e0d75c6e.datapack
+ $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
+ $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
+ $TESTTMP/hgcache/master/packs/add67cb28ae0a2962111588ce49467ca9ebb9195.dataidx
+ $TESTTMP/hgcache/master/packs/add67cb28ae0a2962111588ce49467ca9ebb9195.datapack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
$ hg repack --traceback
$ find $CACHEDIR -type f | sort
- $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histidx
- $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
- $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.dataidx
- $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.datapack
+ $TESTTMP/hgcache/master/packs/1bd27e610ee06450e5f3bb0cd3afb6870e4cf375.dataidx
+ $TESTTMP/hgcache/master/packs/1bd27e610ee06450e5f3bb0cd3afb6870e4cf375.datapack
+ $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx
+ $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
@@ -113,10 +113,10 @@
# and did not change the pack names
$ hg repack
$ find $CACHEDIR -type f | sort
- $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histidx
- $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
- $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.dataidx
- $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.datapack
+ $TESTTMP/hgcache/master/packs/1bd27e610ee06450e5f3bb0cd3afb6870e4cf375.dataidx
+ $TESTTMP/hgcache/master/packs/1bd27e610ee06450e5f3bb0cd3afb6870e4cf375.datapack
+ $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx
+ $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
@@ -137,47 +137,47 @@
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
$ find $CACHEDIR -type f | sort
$TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1bb2e6237e035c8f8ef508e281f1ce075bc6db72
- $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histidx
- $TESTTMP/hgcache/master/packs/077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
- $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.dataidx
- $TESTTMP/hgcache/master/packs/935861cae0be6ce41a0d47a529e4d097e9e68a69.datapack
+ $TESTTMP/hgcache/master/packs/1bd27e610ee06450e5f3bb0cd3afb6870e4cf375.dataidx
+ $TESTTMP/hgcache/master/packs/1bd27e610ee06450e5f3bb0cd3afb6870e4cf375.datapack
+ $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx
+ $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
$ hg repack --background
(running background repack)
$ sleep 0.5
$ hg debugwaitonrepack >/dev/null 2>&1
$ find $CACHEDIR -type f | sort
- $TESTTMP/hgcache/master/packs/094b530486dad4427a0faf6bcbc031571b99ca24.histidx
- $TESTTMP/hgcache/master/packs/094b530486dad4427a0faf6bcbc031571b99ca24.histpack
- $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.dataidx
- $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.datapack
+ $TESTTMP/hgcache/master/packs/06ae46494f0e3b9beda53eae8fc0e55139f13123.dataidx
+ $TESTTMP/hgcache/master/packs/06ae46494f0e3b9beda53eae8fc0e55139f13123.datapack
+ $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histidx
+ $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histpack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
# Test debug commands
$ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack
- $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15:
+ $TESTTMP/hgcache/master/packs/06ae46494f0e3b9beda53eae8fc0e55139f13123:
x:
Node Delta Base Delta Length Blob Size
1bb2e6237e03 000000000000 8 8
d4a3ed9310e5 1bb2e6237e03 12 6
aee31534993a d4a3ed9310e5 12 4
Total: 32 18 (77.8% bigger)
$ hg debugdatapack --long $TESTTMP/hgcache/master/packs/*.datapack
- $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15:
+ $TESTTMP/hgcache/master/packs/06ae46494f0e3b9beda53eae8fc0e55139f13123:
x:
Node Delta Base Delta Length Blob Size
1bb2e6237e035c8f8ef508e281f1ce075bc6db72 0000000000000000000000000000000000000000 8 8
d4a3ed9310e5bd9887e3bf779da5077efab28216 1bb2e6237e035c8f8ef508e281f1ce075bc6db72 12 6
aee31534993a501858fb6dd96a065671922e7d51 d4a3ed9310e5bd9887e3bf779da5077efab28216 12 4
Total: 32 18 (77.8% bigger)
$ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack --node d4a3ed9310e5bd9887e3bf779da5077efab28216
- $TESTTMP/hgcache/master/packs/8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15:
+ $TESTTMP/hgcache/master/packs/06ae46494f0e3b9beda53eae8fc0e55139f13123:
x
Node Delta Base Delta SHA1 Delta Length
@@ -226,10 +226,10 @@
2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over * (glob)
$ hg repack
$ ls $TESTTMP/hgcache/master/packs
- e8fdf7ae22b772dcc291f905b9c6e5f381d28739.dataidx
- e8fdf7ae22b772dcc291f905b9c6e5f381d28739.datapack
- ebbd7411e00456c0eec8d1150a77e2b3ef490f3f.histidx
- ebbd7411e00456c0eec8d1150a77e2b3ef490f3f.histpack
+ 308a7aba9c54a0b71ae5adbbccd00c0aff20876e.dataidx
+ 308a7aba9c54a0b71ae5adbbccd00c0aff20876e.datapack
+ bfd60adb76018bb952e27cd23fc151bf94865d7d.histidx
+ bfd60adb76018bb952e27cd23fc151bf94865d7d.histpack
repacklock
$ hg debughistorypack $TESTTMP/hgcache/master/packs/*.histidx
@@ -259,7 +259,7 @@
$ rm -rf $CACHEDIR/master/packs/*hist*
$ hg repack
$ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack
- $TESTTMP/hgcache/master/packs/a8d86ff8e1a11a77a85f5fea567f56a757583eda:
+ $TESTTMP/hgcache/master/packs/ba4649b56263282b0699f9a6e7e34a4a2bac1638:
x:
Node Delta Base Delta Length Blob Size
1bb2e6237e03 000000000000 8 8
@@ -292,14 +292,14 @@
$ hg prefetch -r 0
1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
+ -r--r--r-- 63 58e22edd74c967c52f2b1f2373881fbaa98787d3.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
+ -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack
$ hg repack --incremental
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
+ -r--r--r-- 63 58e22edd74c967c52f2b1f2373881fbaa98787d3.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
+ -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack
3 gen1 packs, 1 gen0 pack - packs 3 gen1 into 1
$ hg prefetch -r 1
@@ -309,29 +309,27 @@
$ hg prefetch -r 3
1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
- -r--r--r-- 65 6c499d21350d79f92fd556b4b7a902569d88e3c9.datapack
- -r--r--r-- 61 817d294043bd21a3de01f807721971abe45219ce.datapack
- -r--r--r-- 63 ff45add45ab3f59c4f75efc6a087d86c821219d6.datapack
+ -r--r--r-- 63 58e22edd74c967c52f2b1f2373881fbaa98787d3.datapack
+ -r--r--r-- 69 6de3ca4911c2538ef80b21da3f609ef10c13e862.datapack
+ -r--r--r-- 67 cb5646746462dac0bc71c160505bb87bc541e6a7.datapack
+ -r--r--r-- 65 e66a63fa5de1d49193dd019dcac55a0bc0411bad.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 254 077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
- -r--r--r-- 336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
- -r--r--r-- 172 276d308429d0303762befa376788300f0310f90e.histpack
- -r--r--r-- 90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
+ -r--r--r-- 172 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
+ -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack
+ -r--r--r-- 254 8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
+ -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack
$ hg repack --incremental
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
- -r--r--r-- 225 8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.datapack
+ -r--r--r-- 301 671913bebdb7b95aae52a546662753eac7606e40.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
+ -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack
1 gen3 pack, 1 gen0 pack - does nothing
$ hg repack --incremental
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
- -r--r--r-- 225 8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.datapack
+ -r--r--r-- 301 671913bebdb7b95aae52a546662753eac7606e40.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
+ -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack
Pull should run background repack
$ cat >> .hg/hgrc <<EOF
@@ -348,15 +346,15 @@
$ hg prefetch -r 3
1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
- -r--r--r-- 65 6c499d21350d79f92fd556b4b7a902569d88e3c9.datapack
- -r--r--r-- 61 817d294043bd21a3de01f807721971abe45219ce.datapack
- -r--r--r-- 63 ff45add45ab3f59c4f75efc6a087d86c821219d6.datapack
+ -r--r--r-- 63 58e22edd74c967c52f2b1f2373881fbaa98787d3.datapack
+ -r--r--r-- 69 6de3ca4911c2538ef80b21da3f609ef10c13e862.datapack
+ -r--r--r-- 67 cb5646746462dac0bc71c160505bb87bc541e6a7.datapack
+ -r--r--r-- 65 e66a63fa5de1d49193dd019dcac55a0bc0411bad.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 254 077e7ce5dfe862dc40cc8f3c9742d96a056865f2.histpack
- -r--r--r-- 336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
- -r--r--r-- 172 276d308429d0303762befa376788300f0310f90e.histpack
- -r--r--r-- 90 c3399b56e035f73c3295276ed098235a08a0ed8c.histpack
+ -r--r--r-- 172 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
+ -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack
+ -r--r--r-- 254 8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
+ -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack
$ hg pull
pulling from ssh://user@dummy/master
@@ -366,22 +364,21 @@
$ sleep 0.5
$ hg debugwaitonrepack >/dev/null 2>&1
$ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
- -r--r--r-- 59 5b7dec902026f0cddb0ef8acb62f27b5698494d4.datapack
- -r--r--r-- 225 8fe685c56f6f7edf550bfcec74eeecc5f3c2ba15.datapack
+ -r--r--r-- 301 671913bebdb7b95aae52a546662753eac7606e40.datapack
$ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
- -r--r--r-- 336 094b530486dad4427a0faf6bcbc031571b99ca24.histpack
+ -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack
Test environment variable resolution
$ CACHEPATH=$TESTTMP/envcache hg prefetch --config 'remotefilelog.cachepath=$CACHEPATH'
1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
$ find $TESTTMP/envcache | sort
$TESTTMP/envcache
$TESTTMP/envcache/master
$TESTTMP/envcache/master/packs
- $TESTTMP/envcache/master/packs/54afbfda203716c1aa2636029ccc0df18165129e.dataidx
- $TESTTMP/envcache/master/packs/54afbfda203716c1aa2636029ccc0df18165129e.datapack
- $TESTTMP/envcache/master/packs/dcebd8e8d4d97ee88e40dd8f92d8678c10e1a3ad.histidx
- $TESTTMP/envcache/master/packs/dcebd8e8d4d97ee88e40dd8f92d8678c10e1a3ad.histpack
+ $TESTTMP/envcache/master/packs/b295e4905380d54b349c640d13292f6ee52d9405.dataidx
+ $TESTTMP/envcache/master/packs/b295e4905380d54b349c640d13292f6ee52d9405.datapack
+ $TESTTMP/envcache/master/packs/ef5b32f44332771a1556ee47169ff28fdc2ca7e0.histidx
+ $TESTTMP/envcache/master/packs/ef5b32f44332771a1556ee47169ff28fdc2ca7e0.histpack
Test local remotefilelog blob is correct when based on a pack
$ hg prefetch -r .
diff --git a/tests/test-remotefilelog-prefetch.t b/tests/test-remotefilelog-prefetch.t
--- a/tests/test-remotefilelog-prefetch.t
+++ b/tests/test-remotefilelog-prefetch.t
@@ -223,10 +223,10 @@
$ hg prefetch -r .
3 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob)
$ find $TESTTMP/hgcache -type f | sort
- $TESTTMP/hgcache/master/packs/47d8f1b90a73af4ff8af19fcd10bdc027b6a881a.histidx
- $TESTTMP/hgcache/master/packs/47d8f1b90a73af4ff8af19fcd10bdc027b6a881a.histpack
- $TESTTMP/hgcache/master/packs/8c654541e4f20141a894bbfe428e36fc92202e39.dataidx
- $TESTTMP/hgcache/master/packs/8c654541e4f20141a894bbfe428e36fc92202e39.datapack
+ $TESTTMP/hgcache/master/packs/c0f8f1882a04eef6491277fb307763d29b24dfc4.dataidx
+ $TESTTMP/hgcache/master/packs/c0f8f1882a04eef6491277fb307763d29b24dfc4.datapack
+ $TESTTMP/hgcache/master/packs/cad05e385b95197e5a78cce60775efaac97a04a1.histidx
+ $TESTTMP/hgcache/master/packs/cad05e385b95197e5a78cce60775efaac97a04a1.histpack
$ hg cat -r . x
x2
$ hg cat -r . y
diff --git a/tests/test-remotefilelog-gcrepack.t b/tests/test-remotefilelog-gcrepack.t
--- a/tests/test-remotefilelog-gcrepack.t
+++ b/tests/test-remotefilelog-gcrepack.t
@@ -45,13 +45,13 @@
$ hg debugwaitonrepack >/dev/null 2>%1
$ find $CACHEDIR | sort | grep ".datapack\|.histpack"
- $TESTTMP/hgcache/master/packs/9a2ea858fe2967db9b6ea4c0ca238881cae9d6eb.histpack
- $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4.datapack
+ $TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack
+ $TESTTMP/hgcache/master/packs/be1bfed71a51645d8c3b9dc73e234e3a8ff06ac1.datapack
# Ensure that all file versions were prefetched
$ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
- $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4:
+ $TESTTMP/hgcache/master/packs/be1bfed71a51645d8c3b9dc73e234e3a8ff06ac1:
x:
Node Delta Base Delta Length Blob Size
1406e7411862 000000000000 2 2
@@ -78,14 +78,14 @@
$ hg debugwaitonrepack >/dev/null 2>%1
$ find $CACHEDIR | sort | grep ".datapack\|.histpack"
- $TESTTMP/hgcache/master/packs/05baa499c6b07f2bf0ea3d2c8151da1cb86f5e33.datapack
- $TESTTMP/hgcache/master/packs/9a2ea858fe2967db9b6ea4c0ca238881cae9d6eb.histpack
+ $TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack
+ $TESTTMP/hgcache/master/packs/b868298fad9bf477b4e9d9455226c440b0135fe6.datapack
# Ensure that file 'x' was garbage collected. It should be GCed because it is not in the keepset
# and is old (commit date is 0.0 in tests). Ensure that file 'y' is present as it is in the keepset.
$ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
- $TESTTMP/hgcache/master/packs/05baa499c6b07f2bf0ea3d2c8151da1cb86f5e33:
+ $TESTTMP/hgcache/master/packs/b868298fad9bf477b4e9d9455226c440b0135fe6:
y:
Node Delta Base Delta Length Blob Size
50dbc4572b8e 000000000000 3 3
@@ -106,13 +106,13 @@
$ hg debugwaitonrepack >/dev/null 2>%1
$ find $CACHEDIR | sort | grep ".datapack\|.histpack"
- $TESTTMP/hgcache/master/packs/9a2ea858fe2967db9b6ea4c0ca238881cae9d6eb.histpack
- $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4.datapack
+ $TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack
+ $TESTTMP/hgcache/master/packs/be1bfed71a51645d8c3b9dc73e234e3a8ff06ac1.datapack
# Ensure that all file versions were prefetched
$ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
- $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4:
+ $TESTTMP/hgcache/master/packs/be1bfed71a51645d8c3b9dc73e234e3a8ff06ac1:
x:
Node Delta Base Delta Length Blob Size
1406e7411862 000000000000 2 2
@@ -140,13 +140,13 @@
$ hg debugwaitonrepack >/dev/null 2>%1
$ find $CACHEDIR | sort | grep ".datapack\|.histpack"
- $TESTTMP/hgcache/master/packs/9a2ea858fe2967db9b6ea4c0ca238881cae9d6eb.histpack
- $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4.datapack
+ $TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack
+ $TESTTMP/hgcache/master/packs/be1bfed71a51645d8c3b9dc73e234e3a8ff06ac1.datapack
# Ensure that all file versions were prefetched
$ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
- $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4:
+ $TESTTMP/hgcache/master/packs/be1bfed71a51645d8c3b9dc73e234e3a8ff06ac1:
x:
Node Delta Base Delta Length Blob Size
1406e7411862 000000000000 2 2
diff --git a/tests/test-remotefilelog-gc.t b/tests/test-remotefilelog-gc.t
--- a/tests/test-remotefilelog-gc.t
+++ b/tests/test-remotefilelog-gc.t
@@ -90,10 +90,10 @@
# Ensure that loose files are repacked
$ find $CACHEDIR -type f | sort
- $TESTTMP/hgcache/master/packs/8d3499c65d926e4f107cf03c6b0df833222025b4.histidx
- $TESTTMP/hgcache/master/packs/8d3499c65d926e4f107cf03c6b0df833222025b4.histpack
- $TESTTMP/hgcache/master/packs/9c7046f8cad0417c39aa7c03ce13e0ba991306c2.dataidx
- $TESTTMP/hgcache/master/packs/9c7046f8cad0417c39aa7c03ce13e0ba991306c2.datapack
+ $TESTTMP/hgcache/master/packs/173691d550fabb9d33db8da192f1c9bc62dd11a4.dataidx
+ $TESTTMP/hgcache/master/packs/173691d550fabb9d33db8da192f1c9bc62dd11a4.datapack
+ $TESTTMP/hgcache/master/packs/837b83c1ef6485a336eb4421ac5973c0ec130fbb.histidx
+ $TESTTMP/hgcache/master/packs/837b83c1ef6485a336eb4421ac5973c0ec130fbb.histpack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
diff --git a/tests/test-remotefilelog-bgprefetch.t b/tests/test-remotefilelog-bgprefetch.t
--- a/tests/test-remotefilelog-bgprefetch.t
+++ b/tests/test-remotefilelog-bgprefetch.t
@@ -107,10 +107,10 @@
$ sleep 0.5
$ hg debugwaitonrepack >/dev/null 2>%1
$ find $CACHEDIR -type f | sort
- $TESTTMP/hgcache/master/packs/94d53eef9e622533aec1fc6d8053cb086e785d21.histidx
- $TESTTMP/hgcache/master/packs/94d53eef9e622533aec1fc6d8053cb086e785d21.histpack
- $TESTTMP/hgcache/master/packs/f3644bc7773e8289deda7f765138120c838f4e6e.dataidx
- $TESTTMP/hgcache/master/packs/f3644bc7773e8289deda7f765138120c838f4e6e.datapack
+ $TESTTMP/hgcache/master/packs/3616094d229ed39e2593f79c772676d4ec00253a.dataidx
+ $TESTTMP/hgcache/master/packs/3616094d229ed39e2593f79c772676d4ec00253a.datapack
+ $TESTTMP/hgcache/master/packs/6e8633deba6e544e5f8edbd7b996d6e31a2c42ae.histidx
+ $TESTTMP/hgcache/master/packs/6e8633deba6e544e5f8edbd7b996d6e31a2c42ae.histpack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
@@ -143,18 +143,18 @@
$ sleep 1
$ hg debugwaitonrepack >/dev/null 2>%1
$ find $CACHEDIR -type f | sort
- $TESTTMP/hgcache/master/packs/27c52c105a1ddf8c75143a6b279b04c24b1f4bee.histidx
- $TESTTMP/hgcache/master/packs/27c52c105a1ddf8c75143a6b279b04c24b1f4bee.histpack
- $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0.dataidx
- $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0.datapack
+ $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx
+ $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack
+ $TESTTMP/hgcache/master/packs/ac19aff076286bebe3ff108c96c6445a0fe27c46.dataidx
+ $TESTTMP/hgcache/master/packs/ac19aff076286bebe3ff108c96c6445a0fe27c46.datapack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
# Ensure that file 'w' was prefetched - it was not part of the update operation and therefore
# could only be downloaded by the background prefetch
$ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
- $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0:
+ $TESTTMP/hgcache/master/packs/ac19aff076286bebe3ff108c96c6445a0fe27c46:
w:
Node Delta Base Delta Length Blob Size
bb6ccd5dceaa 000000000000 2 2
@@ -195,18 +195,18 @@
$ sleep 1
$ hg debugwaitonrepack >/dev/null 2>%1
$ find $CACHEDIR -type f | sort
- $TESTTMP/hgcache/master/packs/27c52c105a1ddf8c75143a6b279b04c24b1f4bee.histidx
- $TESTTMP/hgcache/master/packs/27c52c105a1ddf8c75143a6b279b04c24b1f4bee.histpack
- $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0.dataidx
- $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0.datapack
+ $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx
+ $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack
+ $TESTTMP/hgcache/master/packs/ac19aff076286bebe3ff108c96c6445a0fe27c46.dataidx
+ $TESTTMP/hgcache/master/packs/ac19aff076286bebe3ff108c96c6445a0fe27c46.datapack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
# Ensure that file 'w' was prefetched - it was not part of the commit operation and therefore
# could only be downloaded by the background prefetch
$ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
- $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0:
+ $TESTTMP/hgcache/master/packs/ac19aff076286bebe3ff108c96c6445a0fe27c46:
w:
Node Delta Base Delta Length Blob Size
bb6ccd5dceaa 000000000000 2 2
@@ -249,7 +249,7 @@
# could only be downloaded by the background prefetch
$ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
- $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0:
+ $TESTTMP/hgcache/master/packs/ac19aff076286bebe3ff108c96c6445a0fe27c46:
w:
Node Delta Base Delta Length Blob Size
bb6ccd5dceaa 000000000000 2 2
@@ -287,16 +287,16 @@
$ hg debugwaitonrepack >/dev/null 2>%1
$ find $CACHEDIR -type f | sort
- $TESTTMP/hgcache/master/packs/27c52c105a1ddf8c75143a6b279b04c24b1f4bee.histidx
- $TESTTMP/hgcache/master/packs/27c52c105a1ddf8c75143a6b279b04c24b1f4bee.histpack
- $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0.dataidx
- $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0.datapack
+ $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx
+ $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack
+ $TESTTMP/hgcache/master/packs/ac19aff076286bebe3ff108c96c6445a0fe27c46.dataidx
+ $TESTTMP/hgcache/master/packs/ac19aff076286bebe3ff108c96c6445a0fe27c46.datapack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
# Ensure that files were prefetched
$ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
- $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0:
+ $TESTTMP/hgcache/master/packs/ac19aff076286bebe3ff108c96c6445a0fe27c46:
w:
Node Delta Base Delta Length Blob Size
bb6ccd5dceaa 000000000000 2 2
@@ -331,16 +331,16 @@
$ hg debugwaitonrepack >/dev/null 2>%1
$ find $CACHEDIR -type f | sort
- $TESTTMP/hgcache/master/packs/27c52c105a1ddf8c75143a6b279b04c24b1f4bee.histidx
- $TESTTMP/hgcache/master/packs/27c52c105a1ddf8c75143a6b279b04c24b1f4bee.histpack
- $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0.dataidx
- $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0.datapack
+ $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx
+ $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack
+ $TESTTMP/hgcache/master/packs/ac19aff076286bebe3ff108c96c6445a0fe27c46.dataidx
+ $TESTTMP/hgcache/master/packs/ac19aff076286bebe3ff108c96c6445a0fe27c46.datapack
$TESTTMP/hgcache/master/packs/repacklock
$TESTTMP/hgcache/repos
# Ensure that files were prefetched
$ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
- $TESTTMP/hgcache/master/packs/8299d5a1030f073f4adbb3b6bd2ad3bdcc276df0:
+ $TESTTMP/hgcache/master/packs/ac19aff076286bebe3ff108c96c6445a0fe27c46:
w:
Node Delta Base Delta Length Blob Size
bb6ccd5dceaa 000000000000 2 2
diff --git a/hgext/remotefilelog/repack.py b/hgext/remotefilelog/repack.py
--- a/hgext/remotefilelog/repack.py
+++ b/hgext/remotefilelog/repack.py
@@ -345,10 +345,7 @@
packer = repacker(repo, data, history, fullhistory, category,
gc=garbagecollect, isold=isold, options=options)
- # internal config: remotefilelog.datapackversion
- dv = repo.ui.configint('remotefilelog', 'datapackversion', 0)
-
- with datapack.mutabledatapack(repo.ui, packpath, version=dv) as dpack:
+ with datapack.mutabledatapack(repo.ui, packpath, version=2) as dpack:
with historypack.mutablehistorypack(repo.ui, packpath) as hpack:
try:
packer.run(dpack, hpack)
diff --git a/hgext/remotefilelog/historypack.py b/hgext/remotefilelog/historypack.py
--- a/hgext/remotefilelog/historypack.py
+++ b/hgext/remotefilelog/historypack.py
@@ -84,17 +84,12 @@
INDEXSUFFIX = INDEXSUFFIX
PACKSUFFIX = PACKSUFFIX
- SUPPORTED_VERSIONS = [0, 1]
+ SUPPORTED_VERSIONS = [2]
def __init__(self, path):
super(historypack, self).__init__(path)
-
- if self.VERSION == 0:
- self.INDEXFORMAT = INDEXFORMAT0
- self.INDEXENTRYLENGTH = INDEXENTRYLENGTH0
- else:
- self.INDEXFORMAT = INDEXFORMAT1
- self.INDEXENTRYLENGTH = INDEXENTRYLENGTH1
+ self.INDEXFORMAT = INDEXFORMAT1
+ self.INDEXENTRYLENGTH = INDEXENTRYLENGTH1
def getmissing(self, keys):
missing = []
@@ -215,22 +210,17 @@
raise KeyError(name)
rawentry = struct.unpack(self.INDEXFORMAT, entry)
- if self.VERSION == 0:
- x, offset, size = rawentry
- nodeindexoffset = None
- nodeindexsize = None
- else:
- x, offset, size, nodeindexoffset, nodeindexsize = rawentry
- rawnamelen = self._index[nodeindexoffset:nodeindexoffset +
- constants.FILENAMESIZE]
- actualnamelen = struct.unpack('!H', rawnamelen)[0]
- nodeindexoffset += constants.FILENAMESIZE
- actualname = self._index[nodeindexoffset:nodeindexoffset +
- actualnamelen]
- if actualname != name:
- raise KeyError("found file name %s when looking for %s" %
- (actualname, name))
- nodeindexoffset += actualnamelen
+ x, offset, size, nodeindexoffset, nodeindexsize = rawentry
+ rawnamelen = self._index[nodeindexoffset:nodeindexoffset +
+ constants.FILENAMESIZE]
+ actualnamelen = struct.unpack('!H', rawnamelen)[0]
+ nodeindexoffset += constants.FILENAMESIZE
+ actualname = self._index[nodeindexoffset:nodeindexoffset +
+ actualnamelen]
+ if actualname != name:
+ raise KeyError("found file name %s when looking for %s" %
+ (actualname, name))
+ nodeindexoffset += actualnamelen
filenamelength = struct.unpack('!H', self._data[offset:offset +
constants.FILENAMESIZE])[0]
@@ -406,24 +396,16 @@
INDEXSUFFIX = INDEXSUFFIX
PACKSUFFIX = PACKSUFFIX
- SUPPORTED_VERSIONS = [0, 1]
+ SUPPORTED_VERSIONS = [2]
- def __init__(self, ui, packpath, version=0):
- # internal config: remotefilelog.historypackv1
- if version == 0 and ui.configbool('remotefilelog', 'historypackv1'):
- version = 1
-
+ def __init__(self, ui, packpath, version=2):
super(mutablehistorypack, self).__init__(ui, packpath, version=version)
self.files = {}
self.entrylocations = {}
self.fileentries = {}
- if version == 0:
- self.INDEXFORMAT = INDEXFORMAT0
- self.INDEXENTRYLENGTH = INDEXENTRYLENGTH0
- else:
- self.INDEXFORMAT = INDEXFORMAT1
- self.INDEXENTRYLENGTH = INDEXENTRYLENGTH1
+ self.INDEXFORMAT = INDEXFORMAT1
+ self.INDEXENTRYLENGTH = INDEXENTRYLENGTH1
self.NODEINDEXFORMAT = NODEINDEXFORMAT
self.NODEINDEXENTRYLENGTH = NODEINDEXENTRYLENGTH
@@ -499,7 +481,6 @@
fileindexlength = self.INDEXENTRYLENGTH
nodeindexformat = self.NODEINDEXFORMAT
nodeindexlength = self.NODEINDEXENTRYLENGTH
- version = self.VERSION
files = ((hashlib.sha1(filename).digest(), filename, offset, size)
for filename, (offset, size) in self.files.iteritems())
@@ -515,31 +496,27 @@
nodecount = 0
for namehash, filename, offset, size in files:
# File section index
- if version == 0:
- rawentry = struct.pack(fileindexformat, namehash, offset, size)
- else:
- nodelocations = self.entrylocations[filename]
+ nodelocations = self.entrylocations[filename]
- nodeindexsize = len(nodelocations) * nodeindexlength
+ nodeindexsize = len(nodelocations) * nodeindexlength
- rawentry = struct.pack(fileindexformat, namehash, offset, size,
- nodeindexoffset, nodeindexsize)
- # Node index
- nodeindexentries.append(struct.pack(constants.FILENAMESTRUCT,
- len(filename)) + filename)
- nodeindexoffset += constants.FILENAMESIZE + len(filename)
+ rawentry = struct.pack(fileindexformat, namehash, offset, size,
+ nodeindexoffset, nodeindexsize)
+ # Node index
+ nodeindexentries.append(struct.pack(constants.FILENAMESTRUCT,
+ len(filename)) + filename)
+ nodeindexoffset += constants.FILENAMESIZE + len(filename)
- for node, location in sorted(nodelocations.iteritems()):
- nodeindexentries.append(struct.pack(nodeindexformat, node,
- location))
- nodecount += 1
+ for node, location in sorted(nodelocations.iteritems()):
+ nodeindexentries.append(struct.pack(nodeindexformat, node,
+ location))
+ nodecount += 1
- nodeindexoffset += len(nodelocations) * nodeindexlength
+ nodeindexoffset += len(nodelocations) * nodeindexlength
fileindexentries.append(rawentry)
nodecountraw = ''
- if version == 1:
- nodecountraw = struct.pack('!Q', nodecount)
+ nodecountraw = struct.pack('!Q', nodecount)
return (''.join(fileindexentries) + nodecountraw +
''.join(nodeindexentries))
diff --git a/hgext/remotefilelog/datapack.py b/hgext/remotefilelog/datapack.py
--- a/hgext/remotefilelog/datapack.py
+++ b/hgext/remotefilelog/datapack.py
@@ -5,7 +5,6 @@
from mercurial.node import hex, nullid
from mercurial.i18n import _
from mercurial import (
- error,
pycompat,
util,
)
@@ -95,7 +94,7 @@
INDEXFORMAT = '!20siQQ'
INDEXENTRYLENGTH = 40
- SUPPORTED_VERSIONS = [0, 1]
+ SUPPORTED_VERSIONS = [2]
def getmissing(self, keys):
missing = []
@@ -115,10 +114,6 @@
if value is None:
raise KeyError((name, hex(node)))
- # version 0 does not support metadata
- if self.VERSION == 0:
- return {}
-
node, deltabaseoffset, offset, size = value
rawentry = self._data[offset:offset + size]
@@ -203,14 +198,11 @@
delta = lz4wrapper.lz4decompress(delta)
if getmeta:
- if self.VERSION == 0:
- meta = {}
- else:
- metastart = deltastart + 8 + deltalen
- metalen = struct.unpack_from('!I', rawentry, metastart)[0]
+ metastart = deltastart + 8 + deltalen
+ metalen = struct.unpack_from('!I', rawentry, metastart)[0]
- rawmeta = rawentry[metastart + 4:metastart + 4 + metalen]
- meta = shallowutil.parsepackmeta(rawmeta)
+ rawmeta = rawentry[metastart + 4:metastart + 4 + metalen]
+ meta = shallowutil.parsepackmeta(rawmeta)
return filename, node, deltabasenode, delta, meta
else:
return filename, node, deltabasenode, delta
@@ -316,10 +308,9 @@
uncompressedlen = struct.unpack('<I', data[offset:offset + 4])[0]
offset += deltalen
- if self.VERSION == 1:
- # <4 byte len> + <metadata-list>
- metalen = struct.unpack_from('!I', data, offset)[0]
- offset += 4 + metalen
+ # <4 byte len> + <metadata-list>
+ metalen = struct.unpack_from('!I', data, offset)[0]
+ offset += 4 + metalen
yield (filename, node, deltabase, uncompressedlen)
@@ -406,7 +397,7 @@
INDEXENTRYLENGTH = datapack.INDEXENTRYLENGTH
# v1 has metadata support
- SUPPORTED_VERSIONS = [0, 1]
+ SUPPORTED_VERSIONS = [2]
def add(self, name, node, deltabasenode, delta, metadata=None):
# metadata is a dict, ex. {METAKEYFLAG: flag}
@@ -431,15 +422,10 @@
delta,
))
- if self.VERSION == 1:
- # v1 support metadata
- rawmeta = shallowutil.buildpackmeta(metadata)
- rawdata += struct.pack('!I', len(rawmeta)) # unsigned 4 byte
- rawdata += rawmeta
- else:
- # v0 cannot store metadata, raise if metadata contains flag
- if metadata and metadata.get(constants.METAKEYFLAG, 0) != 0:
- raise error.ProgrammingError('v0 pack cannot store flags')
+ # v1 support metadata
+ rawmeta = shallowutil.buildpackmeta(metadata)
+ rawdata += struct.pack('!I', len(rawmeta)) # unsigned 4 byte
+ rawdata += rawmeta
offset = self.packfp.tell()
diff --git a/hgext/remotefilelog/basepack.py b/hgext/remotefilelog/basepack.py
--- a/hgext/remotefilelog/basepack.py
+++ b/hgext/remotefilelog/basepack.py
@@ -260,7 +260,7 @@
class versionmixin(object):
# Mix-in for classes with multiple supported versions
VERSION = None
- SUPPORTED_VERSIONS = [0]
+ SUPPORTED_VERSIONS = [2]
def _checkversion(self, version):
if version in self.SUPPORTED_VERSIONS:
@@ -277,7 +277,7 @@
# pages can be released (100MB)
MAXPAGEDIN = 100 * 1024**2
- SUPPORTED_VERSIONS = [0]
+ SUPPORTED_VERSIONS = [2]
def __init__(self, path):
self.path = path
@@ -315,12 +315,9 @@
@util.propertycache
def _indexend(self):
- if self.VERSION == 0:
- return self.indexsize
- else:
- nodecount = struct.unpack_from('!Q', self._index,
- self.params.indexstart - 8)[0]
- return self.params.indexstart + nodecount * self.INDEXENTRYLENGTH
+ nodecount = struct.unpack_from('!Q', self._index,
+ self.params.indexstart - 8)[0]
+ return self.params.indexstart + nodecount * self.INDEXENTRYLENGTH
def freememory(self):
"""Unmap and remap the memory to free it up after known expensive
@@ -361,9 +358,10 @@
class mutablebasepack(versionmixin):
- def __init__(self, ui, packdir, version=0):
+ def __init__(self, ui, packdir, version=2):
self._checkversion(version)
-
+ # TODO(augie): make this configurable
+ self._compressor = 'GZ'
opener = vfsmod.vfs(packdir)
opener.createmode = 0o444
self.opener = opener
@@ -496,8 +494,7 @@
self._writeheader(params)
self.idxfp.write(rawfanouttable)
- if self.VERSION == 1:
- self.idxfp.write(rawentrieslength)
+ self.idxfp.write(rawentrieslength)
self.idxfp.write(rawindex)
self.idxfp.close()
@@ -538,6 +535,5 @@
self.fanoutsize = self.fanoutcount * 4
self.indexstart = FANOUTSTART + self.fanoutsize
- if version == 1:
- # Skip the index length
- self.indexstart += 8
+ # Skip the index length
+ self.indexstart += 8
To: durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list