| 1 |
Test for the full copytracing algorithm |
| 2 |
======================================= |
| 3 |
|
| 4 |
|
| 5 |
Initial Setup |
| 6 |
============= |
| 7 |
|
| 8 |
use git diff to see rename |
| 9 |
|
| 10 |
$ cat << EOF >> $HGRCPATH |
| 11 |
> [diff] |
| 12 |
> git=yes |
| 13 |
> EOF |
| 14 |
|
| 15 |
Setup an history where one side copy and rename a file (and update it) while the other side update it. |
| 16 |
|
| 17 |
$ hg init t |
| 18 |
$ cd t |
| 19 |
|
| 20 |
$ echo 1 > a |
| 21 |
$ hg ci -qAm "first" |
| 22 |
|
| 23 |
$ hg cp a b |
| 24 |
$ hg mv a c |
| 25 |
$ echo 2 >> b |
| 26 |
$ echo 2 >> c |
| 27 |
|
| 28 |
$ hg ci -qAm "second" |
| 29 |
|
| 30 |
$ hg co -C 0 |
| 31 |
1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
| 32 |
|
| 33 |
$ echo 0 > a |
| 34 |
$ echo 1 >> a |
| 35 |
|
| 36 |
$ hg ci -qAm "other" |
| 37 |
|
| 38 |
$ hg log -G --patch |
| 39 |
@ changeset: 2:add3f11052fa |
| 40 |
| tag: tip |
| 41 |
| parent: 0:b8bf91eeebbc |
| 42 |
| user: test |
| 43 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 44 |
| summary: other |
| 45 |
| |
| 46 |
| diff --git a/a b/a |
| 47 |
| --- a/a |
| 48 |
| +++ b/a |
| 49 |
| @@ -1,1 +1,2 @@ |
| 50 |
| +0 |
| 51 |
| 1 |
| 52 |
| |
| 53 |
| o changeset: 1:17c05bb7fcb6 |
| 54 |
|/ user: test |
| 55 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 56 |
| summary: second |
| 57 |
| |
| 58 |
| diff --git a/a b/b |
| 59 |
| rename from a |
| 60 |
| rename to b |
| 61 |
| --- a/a |
| 62 |
| +++ b/b |
| 63 |
| @@ -1,1 +1,2 @@ |
| 64 |
| 1 |
| 65 |
| +2 |
| 66 |
| diff --git a/a b/c |
| 67 |
| copy from a |
| 68 |
| copy to c |
| 69 |
| --- a/a |
| 70 |
| +++ b/c |
| 71 |
| @@ -1,1 +1,2 @@ |
| 72 |
| 1 |
| 73 |
| +2 |
| 74 |
| |
| 75 |
o changeset: 0:b8bf91eeebbc |
| 76 |
user: test |
| 77 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 78 |
summary: first |
| 79 |
|
| 80 |
diff --git a/a b/a |
| 81 |
new file mode 100644 |
| 82 |
--- /dev/null |
| 83 |
+++ b/a |
| 84 |
@@ -0,0 +1,1 @@ |
| 85 |
+1 |
| 86 |
|
| 87 |
|
| 88 |
Test Simple Merge |
| 89 |
================= |
| 90 |
|
| 91 |
$ hg merge --debug |
| 92 |
unmatched files in other: |
| 93 |
b |
| 94 |
c |
| 95 |
all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
| 96 |
on remote side: |
| 97 |
src: 'a' -> dst: 'b' * |
| 98 |
src: 'a' -> dst: 'c' * |
| 99 |
checking for directory renames |
| 100 |
resolving manifests |
| 101 |
branchmerge: True, force: False, partial: False |
| 102 |
ancestor: b8bf91eeebbc, local: add3f11052fa+, remote: 17c05bb7fcb6 |
| 103 |
starting 4 threads for background file closing (?) |
| 104 |
preserving a for resolve of b |
| 105 |
preserving a for resolve of c |
| 106 |
removing a |
| 107 |
b: remote moved from a -> m |
| 108 |
picked tool ':merge' for b (binary False symlink False changedelete False) |
| 109 |
merging a and b to b |
| 110 |
my b@add3f11052fa+ other b@17c05bb7fcb6 ancestor a@b8bf91eeebbc |
| 111 |
premerge successful |
| 112 |
c: remote moved from a -> m |
| 113 |
picked tool ':merge' for c (binary False symlink False changedelete False) |
| 114 |
merging a and c to c |
| 115 |
my c@add3f11052fa+ other c@17c05bb7fcb6 ancestor a@b8bf91eeebbc |
| 116 |
premerge successful |
| 117 |
0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
| 118 |
(branch merge, don't forget to commit) |
| 119 |
|
| 120 |
file b |
| 121 |
$ cat b |
| 122 |
0 |
| 123 |
1 |
| 124 |
2 |
| 125 |
|
| 126 |
file c |
| 127 |
$ cat c |
| 128 |
0 |
| 129 |
1 |
| 130 |
2 |
| 131 |
|
| 132 |
Test disabling copy tracing |
| 133 |
=========================== |
| 134 |
|
| 135 |
first verify copy metadata was kept |
| 136 |
----------------------------------- |
| 137 |
|
| 138 |
$ hg up -qC 2 |
| 139 |
$ hg rebase --keep -d 1 -b 2 --config extensions.rebase= |
| 140 |
rebasing 2:add3f11052fa tip "other" |
| 141 |
merging b and a to b |
| 142 |
merging c and a to c |
| 143 |
|
| 144 |
$ cat b |
| 145 |
0 |
| 146 |
1 |
| 147 |
2 |
| 148 |
|
| 149 |
next verify copy metadata is lost when disabled |
| 150 |
------------------------------------------------ |
| 151 |
|
| 152 |
$ hg strip -r . --config extensions.strip= |
| 153 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 154 |
saved backup bundle to $TESTTMP/t/.hg/strip-backup/550bd84c0cd3-fc575957-backup.hg |
| 155 |
$ hg up -qC 2 |
| 156 |
$ hg rebase --keep -d 1 -b 2 --config extensions.rebase= --config experimental.copytrace=off --config ui.interactive=True << EOF |
| 157 |
> c |
| 158 |
> EOF |
| 159 |
rebasing 2:add3f11052fa tip "other" |
| 160 |
file 'a' was deleted in local [dest] but was modified in other [source]. |
| 161 |
You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved. |
| 162 |
What do you want to do? c |
| 163 |
|
| 164 |
$ cat b |
| 165 |
1 |
| 166 |
2 |
| 167 |
|
| 168 |
$ cd .. |
| 169 |
|
| 170 |
Verify disabling copy tracing still keeps copies from rebase source |
| 171 |
------------------------------------------------------------------- |
| 172 |
|
| 173 |
$ hg init copydisable |
| 174 |
$ cd copydisable |
| 175 |
$ touch a |
| 176 |
$ hg ci -Aqm 'add a' |
| 177 |
$ touch b |
| 178 |
$ hg ci -Aqm 'add b, c' |
| 179 |
$ hg cp b x |
| 180 |
$ echo x >> x |
| 181 |
$ hg ci -qm 'copy b->x' |
| 182 |
$ hg up -q 1 |
| 183 |
$ touch z |
| 184 |
$ hg ci -Aqm 'add z' |
| 185 |
$ hg log -G -T '{rev} {desc}\n' |
| 186 |
@ 3 add z |
| 187 |
| |
| 188 |
| o 2 copy b->x |
| 189 |
|/ |
| 190 |
o 1 add b, c |
| 191 |
| |
| 192 |
o 0 add a |
| 193 |
|
| 194 |
$ hg rebase -d . -b 2 --config extensions.rebase= --config experimental.copytrace=off |
| 195 |
rebasing 2:6adcf8c12e7d "copy b->x" |
| 196 |
saved backup bundle to $TESTTMP/copydisable/.hg/strip-backup/6adcf8c12e7d-ce4b3e75-rebase.hg |
| 197 |
$ hg up -q 3 |
| 198 |
$ hg log -f x -T '{rev} {desc}\n' |
| 199 |
3 copy b->x |
| 200 |
1 add b, c |
| 201 |
|
| 202 |
$ cd ../ |
| 203 |
|
| 204 |
|
| 205 |
test storage preservation |
| 206 |
------------------------- |
| 207 |
|
| 208 |
Verify rebase do not discard recorded copies data when copy tracing usage is |
| 209 |
disabled. |
| 210 |
|
| 211 |
Setup |
| 212 |
|
| 213 |
$ hg init copydisable3 |
| 214 |
$ cd copydisable3 |
| 215 |
$ touch a |
| 216 |
$ hg ci -Aqm 'add a' |
| 217 |
$ hg cp a b |
| 218 |
$ hg ci -Aqm 'copy a->b' |
| 219 |
$ hg mv b c |
| 220 |
$ hg ci -Aqm 'move b->c' |
| 221 |
$ hg up -q 0 |
| 222 |
$ hg cp a b |
| 223 |
$ echo b >> b |
| 224 |
$ hg ci -Aqm 'copy a->b (2)' |
| 225 |
$ hg log -G -T '{rev} {desc}\n' |
| 226 |
@ 3 copy a->b (2) |
| 227 |
| |
| 228 |
| o 2 move b->c |
| 229 |
| | |
| 230 |
| o 1 copy a->b |
| 231 |
|/ |
| 232 |
o 0 add a |
| 233 |
|
| 234 |
|
| 235 |
Actual Test |
| 236 |
|
| 237 |
A file is copied on one side and has been moved twice on the other side. the |
| 238 |
file is copied from `0:a`, so the file history of the `3:b` should trace directly to `0:a`. |
| 239 |
|
| 240 |
$ hg rebase -d 2 -s 3 --config extensions.rebase= --config experimental.copytrace=off |
| 241 |
rebasing 3:47e1a9e6273b tip "copy a->b (2)" |
| 242 |
saved backup bundle to $TESTTMP/copydisable3/.hg/strip-backup/47e1a9e6273b-2d099c59-rebase.hg |
| 243 |
|
| 244 |
$ hg log -G -f b |
| 245 |
@ changeset: 3:76024fb4b05b |
| 246 |
: tag: tip |
| 247 |
: user: test |
| 248 |
: date: Thu Jan 01 00:00:00 1970 +0000 |
| 249 |
: summary: copy a->b (2) |
| 250 |
: |
| 251 |
o changeset: 0:ac82d8b1f7c4 |
| 252 |
user: test |
| 253 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 254 |
summary: add a |
| 255 |
|