| 1 |
This test cover a bug that no longer exist. |
| 2 |
|
| 3 |
Define helpers. |
| 4 |
|
| 5 |
$ hg_log () { hg log -G -T "{rev}:{node|short}"; } |
| 6 |
$ commit () { echo "foo - ${2:-$1}" > $1; hg commit -Aqm "Edited $1"; } |
| 7 |
$ strip() { hg --config extensions.strip= strip -q -r "$1" ; } |
| 8 |
|
| 9 |
Setup hg repo. |
| 10 |
|
| 11 |
$ hg init repo |
| 12 |
$ cd repo |
| 13 |
$ touch x; hg add x; hg commit -m "initial" |
| 14 |
$ hg clone -q . ../clone |
| 15 |
$ commit a |
| 16 |
|
| 17 |
$ cd ../clone |
| 18 |
|
| 19 |
$ commit b |
| 20 |
|
| 21 |
$ hg pull -q ../repo |
| 22 |
|
| 23 |
$ ls -1 .hg/cache/branch?* |
| 24 |
.hg/cache/branch2-base |
| 25 |
.hg/cache/branch2-served |
| 26 |
$ cat .hg/cache/branch?-served |
| 27 |
222ae9789a75703f9836e44de7db179cbfd420ee 2 |
| 28 |
a3498d6e39376d2456425dd8c692367bdbf00fa2 o default |
| 29 |
222ae9789a75703f9836e44de7db179cbfd420ee o default |
| 30 |
|
| 31 |
$ hg_log |
| 32 |
o 2:222ae9789a75 |
| 33 |
| |
| 34 |
| @ 1:a3498d6e3937 |
| 35 |
|/ |
| 36 |
o 0:7ab0a3bd758a |
| 37 |
|
| 38 |
|
| 39 |
$ strip '1:' |
| 40 |
|
| 41 |
After the strip the "served" cache is now identical to the "base" one, and the |
| 42 |
older one have been actively deleted. |
| 43 |
|
| 44 |
$ ls -1 .hg/cache/branch?* |
| 45 |
.hg/cache/branch2-base |
| 46 |
$ cat .hg/cache/branch?-base |
| 47 |
7ab0a3bd758a58b9f79557ce708533e627776cce 0 |
| 48 |
7ab0a3bd758a58b9f79557ce708533e627776cce o default |
| 49 |
|
| 50 |
We do a new commit and we get a new valid branchmap for the served version |
| 51 |
|
| 52 |
$ commit c |
| 53 |
$ ls -1 .hg/cache/branch?* |
| 54 |
.hg/cache/branch2-base |
| 55 |
.hg/cache/branch2-served |
| 56 |
$ cat .hg/cache/branch?-served |
| 57 |
a1602b357cfca067600406eb19060c7128804d72 1 |
| 58 |
a1602b357cfca067600406eb19060c7128804d72 o default |
| 59 |
|
| 60 |
|
| 61 |
On pull we end up with the same tip, and so wrongly reuse the invalid cache and crash. |
| 62 |
|
| 63 |
$ hg pull ../repo --quiet |
| 64 |
$ hg heads -T '{rev} {node} {branch}\n' |
| 65 |
2 222ae9789a75703f9836e44de7db179cbfd420ee default |
| 66 |
1 a1602b357cfca067600406eb19060c7128804d72 default |
| 67 |
$ ls -1 .hg/cache/branch?* |
| 68 |
.hg/cache/branch2-base |
| 69 |
.hg/cache/branch2-served |
| 70 |
$ cat .hg/cache/branch?-served |
| 71 |
222ae9789a75703f9836e44de7db179cbfd420ee 2 |
| 72 |
a1602b357cfca067600406eb19060c7128804d72 o default |
| 73 |
222ae9789a75703f9836e44de7db179cbfd420ee o default |