##// END OF EJS Templates
revlog: fix index computation during inline->non-inline transition...
Joerg Sonnenberger -
r48064:21ed126b default
parent child Browse files
Show More
@@ -0,0 +1,5 b''
1 import os
2
3
4 def killme(ui, repo, hooktype, **wkargs):
5 os._exit(80)
@@ -0,0 +1,35 b''
1 Test correctness of revlog inline -> non-inline transition
2 ----------------------------------------------------------
3
4 Test offset computation to correctly factor in the index entries themselve.
5 Test repo has one small, one moderate and one big change. The clone has
6 the small and moderate change and will transition to non-inline storage when
7 adding the big change.
8
9 $ hg init troffset-computation --config format.revlog-compression=none
10 $ cd troffset-computation
11 $ printf '% 20d' '1' > file
12 $ hg commit -Aqm_
13 $ printf '% 1024d' '1' > file
14 $ hg commit -Aqm_
15 $ dd if=/dev/zero of=file bs=1k count=128 > /dev/null 2>&1
16 $ hg commit -Aqm_
17 $ cd ..
18
19 $ hg clone -r 1 troffset-computation troffset-computation-copy --config format.revlog-compression=none -q
20 $ cd troffset-computation-copy
21 $ cat > .hg/hgrc <<EOF
22 > [hooks]
23 > pretxnchangegroup = python:$TESTDIR/helper-killhook.py:killme
24 > EOF
25 #if chg
26 $ hg pull ../troffset-computation
27 pulling from ../troffset-computation
28 [255]
29 #else
30 $ hg pull ../troffset-computation
31 pulling from ../troffset-computation
32 [80]
33 #endif
34 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file | tail -1
35 data/file.i 128
@@ -2174,7 +2174,7 b' class revlog(object):'
2174 2174 with self._indexfp() as read_ifh:
2175 2175 for r in self:
2176 2176 new_dfh.write(self._getsegmentforrevs(r, r, df=read_ifh)[1])
2177 if troffset <= self.start(r):
2177 if troffset <= self.start(r) + r * self.index.entry_size:
2178 2178 trindex = r
2179 2179 new_dfh.flush()
2180 2180
General Comments 0
You need to be logged in to leave comments. Login now