comparison tests/test-copy-move-merge.t @ 44258:9659ec161644

test: document test-copy-move-merge.t Differential Revision: https://phab.mercurial-scm.org/D8077
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 13 Dec 2019 11:32:36 +0100
parents 17e12938f8e7
children f90a5c211251
comparison
equal deleted inserted replaced
44257:dbbae122f5e4 44258:9659ec161644
1 Test for the full copytracing algorithm 1 Test for the full copytracing algorithm
2 ======================================= 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.
3 16
4 $ hg init t 17 $ hg init t
5 $ cd t 18 $ cd t
6 19
7 $ echo 1 > a 20 $ echo 1 > a
19 32
20 $ echo 0 > a 33 $ echo 0 > a
21 $ echo 1 >> a 34 $ echo 1 >> a
22 35
23 $ hg ci -qAm "other" 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 =================
24 90
25 $ hg merge --debug 91 $ hg merge --debug
26 unmatched files in other: 92 unmatched files in other:
27 b 93 b
28 c 94 c
62 0 128 0
63 1 129 1
64 2 130 2
65 131
66 Test disabling copy tracing 132 Test disabling copy tracing
67 133 ===========================
68 - first verify copy metadata was kept 134
135 first verify copy metadata was kept
136 -----------------------------------
69 137
70 $ hg up -qC 2 138 $ hg up -qC 2
71 $ hg rebase --keep -d 1 -b 2 --config extensions.rebase= 139 $ hg rebase --keep -d 1 -b 2 --config extensions.rebase=
72 rebasing 2:add3f11052fa "other" (tip) 140 rebasing 2:add3f11052fa "other" (tip)
73 merging b and a to b 141 merging b and a to b
76 $ cat b 144 $ cat b
77 0 145 0
78 1 146 1
79 2 147 2
80 148
81 - next verify copy metadata is lost when disabled 149 next verify copy metadata is lost when disabled
150 ------------------------------------------------
82 151
83 $ hg strip -r . --config extensions.strip= 152 $ hg strip -r . --config extensions.strip=
84 2 files updated, 0 files merged, 0 files removed, 0 files unresolved 153 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 saved backup bundle to $TESTTMP/t/.hg/strip-backup/550bd84c0cd3-fc575957-backup.hg 154 saved backup bundle to $TESTTMP/t/.hg/strip-backup/550bd84c0cd3-fc575957-backup.hg
86 $ hg up -qC 2 155 $ hg up -qC 2
97 2 166 2
98 167
99 $ cd .. 168 $ cd ..
100 169
101 Verify disabling copy tracing still keeps copies from rebase source 170 Verify disabling copy tracing still keeps copies from rebase source
171 -------------------------------------------------------------------
102 172
103 $ hg init copydisable 173 $ hg init copydisable
104 $ cd copydisable 174 $ cd copydisable
105 $ touch a 175 $ touch a
106 $ hg ci -Aqm 'add a' 176 $ hg ci -Aqm 'add a'
129 3 copy b->x 199 3 copy b->x
130 1 add b, c 200 1 add b, c
131 201
132 $ cd ../ 202 $ cd ../
133 203
134 Verify we duplicate existing copies, instead of detecting them 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
135 212
136 $ hg init copydisable3 213 $ hg init copydisable3
137 $ cd copydisable3 214 $ cd copydisable3
138 $ touch a 215 $ touch a
139 $ hg ci -Aqm 'add a' 216 $ hg ci -Aqm 'add a'
152 | | 229 | |
153 | o 1 copy a->b 230 | o 1 copy a->b
154 |/ 231 |/
155 o 0 add a 232 o 0 add a
156 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
157 $ hg rebase -d 2 -s 3 --config extensions.rebase= --config experimental.copytrace=off 240 $ hg rebase -d 2 -s 3 --config extensions.rebase= --config experimental.copytrace=off
158 rebasing 3:47e1a9e6273b "copy a->b (2)" (tip) 241 rebasing 3:47e1a9e6273b "copy a->b (2)" (tip)
159 saved backup bundle to $TESTTMP/copydisable3/.hg/strip-backup/47e1a9e6273b-2d099c59-rebase.hg 242 saved backup bundle to $TESTTMP/copydisable3/.hg/strip-backup/47e1a9e6273b-2d099c59-rebase.hg
160 243
161 $ hg log -G -f b 244 $ hg log -G -f b