Mercurial > hg
comparison tests/test-merge-commit.t @ 12254:852f10a15a6d
tests: unify test-merge-commit
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Sat, 11 Sep 2010 11:18:47 +0200 |
parents | tests/test-merge-commit@5b7da468531b |
children | b63f6422d2a7 |
comparison
equal
deleted
inserted
replaced
12253:e5aee120287b | 12254:852f10a15a6d |
---|---|
1 # Check that renames are correctly saved by a commit after a merge | |
2 | |
3 Test with the merge on 3 having the rename on the local parent | |
4 | |
5 $ hg init a | |
6 $ cd a | |
7 | |
8 $ echo line1 > foo | |
9 $ hg add foo | |
10 $ hg ci -m '0: add foo' | |
11 | |
12 $ echo line2 >> foo | |
13 $ hg ci -m '1: change foo' | |
14 | |
15 $ hg up -C 0 | |
16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
17 | |
18 $ hg mv foo bar | |
19 $ rm bar | |
20 $ echo line0 > bar | |
21 $ echo line1 >> bar | |
22 $ hg ci -m '2: mv foo bar; change bar' | |
23 created new head | |
24 | |
25 $ hg merge 1 | |
26 merging bar and foo to bar | |
27 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
28 (branch merge, don't forget to commit) | |
29 | |
30 $ cat bar | |
31 line0 | |
32 line1 | |
33 line2 | |
34 | |
35 $ hg ci -m '3: merge with local rename' | |
36 | |
37 $ hg debugindex .hg/store/data/bar.i | |
38 rev offset length base linkrev nodeid p1 p2 | |
39 0 0 77 0 2 d35118874825 000000000000 000000000000 | |
40 1 77 76 0 3 5345f5ab8abd 000000000000 d35118874825 | |
41 | |
42 $ hg debugrename bar | |
43 bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2 | |
44 | |
45 $ hg debugindex .hg/store/data/foo.i | |
46 rev offset length base linkrev nodeid p1 p2 | |
47 0 0 7 0 0 690b295714ae 000000000000 000000000000 | |
48 1 7 13 1 1 9e25c27b8757 690b295714ae 000000000000 | |
49 | |
50 | |
51 Revert the content change from rev 2: | |
52 | |
53 $ hg up -C 2 | |
54 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
55 $ rm bar | |
56 $ echo line1 > bar | |
57 $ hg ci -m '4: revert content change from rev 2' | |
58 created new head | |
59 | |
60 $ hg log --template '{rev}:{node|short} {parents}\n' | |
61 4:2263c1be0967 2:0f2ff26688b9 | |
62 3:0555950ead28 2:0f2ff26688b9 1:5cd961e4045d | |
63 2:0f2ff26688b9 0:2665aaee66e9 | |
64 1:5cd961e4045d | |
65 0:2665aaee66e9 | |
66 | |
67 This should use bar@rev2 as the ancestor: | |
68 | |
69 $ hg --debug merge 3 | |
70 searching for copies back to rev 1 | |
71 resolving manifests | |
72 overwrite None partial False | |
73 ancestor 0f2ff26688b9 local 2263c1be0967+ remote 0555950ead28 | |
74 bar: versions differ -> m | |
75 preserving bar for resolve of bar | |
76 updating: bar 1/1 files (100.00%) | |
77 picked tool 'internal:merge' for bar (binary False symlink False) | |
78 merging bar | |
79 my bar@2263c1be0967+ other bar@0555950ead28 ancestor bar@0f2ff26688b9 | |
80 premerge successful | |
81 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
82 (branch merge, don't forget to commit) | |
83 | |
84 $ cat bar | |
85 line1 | |
86 line2 | |
87 | |
88 $ hg ci -m '5: merge' | |
89 | |
90 $ hg debugindex .hg/store/data/bar.i | |
91 rev offset length base linkrev nodeid p1 p2 | |
92 0 0 77 0 2 d35118874825 000000000000 000000000000 | |
93 1 77 76 0 3 5345f5ab8abd 000000000000 d35118874825 | |
94 2 153 7 2 4 ff4b45017382 d35118874825 000000000000 | |
95 3 160 13 3 5 3701b4893544 ff4b45017382 5345f5ab8abd | |
96 | |
97 | |
98 Same thing, but with the merge on 3 having the rename | |
99 on the remote parent: | |
100 | |
101 $ cd .. | |
102 $ hg clone -U -r 1 -r 2 a b | |
103 requesting all changes | |
104 adding changesets | |
105 adding manifests | |
106 adding file changes | |
107 added 3 changesets with 3 changes to 2 files (+1 heads) | |
108 $ cd b | |
109 | |
110 $ hg up -C 1 | |
111 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
112 | |
113 $ hg merge 2 | |
114 merging foo and bar to bar | |
115 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
116 (branch merge, don't forget to commit) | |
117 | |
118 $ cat bar | |
119 line0 | |
120 line1 | |
121 line2 | |
122 | |
123 $ hg ci -m '3: merge with remote rename' | |
124 | |
125 $ hg debugindex .hg/store/data/bar.i | |
126 rev offset length base linkrev nodeid p1 p2 | |
127 0 0 77 0 2 d35118874825 000000000000 000000000000 | |
128 1 77 76 0 3 5345f5ab8abd 000000000000 d35118874825 | |
129 | |
130 $ hg debugrename bar | |
131 bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2 | |
132 | |
133 $ hg debugindex .hg/store/data/foo.i | |
134 rev offset length base linkrev nodeid p1 p2 | |
135 0 0 7 0 0 690b295714ae 000000000000 000000000000 | |
136 1 7 13 1 1 9e25c27b8757 690b295714ae 000000000000 | |
137 | |
138 | |
139 Revert the content change from rev 2: | |
140 | |
141 $ hg up -C 2 | |
142 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
143 $ rm bar | |
144 $ echo line1 > bar | |
145 $ hg ci -m '4: revert content change from rev 2' | |
146 created new head | |
147 | |
148 $ hg log --template '{rev}:{node|short} {parents}\n' | |
149 4:2263c1be0967 2:0f2ff26688b9 | |
150 3:3ffa6b9e35f0 1:5cd961e4045d 2:0f2ff26688b9 | |
151 2:0f2ff26688b9 0:2665aaee66e9 | |
152 1:5cd961e4045d | |
153 0:2665aaee66e9 | |
154 | |
155 This should use bar@rev2 as the ancestor: | |
156 | |
157 $ hg --debug merge 3 | |
158 searching for copies back to rev 1 | |
159 resolving manifests | |
160 overwrite None partial False | |
161 ancestor 0f2ff26688b9 local 2263c1be0967+ remote 3ffa6b9e35f0 | |
162 bar: versions differ -> m | |
163 preserving bar for resolve of bar | |
164 updating: bar 1/1 files (100.00%) | |
165 picked tool 'internal:merge' for bar (binary False symlink False) | |
166 merging bar | |
167 my bar@2263c1be0967+ other bar@3ffa6b9e35f0 ancestor bar@0f2ff26688b9 | |
168 premerge successful | |
169 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
170 (branch merge, don't forget to commit) | |
171 | |
172 $ cat bar | |
173 line1 | |
174 line2 | |
175 | |
176 $ hg ci -m '5: merge' | |
177 | |
178 $ hg debugindex .hg/store/data/bar.i | |
179 rev offset length base linkrev nodeid p1 p2 | |
180 0 0 77 0 2 d35118874825 000000000000 000000000000 | |
181 1 77 76 0 3 5345f5ab8abd 000000000000 d35118874825 | |
182 2 153 7 2 4 ff4b45017382 d35118874825 000000000000 | |
183 3 160 13 3 5 3701b4893544 ff4b45017382 5345f5ab8abd | |
184 |