| 1 |
test stripping of filelogs where the linkrev doesn't always increase |
| 2 |
|
| 3 |
$ echo '[extensions]' >> $HGRCPATH |
| 4 |
$ echo 'strip =' >> $HGRCPATH |
| 5 |
$ commit() |
| 6 |
> { |
| 7 |
> hg up -qC null |
| 8 |
> count=1 |
| 9 |
> for i in "$@"; do |
| 10 |
> for f in $i; do |
| 11 |
> mkdir -p `dirname $f` |
| 12 |
> echo $count > $f |
| 13 |
> done |
| 14 |
> count=`expr $count + 1` |
| 15 |
> done |
| 16 |
> hg commit -qAm "$*" |
| 17 |
> } |
| 18 |
|
| 19 |
2 1 0 2 0 1 2 |
| 20 |
|
| 21 |
$ mkdir files |
| 22 |
$ cd files |
| 23 |
$ hg init orig |
| 24 |
$ cd orig |
| 25 |
$ commit '201 210' |
| 26 |
$ commit '102 120' '210' |
| 27 |
$ commit '021' |
| 28 |
$ commit '201' '021 120' |
| 29 |
$ commit '012 021' '102 201' '120 210' |
| 30 |
$ commit '102 120' '012 210' '021 201' |
| 31 |
$ commit '201 210' '021 120' '012 102' |
| 32 |
$ cd .. |
| 33 |
$ hg clone -q -U -r 4 -r 5 -r 6 orig crossed |
| 34 |
$ cd crossed |
| 35 |
|
| 36 |
$ for i in 012 021 102 120 201 210; do |
| 37 |
> echo $i |
| 38 |
> hg debugindex $i |
| 39 |
> echo |
| 40 |
> done |
| 41 |
012 |
| 42 |
rev linkrev nodeid p1-nodeid p2-nodeid |
| 43 |
0 0 b8e02f643373 000000000000 000000000000 |
| 44 |
1 1 5d9299349fc0 000000000000 000000000000 |
| 45 |
2 2 2661d26c6496 000000000000 000000000000 |
| 46 |
|
| 47 |
021 |
| 48 |
rev linkrev nodeid p1-nodeid p2-nodeid |
| 49 |
0 0 b8e02f643373 000000000000 000000000000 |
| 50 |
1 2 5d9299349fc0 000000000000 000000000000 |
| 51 |
2 1 2661d26c6496 000000000000 000000000000 |
| 52 |
|
| 53 |
102 |
| 54 |
rev linkrev nodeid p1-nodeid p2-nodeid |
| 55 |
0 1 b8e02f643373 000000000000 000000000000 |
| 56 |
1 0 5d9299349fc0 000000000000 000000000000 |
| 57 |
2 2 2661d26c6496 000000000000 000000000000 |
| 58 |
|
| 59 |
120 |
| 60 |
rev linkrev nodeid p1-nodeid p2-nodeid |
| 61 |
0 1 b8e02f643373 000000000000 000000000000 |
| 62 |
1 2 5d9299349fc0 000000000000 000000000000 |
| 63 |
2 0 2661d26c6496 000000000000 000000000000 |
| 64 |
|
| 65 |
201 |
| 66 |
rev linkrev nodeid p1-nodeid p2-nodeid |
| 67 |
0 2 b8e02f643373 000000000000 000000000000 |
| 68 |
1 0 5d9299349fc0 000000000000 000000000000 |
| 69 |
2 1 2661d26c6496 000000000000 000000000000 |
| 70 |
|
| 71 |
210 |
| 72 |
rev linkrev nodeid p1-nodeid p2-nodeid |
| 73 |
0 2 b8e02f643373 000000000000 000000000000 |
| 74 |
1 1 5d9299349fc0 000000000000 000000000000 |
| 75 |
2 0 2661d26c6496 000000000000 000000000000 |
| 76 |
|
| 77 |
$ cd .. |
| 78 |
$ for i in 0 1 2; do |
| 79 |
> hg clone -q -U --pull crossed $i |
| 80 |
> echo "% Trying to strip revision $i" |
| 81 |
> hg --cwd $i strip $i |
| 82 |
> echo "% Verifying" |
| 83 |
> hg --cwd $i verify -q |
| 84 |
> echo |
| 85 |
> done |
| 86 |
% Trying to strip revision 0 |
| 87 |
saved backup bundle to $TESTTMP/files/0/.hg/strip-backup/cbb8c2f0a2e3-239800b9-backup.hg |
| 88 |
% Verifying |
| 89 |
|
| 90 |
% Trying to strip revision 1 |
| 91 |
saved backup bundle to $TESTTMP/files/1/.hg/strip-backup/124ecc0cbec9-6104543f-backup.hg |
| 92 |
% Verifying |
| 93 |
|
| 94 |
% Trying to strip revision 2 |
| 95 |
saved backup bundle to $TESTTMP/files/2/.hg/strip-backup/f6439b304a1a-c6505a5f-backup.hg |
| 96 |
% Verifying |
| 97 |
|
| 98 |
$ cd .. |
| 99 |
|
| 100 |
Do a similar test where the manifest revlog has unordered linkrevs |
| 101 |
$ mkdir manifests |
| 102 |
$ cd manifests |
| 103 |
$ hg init orig |
| 104 |
$ cd orig |
| 105 |
$ commit 'file' |
| 106 |
$ commit 'other' |
| 107 |
$ commit '' 'other' |
| 108 |
$ HGUSER=another-user; export HGUSER |
| 109 |
$ commit 'file' |
| 110 |
$ commit 'other' 'file' |
| 111 |
$ cd .. |
| 112 |
$ hg clone -q -U -r 1 -r 2 -r 3 -r 4 orig crossed |
| 113 |
$ cd crossed |
| 114 |
$ hg debugindex --manifest |
| 115 |
rev linkrev nodeid p1-nodeid p2-nodeid |
| 116 |
0 2 6bbc6fee55c2 000000000000 000000000000 |
| 117 |
1 0 1c556153fe54 000000000000 000000000000 |
| 118 |
2 1 1f76dba919fd 000000000000 000000000000 |
| 119 |
3 3 bbee06ad59d5 000000000000 000000000000 |
| 120 |
|
| 121 |
$ cd .. |
| 122 |
$ for i in 2 3; do |
| 123 |
> hg clone -q -U --pull crossed $i |
| 124 |
> echo "% Trying to strip revision $i" |
| 125 |
> hg --cwd $i strip $i |
| 126 |
> echo "% Verifying" |
| 127 |
> hg --cwd $i verify -q |
| 128 |
> echo |
| 129 |
> done |
| 130 |
% Trying to strip revision 2 |
| 131 |
saved backup bundle to $TESTTMP/manifests/2/.hg/strip-backup/f3015ad03c03-4d98bdc2-backup.hg |
| 132 |
% Verifying |
| 133 |
|
| 134 |
% Trying to strip revision 3 |
| 135 |
saved backup bundle to $TESTTMP/manifests/3/.hg/strip-backup/9632aa303aa4-69192e3f-backup.hg |
| 136 |
% Verifying |
| 137 |
|
| 138 |
$ cd .. |
| 139 |
|
| 140 |
Now a similar test for a non-root manifest revlog |
| 141 |
$ cat >> $HGRCPATH <<EOF |
| 142 |
> [experimental] |
| 143 |
> treemanifests = yes |
| 144 |
> EOF |
| 145 |
$ mkdir treemanifests |
| 146 |
$ cd treemanifests |
| 147 |
$ |
| 148 |
$ hg --config experimental.treemanifest=True init orig |
| 149 |
$ cd orig |
| 150 |
$ commit 'dir/file' |
| 151 |
$ commit 'dir/other' |
| 152 |
$ commit '' 'dir/other' |
| 153 |
$ HGUSER=yet-another-user; export HGUSER |
| 154 |
$ commit 'otherdir dir/file' |
| 155 |
$ commit 'otherdir dir/other' 'otherdir dir/file' |
| 156 |
$ cd .. |
| 157 |
$ hg --config experimental.treemanifest=True clone -q -U -r 1 -r 2 -r 3 -r 4 orig crossed |
| 158 |
$ cd crossed |
| 159 |
$ hg debugindex --dir dir |
| 160 |
rev linkrev nodeid p1-nodeid p2-nodeid |
| 161 |
0 2 6bbc6fee55c2 000000000000 000000000000 |
| 162 |
1 0 1c556153fe54 000000000000 000000000000 |
| 163 |
2 1 1f76dba919fd 000000000000 000000000000 |
| 164 |
3 3 bbee06ad59d5 000000000000 000000000000 |
| 165 |
|
| 166 |
$ cd .. |
| 167 |
$ for i in 2 3; do |
| 168 |
> hg --config experimental.treemanifest=True clone -q -U --pull crossed $i |
| 169 |
> echo "% Trying to strip revision $i" |
| 170 |
> hg --cwd $i strip $i |
| 171 |
> echo "% Verifying" |
| 172 |
> hg --cwd $i verify -q |
| 173 |
> echo |
| 174 |
> done |
| 175 |
% Trying to strip revision 2 |
| 176 |
saved backup bundle to $TESTTMP/treemanifests/2/.hg/strip-backup/145f5c75f9ac-a105cfbe-backup.hg |
| 177 |
% Verifying |
| 178 |
|
| 179 |
% Trying to strip revision 3 |
| 180 |
saved backup bundle to $TESTTMP/treemanifests/3/.hg/strip-backup/e4e3de5c3cb2-f4c70376-backup.hg |
| 181 |
% Verifying |
| 182 |
|
| 183 |
|
| 184 |
$ cd .. |