Show More
@@ -1,74 +1,184 b'' | |||||
1 | #!/bin/sh |
|
1 | # Check that renames are correctly saved by a commit after a merge | |
2 | # 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 | |||
3 |
|
4 | |||
4 | # test with the merge on 3 having the rename on the local parent |
|
5 | $ hg init a | |
5 | hg init a |
|
6 | $ cd a | |
6 | cd a |
|
7 | ||
|
8 | $ echo line1 > foo | |||
|
9 | $ hg add foo | |||
|
10 | $ hg ci -m '0: add foo' | |||
7 |
|
11 | |||
8 |
echo line |
|
12 | $ echo line2 >> foo | |
9 | hg add foo |
|
13 | $ hg ci -m '1: change foo' | |
10 | hg ci -m '0: add foo' |
|
|||
11 |
|
14 | |||
12 | echo line2 >> foo |
|
15 | $ hg up -C 0 | |
13 | hg ci -m '1: change foo' |
|
16 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
14 |
|
17 | |||
15 | hg up -C 0 |
|
18 | $ hg mv foo bar | |
16 | hg mv foo bar |
|
19 | $ rm bar | |
17 | rm bar |
|
20 | $ echo line0 > bar | |
18 |
echo line |
|
21 | $ echo line1 >> bar | |
19 | echo line1 >> bar |
|
22 | $ hg ci -m '2: mv foo bar; change bar' | |
20 | hg ci -m '2: mv foo bar; change bar' |
|
23 | created new head | |
21 |
|
24 | |||
22 | hg merge 1 |
|
25 | $ hg merge 1 | |
23 | echo '% contents of bar should be line0 line1 line2' |
|
26 | merging bar and foo to bar | |
24 | cat bar |
|
27 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
25 | hg ci -m '3: merge with local rename' |
|
28 | (branch merge, don't forget to commit) | |
26 | hg debugindex .hg/store/data/bar.i |
|
29 | ||
27 | hg debugrename bar |
|
30 | $ cat bar | |
28 | hg debugindex .hg/store/data/foo.i |
|
31 | line0 | |
|
32 | line1 | |||
|
33 | line2 | |||
|
34 | ||||
|
35 | $ hg ci -m '3: merge with local rename' | |||
29 |
|
36 | |||
30 | # revert the content change from rev 2 |
|
37 | $ hg debugindex .hg/store/data/bar.i | |
31 | hg up -C 2 |
|
38 | rev offset length base linkrev nodeid p1 p2 | |
32 | rm bar |
|
39 | 0 0 77 0 2 d35118874825 000000000000 000000000000 | |
33 | echo line1 > bar |
|
40 | 1 77 76 0 3 5345f5ab8abd 000000000000 d35118874825 | |
34 | hg ci -m '4: revert content change from rev 2' |
|
|||
35 |
|
41 | |||
36 | hg log --template '{rev}:{node|short} {parents}\n' |
|
42 | $ hg debugrename bar | |
37 | echo '% this should use bar@rev2 as the ancestor' |
|
43 | bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2 | |
38 | hg --debug merge 3 |
|
44 | ||
39 | echo '% contents of bar should be line1 line2' |
|
45 | $ hg debugindex .hg/store/data/foo.i | |
40 | cat bar |
|
46 | rev offset length base linkrev nodeid p1 p2 | |
41 | hg ci -m '5: merge' |
|
47 | 0 0 7 0 0 690b295714ae 000000000000 000000000000 | |
42 | hg debugindex .hg/store/data/bar.i |
|
48 | 1 7 13 1 1 9e25c27b8757 690b295714ae 000000000000 | |
43 |
|
49 | |||
44 |
|
50 | |||
45 | # same thing, but with the merge on 3 having the rename on the remote parent |
|
51 | Revert the content change from rev 2: | |
46 | echo |
|
52 | ||
47 | echo |
|
53 | $ hg up -C 2 | |
48 | cd .. |
|
54 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
49 | hg clone -U -r 1 -r 2 a b |
|
55 | $ rm bar | |
50 | cd b |
|
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) | |||
51 |
|
117 | |||
52 | hg up -C 1 |
|
118 | $ cat bar | |
53 | hg merge 2 |
|
119 | line0 | |
54 | echo '% contents of bar should be line0 line1 line2' |
|
120 | line1 | |
55 | cat bar |
|
121 | line2 | |
56 | hg ci -m '3: merge with remote rename' |
|
122 | ||
57 | hg debugindex .hg/store/data/bar.i |
|
123 | $ hg ci -m '3: merge with remote rename' | |
58 | hg debugrename bar |
|
124 | ||
59 |
hg debugindex .hg/store/data/ |
|
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 | |||
60 |
|
147 | |||
61 | # revert the content change from rev 2 |
|
148 | $ hg log --template '{rev}:{node|short} {parents}\n' | |
62 | hg up -C 2 |
|
149 | 4:2263c1be0967 2:0f2ff26688b9 | |
63 | rm bar |
|
150 | 3:3ffa6b9e35f0 1:5cd961e4045d 2:0f2ff26688b9 | |
64 | echo line1 > bar |
|
151 | 2:0f2ff26688b9 0:2665aaee66e9 | |
65 | hg ci -m '4: revert content change from rev 2' |
|
152 | 1:5cd961e4045d | |
|
153 | 0:2665aaee66e9 | |||
|
154 | ||||
|
155 | This should use bar@rev2 as the ancestor: | |||
66 |
|
156 | |||
67 | hg log --template '{rev}:{node|short} {parents}\n' |
|
157 | $ hg --debug merge 3 | |
68 | echo '% this should use bar@rev2 as the ancestor' |
|
158 | searching for copies back to rev 1 | |
69 | hg --debug merge 3 |
|
159 | resolving manifests | |
70 | echo '% contents of bar should be line1 line2' |
|
160 | overwrite None partial False | |
71 | cat bar |
|
161 | ancestor 0f2ff26688b9 local 2263c1be0967+ remote 3ffa6b9e35f0 | |
72 | hg ci -m '5: merge' |
|
162 | bar: versions differ -> m | |
73 | hg debugindex .hg/store/data/bar.i |
|
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) | |||
74 |
|
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 |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now