##// END OF EJS Templates
merge: demonstrate that directory renames can lose local file content...
Martin von Zweigbergk -
r23444:88629daa default
parent child Browse files
Show More
@@ -1,157 +1,192 b''
1 $ hg init t
1 $ hg init t
2 $ cd t
2 $ cd t
3
3
4 $ mkdir a
4 $ mkdir a
5 $ echo foo > a/a
5 $ echo foo > a/a
6 $ echo bar > a/b
6 $ echo bar > a/b
7 $ hg ci -Am "0"
7 $ hg ci -Am "0"
8 adding a/a
8 adding a/a
9 adding a/b
9 adding a/b
10
10
11 $ hg co -C 0
11 $ hg co -C 0
12 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
13 $ hg mv a b
13 $ hg mv a b
14 moving a/a to b/a (glob)
14 moving a/a to b/a (glob)
15 moving a/b to b/b (glob)
15 moving a/b to b/b (glob)
16 $ hg ci -m "1 mv a/ b/"
16 $ hg ci -m "1 mv a/ b/"
17
17
18 $ hg co -C 0
18 $ hg co -C 0
19 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
19 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
20 $ echo baz > a/c
20 $ echo baz > a/c
21 $ echo quux > a/d
21 $ echo quux > a/d
22 $ hg add a/c
22 $ hg add a/c
23 $ hg ci -m "2 add a/c"
23 $ hg ci -m "2 add a/c"
24 created new head
24 created new head
25
25
26 $ hg merge --debug 1
26 $ hg merge --debug 1
27 searching for copies back to rev 1
27 searching for copies back to rev 1
28 unmatched files in local:
28 unmatched files in local:
29 a/c
29 a/c
30 unmatched files in other:
30 unmatched files in other:
31 b/a
31 b/a
32 b/b
32 b/b
33 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
33 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
34 src: 'a/a' -> dst: 'b/a'
34 src: 'a/a' -> dst: 'b/a'
35 src: 'a/b' -> dst: 'b/b'
35 src: 'a/b' -> dst: 'b/b'
36 checking for directory renames
36 checking for directory renames
37 discovered dir src: 'a/' -> dst: 'b/'
37 discovered dir src: 'a/' -> dst: 'b/'
38 pending file src: 'a/c' -> dst: 'b/c'
38 pending file src: 'a/c' -> dst: 'b/c'
39 resolving manifests
39 resolving manifests
40 branchmerge: True, force: False, partial: False
40 branchmerge: True, force: False, partial: False
41 ancestor: f9b20c0d4c51, local: ce36d17b18fb+, remote: 397f8b00a740
41 ancestor: f9b20c0d4c51, local: ce36d17b18fb+, remote: 397f8b00a740
42 a/a: other deleted -> r
42 a/a: other deleted -> r
43 removing a/a
43 removing a/a
44 a/b: other deleted -> r
44 a/b: other deleted -> r
45 removing a/b
45 removing a/b
46 updating: a/b 2/5 files (40.00%)
46 updating: a/b 2/5 files (40.00%)
47 b/a: remote created -> g
47 b/a: remote created -> g
48 getting b/a
48 getting b/a
49 b/b: remote created -> g
49 b/b: remote created -> g
50 getting b/b
50 getting b/b
51 updating: b/b 4/5 files (80.00%)
51 updating: b/b 4/5 files (80.00%)
52 b/c: remote directory rename - move from a/c -> dm
52 b/c: remote directory rename - move from a/c -> dm
53 updating: b/c 5/5 files (100.00%)
53 updating: b/c 5/5 files (100.00%)
54 moving a/c to b/c (glob)
54 moving a/c to b/c (glob)
55 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
55 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
56 (branch merge, don't forget to commit)
56 (branch merge, don't forget to commit)
57
57
58 $ echo a/* b/*
58 $ echo a/* b/*
59 a/d b/a b/b b/c
59 a/d b/a b/b b/c
60 $ hg st -C
60 $ hg st -C
61 M b/a
61 M b/a
62 M b/b
62 M b/b
63 A b/c
63 A b/c
64 a/c
64 a/c
65 R a/a
65 R a/a
66 R a/b
66 R a/b
67 R a/c
67 R a/c
68 ? a/d
68 ? a/d
69 $ hg ci -m "3 merge 2+1"
69 $ hg ci -m "3 merge 2+1"
70 $ hg debugrename b/c
70 $ hg debugrename b/c
71 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob)
71 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob)
72
72
73 $ hg co -C 1
73 $ hg co -C 1
74 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
74 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
75 $ hg merge --debug 2
75 $ hg merge --debug 2
76 searching for copies back to rev 1
76 searching for copies back to rev 1
77 unmatched files in local:
77 unmatched files in local:
78 b/a
78 b/a
79 b/b
79 b/b
80 unmatched files in other:
80 unmatched files in other:
81 a/c
81 a/c
82 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
82 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
83 src: 'a/a' -> dst: 'b/a'
83 src: 'a/a' -> dst: 'b/a'
84 src: 'a/b' -> dst: 'b/b'
84 src: 'a/b' -> dst: 'b/b'
85 checking for directory renames
85 checking for directory renames
86 discovered dir src: 'a/' -> dst: 'b/'
86 discovered dir src: 'a/' -> dst: 'b/'
87 pending file src: 'a/c' -> dst: 'b/c'
87 pending file src: 'a/c' -> dst: 'b/c'
88 resolving manifests
88 resolving manifests
89 branchmerge: True, force: False, partial: False
89 branchmerge: True, force: False, partial: False
90 ancestor: f9b20c0d4c51, local: 397f8b00a740+, remote: ce36d17b18fb
90 ancestor: f9b20c0d4c51, local: 397f8b00a740+, remote: ce36d17b18fb
91 b/c: local directory rename - get from a/c -> dg
91 b/c: local directory rename - get from a/c -> dg
92 updating: b/c 1/1 files (100.00%)
92 updating: b/c 1/1 files (100.00%)
93 getting a/c to b/c
93 getting a/c to b/c
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 (branch merge, don't forget to commit)
95 (branch merge, don't forget to commit)
96
96
97 $ echo a/* b/*
97 $ echo a/* b/*
98 a/d b/a b/b b/c
98 a/d b/a b/b b/c
99 $ hg st -C
99 $ hg st -C
100 A b/c
100 A b/c
101 a/c
101 a/c
102 ? a/d
102 ? a/d
103 $ hg ci -m "4 merge 1+2"
103 $ hg ci -m "4 merge 1+2"
104 created new head
104 created new head
105 $ hg debugrename b/c
105 $ hg debugrename b/c
106 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob)
106 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob)
107
107
108 Local directory rename with conflicting file added in remote source directory
109 and untracked in local target directory.
110
111 BROKEN: the uncommitted file is overwritten; we should abort
112
113 $ hg co -qC 1
114 $ echo local > b/c
115 $ hg merge 2
116 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 (branch merge, don't forget to commit)
118 $ hg st -C
119 A b/c
120 a/c
121 ? a/d
122 $ cat b/c
123 baz
124
125 Local directory rename with conflicting file added in remote source directory
126 and committed in local target directory.
127
128 BROKEN: the local file is overwritten; it should be merged
129
130 $ hg co -qC 1
131 $ echo local > b/c
132 $ hg add b/c
133 $ hg commit -qm 'new file in target directory'
134 $ hg merge 2
135 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
136 (branch merge, don't forget to commit)
137 $ hg st -C
138 A b/c
139 a/c
140 ? a/d
141 $ cat b/c
142 baz
108
143
109 Second scenario with two repos:
144 Second scenario with two repos:
110
145
111 $ cd ..
146 $ cd ..
112 $ hg init r1
147 $ hg init r1
113 $ cd r1
148 $ cd r1
114 $ mkdir a
149 $ mkdir a
115 $ echo foo > a/f
150 $ echo foo > a/f
116 $ hg add a
151 $ hg add a
117 adding a/f (glob)
152 adding a/f (glob)
118 $ hg ci -m "a/f == foo"
153 $ hg ci -m "a/f == foo"
119 $ cd ..
154 $ cd ..
120
155
121 $ hg clone r1 r2
156 $ hg clone r1 r2
122 updating to branch default
157 updating to branch default
123 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
158 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
124 $ cd r2
159 $ cd r2
125 $ hg mv a b
160 $ hg mv a b
126 moving a/f to b/f (glob)
161 moving a/f to b/f (glob)
127 $ echo foo1 > b/f
162 $ echo foo1 > b/f
128 $ hg ci -m" a -> b, b/f == foo1"
163 $ hg ci -m" a -> b, b/f == foo1"
129 $ cd ..
164 $ cd ..
130
165
131 $ cd r1
166 $ cd r1
132 $ mkdir a/aa
167 $ mkdir a/aa
133 $ echo bar > a/aa/g
168 $ echo bar > a/aa/g
134 $ hg add a/aa
169 $ hg add a/aa
135 adding a/aa/g (glob)
170 adding a/aa/g (glob)
136 $ hg ci -m "a/aa/g"
171 $ hg ci -m "a/aa/g"
137 $ hg pull ../r2
172 $ hg pull ../r2
138 pulling from ../r2
173 pulling from ../r2
139 searching for changes
174 searching for changes
140 adding changesets
175 adding changesets
141 adding manifests
176 adding manifests
142 adding file changes
177 adding file changes
143 added 1 changesets with 1 changes to 1 files (+1 heads)
178 added 1 changesets with 1 changes to 1 files (+1 heads)
144 (run 'hg heads' to see heads, 'hg merge' to merge)
179 (run 'hg heads' to see heads, 'hg merge' to merge)
145
180
146 $ hg merge
181 $ hg merge
147 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
182 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
148 (branch merge, don't forget to commit)
183 (branch merge, don't forget to commit)
149
184
150 $ hg st -C
185 $ hg st -C
151 M b/f
186 M b/f
152 A b/aa/g
187 A b/aa/g
153 a/aa/g
188 a/aa/g
154 R a/aa/g
189 R a/aa/g
155 R a/f
190 R a/f
156
191
157 $ cd ..
192 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now