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