##// END OF EJS Templates
copies: don't report copies with unrelated branch
Patrick Mezard -
r10179:83cfa1ba stable
parent child Browse files
Show More
@@ -1,233 +1,245 b''
1 1 # copies.py - copy detection for Mercurial
2 2 #
3 3 # Copyright 2008 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2, incorporated herein by reference.
7 7
8 8 from i18n import _
9 9 import util
10 10 import heapq
11 11
12 12 def _nonoverlap(d1, d2, d3):
13 13 "Return list of elements in d1 not in d2 or d3"
14 14 return sorted([d for d in d1 if d not in d3 and d not in d2])
15 15
16 16 def _dirname(f):
17 17 s = f.rfind("/")
18 18 if s == -1:
19 19 return ""
20 20 return f[:s]
21 21
22 22 def _dirs(files):
23 23 d = set()
24 24 for f in files:
25 25 f = _dirname(f)
26 26 while f not in d:
27 27 d.add(f)
28 28 f = _dirname(f)
29 29 return d
30 30
31 31 def _findoldnames(fctx, limit):
32 32 "find files that path was copied from, back to linkrev limit"
33 33 old = {}
34 34 seen = set()
35 35 orig = fctx.path()
36 36 visit = [(fctx, 0)]
37 37 while visit:
38 38 fc, depth = visit.pop()
39 39 s = str(fc)
40 40 if s in seen:
41 41 continue
42 42 seen.add(s)
43 43 if fc.path() != orig and fc.path() not in old:
44 44 old[fc.path()] = (depth, fc.path()) # remember depth
45 45 if fc.rev() is not None and fc.rev() < limit:
46 46 continue
47 47 visit += [(p, depth - 1) for p in fc.parents()]
48 48
49 49 # return old names sorted by depth
50 50 return [o[1] for o in sorted(old.values())]
51 51
52 52 def _findlimit(repo, a, b):
53 "find the earliest revision that's an ancestor of a or b but not both"
53 """Find the earliest revision that's an ancestor of a or b but not both,
54 None if no such revision exists.
55 """
54 56 # basic idea:
55 57 # - mark a and b with different sides
56 58 # - if a parent's children are all on the same side, the parent is
57 59 # on that side, otherwise it is on no side
58 60 # - walk the graph in topological order with the help of a heap;
59 61 # - add unseen parents to side map
60 62 # - clear side of any parent that has children on different sides
61 63 # - track number of interesting revs that might still be on a side
62 64 # - track the lowest interesting rev seen
63 65 # - quit when interesting revs is zero
64 66
65 67 cl = repo.changelog
66 68 working = len(cl) # pseudo rev for the working directory
67 69 if a is None:
68 70 a = working
69 71 if b is None:
70 72 b = working
71 73
72 74 side = {a: -1, b: 1}
73 75 visit = [-a, -b]
74 76 heapq.heapify(visit)
75 77 interesting = len(visit)
78 hascommonancestor = False
76 79 limit = working
77 80
78 81 while interesting:
79 82 r = -heapq.heappop(visit)
80 83 if r == working:
81 84 parents = [cl.rev(p) for p in repo.dirstate.parents()]
82 85 else:
83 86 parents = cl.parentrevs(r)
84 87 for p in parents:
88 if p < 0:
89 continue
85 90 if p not in side:
86 91 # first time we see p; add it to visit
87 92 side[p] = side[r]
88 93 if side[p]:
89 94 interesting += 1
90 95 heapq.heappush(visit, -p)
91 96 elif side[p] and side[p] != side[r]:
92 97 # p was interesting but now we know better
93 98 side[p] = 0
94 99 interesting -= 1
100 hascommonancestor = True
95 101 if side[r]:
96 102 limit = r # lowest rev visited
97 103 interesting -= 1
104
105 if not hascommonancestor:
106 return None
98 107 return limit
99 108
100 109 def copies(repo, c1, c2, ca, checkdirs=False):
101 110 """
102 111 Find moves and copies between context c1 and c2
103 112 """
104 113 # avoid silly behavior for update from empty dir
105 114 if not c1 or not c2 or c1 == c2:
106 115 return {}, {}
107 116
108 117 # avoid silly behavior for parent -> working dir
109 118 if c2.node() is None and c1.node() == repo.dirstate.parents()[0]:
110 119 return repo.dirstate.copies(), {}
111 120
112 121 limit = _findlimit(repo, c1.rev(), c2.rev())
122 if limit is None:
123 # no common ancestor, no copies
124 return {}, {}
113 125 m1 = c1.manifest()
114 126 m2 = c2.manifest()
115 127 ma = ca.manifest()
116 128
117 129 def makectx(f, n):
118 130 if len(n) != 20: # in a working context?
119 131 if c1.rev() is None:
120 132 return c1.filectx(f)
121 133 return c2.filectx(f)
122 134 return repo.filectx(f, fileid=n)
123 135
124 136 ctx = util.lrucachefunc(makectx)
125 137 copy = {}
126 138 fullcopy = {}
127 139 diverge = {}
128 140
129 141 def checkcopies(f, m1, m2):
130 142 '''check possible copies of f from m1 to m2'''
131 143 c1 = ctx(f, m1[f])
132 144 for of in _findoldnames(c1, limit):
133 145 fullcopy[f] = of # remember for dir rename detection
134 146 if of in m2: # original file not in other manifest?
135 147 # if the original file is unchanged on the other branch,
136 148 # no merge needed
137 149 if m2[of] != ma.get(of):
138 150 c2 = ctx(of, m2[of])
139 151 ca = c1.ancestor(c2)
140 152 # related and named changed on only one side?
141 153 if ca and (ca.path() == f or ca.path() == c2.path()):
142 154 if c1 != ca or c2 != ca: # merge needed?
143 155 copy[f] = of
144 156 elif of in ma:
145 157 diverge.setdefault(of, []).append(f)
146 158
147 159 repo.ui.debug(" searching for copies back to rev %d\n" % limit)
148 160
149 161 u1 = _nonoverlap(m1, m2, ma)
150 162 u2 = _nonoverlap(m2, m1, ma)
151 163
152 164 if u1:
153 165 repo.ui.debug(" unmatched files in local:\n %s\n"
154 166 % "\n ".join(u1))
155 167 if u2:
156 168 repo.ui.debug(" unmatched files in other:\n %s\n"
157 169 % "\n ".join(u2))
158 170
159 171 for f in u1:
160 172 checkcopies(f, m1, m2)
161 173 for f in u2:
162 174 checkcopies(f, m2, m1)
163 175
164 176 diverge2 = set()
165 177 for of, fl in diverge.items():
166 178 if len(fl) == 1:
167 179 del diverge[of] # not actually divergent
168 180 else:
169 181 diverge2.update(fl) # reverse map for below
170 182
171 183 if fullcopy:
172 184 repo.ui.debug(" all copies found (* = to merge, ! = divergent):\n")
173 185 for f in fullcopy:
174 186 note = ""
175 187 if f in copy: note += "*"
176 188 if f in diverge2: note += "!"
177 189 repo.ui.debug(" %s -> %s %s\n" % (f, fullcopy[f], note))
178 190 del diverge2
179 191
180 192 if not fullcopy or not checkdirs:
181 193 return copy, diverge
182 194
183 195 repo.ui.debug(" checking for directory renames\n")
184 196
185 197 # generate a directory move map
186 198 d1, d2 = _dirs(m1), _dirs(m2)
187 199 invalid = set()
188 200 dirmove = {}
189 201
190 202 # examine each file copy for a potential directory move, which is
191 203 # when all the files in a directory are moved to a new directory
192 204 for dst, src in fullcopy.iteritems():
193 205 dsrc, ddst = _dirname(src), _dirname(dst)
194 206 if dsrc in invalid:
195 207 # already seen to be uninteresting
196 208 continue
197 209 elif dsrc in d1 and ddst in d1:
198 210 # directory wasn't entirely moved locally
199 211 invalid.add(dsrc)
200 212 elif dsrc in d2 and ddst in d2:
201 213 # directory wasn't entirely moved remotely
202 214 invalid.add(dsrc)
203 215 elif dsrc in dirmove and dirmove[dsrc] != ddst:
204 216 # files from the same directory moved to two different places
205 217 invalid.add(dsrc)
206 218 else:
207 219 # looks good so far
208 220 dirmove[dsrc + "/"] = ddst + "/"
209 221
210 222 for i in invalid:
211 223 if i in dirmove:
212 224 del dirmove[i]
213 225 del d1, d2, invalid
214 226
215 227 if not dirmove:
216 228 return copy, diverge
217 229
218 230 for d in dirmove:
219 231 repo.ui.debug(" dir %s -> %s\n" % (d, dirmove[d]))
220 232
221 233 # check unaccounted nonoverlapping files against directory moves
222 234 for f in u1 + u2:
223 235 if f not in fullcopy:
224 236 for d in dirmove:
225 237 if f.startswith(d):
226 238 # new file added in a directory that was moved, move it
227 239 df = dirmove[d] + f[len(d):]
228 240 if df not in copy:
229 241 copy[f] = df
230 242 repo.ui.debug(" file %s -> %s\n" % (f, copy[f]))
231 243 break
232 244
233 245 return copy, diverge
@@ -1,80 +1,95 b''
1 1 #!/bin/sh
2 2
3 3 add()
4 4 {
5 5 echo $2 >> $1
6 6 }
7 7
8 8 hg init t
9 9 cd t
10 10
11 11 # set up a boring main branch
12 12 add a a
13 13 hg add a
14 14 mkdir x
15 15 add x/x x
16 16 hg add x/x
17 17 hg ci -m0
18 18
19 19 add a m1
20 20 hg ci -m1
21 21
22 22 add a m2
23 23 add x/y y1
24 24 hg add x/y
25 25 hg ci -m2
26 26 cd ..
27 27
28 28 show()
29 29 {
30 30 echo "- $2: $1"
31 31 hg st -C $1
32 32 echo
33 33 hg diff --git $1
34 34 echo
35 35 }
36 36
37 37 count=0
38 38 # make a new branch and get diff/status output
39 39 # $1 - first commit
40 40 # $2 - second commit
41 41 # $3 - working dir action
42 42 # $4 - test description
43 43 tb()
44 44 {
45 45 hg clone t t2 ; cd t2
46 46 hg co -q -C 0
47 47
48 48 add a $count
49 49 count=`expr $count + 1`
50 50 hg ci -m "t0"
51 51 $1
52 52 hg ci -m "t1"
53 53 $2
54 54 hg ci -m "t2"
55 55 $3
56 56
57 57 echo "** $4 **"
58 58 echo "** $1 / $2 / $3"
59 59 show "" "working to parent"
60 60 show "--rev 0" "working to root"
61 61 show "--rev 2" "working to branch"
62 62 show "--rev 0 --rev ." "root to parent"
63 63 show "--rev . --rev 0" "parent to root"
64 64 show "--rev 2 --rev ." "branch to parent"
65 65 show "--rev . --rev 2" "parent to branch"
66 66 echo
67 67 cd ..
68 68 rm -rf t2
69 69 }
70 70
71 71
72 72 tb "add a a1" "add a a2" "hg mv a b" "rename in working dir"
73 73 tb "add a a1" "add a a2" "hg cp a b" "copy in working dir"
74 74 tb "hg mv a b" "add b b1" "add b w" "single rename"
75 75 tb "hg cp a b" "add b b1" "add a w" "single copy"
76 76 tb "hg mv a b" "hg mv b c" "hg mv c d" "rename chain"
77 77 tb "hg cp a b" "hg cp b c" "hg cp c d" "copy chain"
78 78 tb "add a a1" "hg mv a b" "hg mv b a" "circular rename"
79 79
80 80 tb "hg mv x y" "add y/x x1" "add y/x x2" "directory move"
81
82 # Cannot implement unrelated branch with tb
83 echo '% testing copies with unrelated branch'
84 hg init unrelated
85 cd unrelated
86 add a a
87 hg ci -Am adda
88 hg mv a b
89 hg ci -m movea
90 hg up -C null
91 add a a
92 hg ci -Am addunrelateda
93 echo '% unrelated branch diff'
94 hg diff --git -r 2 -r 1
95 cd ..
@@ -1,1236 +1,1254 b''
1 1 updating to branch default
2 2 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
3 3 created new head
4 4 ** rename in working dir **
5 5 ** add a a1 / add a a2 / hg mv a b
6 6 - working to parent:
7 7 A b
8 8 a
9 9 R a
10 10
11 11 diff --git a/a b/b
12 12 rename from a
13 13 rename to b
14 14
15 15 - working to root: --rev 0
16 16 A b
17 17 a
18 18 R a
19 19
20 20 diff --git a/a b/b
21 21 rename from a
22 22 rename to b
23 23 --- a/a
24 24 +++ b/b
25 25 @@ -1,1 +1,4 @@
26 26 a
27 27 +0
28 28 +a1
29 29 +a2
30 30
31 31 - working to branch: --rev 2
32 32 A b
33 33 a
34 34 R a
35 35 R x/y
36 36
37 37 diff --git a/a b/b
38 38 rename from a
39 39 rename to b
40 40 --- a/a
41 41 +++ b/b
42 42 @@ -1,3 +1,4 @@
43 43 a
44 44 -m1
45 45 -m2
46 46 +0
47 47 +a1
48 48 +a2
49 49 diff --git a/x/y b/x/y
50 50 deleted file mode 100644
51 51 --- a/x/y
52 52 +++ /dev/null
53 53 @@ -1,1 +0,0 @@
54 54 -y1
55 55
56 56 - root to parent: --rev 0 --rev .
57 57 M a
58 58
59 59 diff --git a/a b/a
60 60 --- a/a
61 61 +++ b/a
62 62 @@ -1,1 +1,4 @@
63 63 a
64 64 +0
65 65 +a1
66 66 +a2
67 67
68 68 - parent to root: --rev . --rev 0
69 69 M a
70 70
71 71 diff --git a/a b/a
72 72 --- a/a
73 73 +++ b/a
74 74 @@ -1,4 +1,1 @@
75 75 a
76 76 -0
77 77 -a1
78 78 -a2
79 79
80 80 - branch to parent: --rev 2 --rev .
81 81 M a
82 82 R x/y
83 83
84 84 diff --git a/a b/a
85 85 --- a/a
86 86 +++ b/a
87 87 @@ -1,3 +1,4 @@
88 88 a
89 89 -m1
90 90 -m2
91 91 +0
92 92 +a1
93 93 +a2
94 94 diff --git a/x/y b/x/y
95 95 deleted file mode 100644
96 96 --- a/x/y
97 97 +++ /dev/null
98 98 @@ -1,1 +0,0 @@
99 99 -y1
100 100
101 101 - parent to branch: --rev . --rev 2
102 102 M a
103 103 A x/y
104 104
105 105 diff --git a/a b/a
106 106 --- a/a
107 107 +++ b/a
108 108 @@ -1,4 +1,3 @@
109 109 a
110 110 -0
111 111 -a1
112 112 -a2
113 113 +m1
114 114 +m2
115 115 diff --git a/x/y b/x/y
116 116 new file mode 100644
117 117 --- /dev/null
118 118 +++ b/x/y
119 119 @@ -0,0 +1,1 @@
120 120 +y1
121 121
122 122
123 123 updating to branch default
124 124 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
125 125 created new head
126 126 ** copy in working dir **
127 127 ** add a a1 / add a a2 / hg cp a b
128 128 - working to parent:
129 129 A b
130 130 a
131 131
132 132 diff --git a/a b/b
133 133 copy from a
134 134 copy to b
135 135
136 136 - working to root: --rev 0
137 137 M a
138 138 A b
139 139 a
140 140
141 141 diff --git a/a b/a
142 142 --- a/a
143 143 +++ b/a
144 144 @@ -1,1 +1,4 @@
145 145 a
146 146 +1
147 147 +a1
148 148 +a2
149 149 diff --git a/a b/b
150 150 copy from a
151 151 copy to b
152 152 --- a/a
153 153 +++ b/b
154 154 @@ -1,1 +1,4 @@
155 155 a
156 156 +1
157 157 +a1
158 158 +a2
159 159
160 160 - working to branch: --rev 2
161 161 M a
162 162 A b
163 163 a
164 164 R x/y
165 165
166 166 diff --git a/a b/a
167 167 --- a/a
168 168 +++ b/a
169 169 @@ -1,3 +1,4 @@
170 170 a
171 171 -m1
172 172 -m2
173 173 +1
174 174 +a1
175 175 +a2
176 176 diff --git a/a b/b
177 177 copy from a
178 178 copy to b
179 179 --- a/a
180 180 +++ b/b
181 181 @@ -1,3 +1,4 @@
182 182 a
183 183 -m1
184 184 -m2
185 185 +1
186 186 +a1
187 187 +a2
188 188 diff --git a/x/y b/x/y
189 189 deleted file mode 100644
190 190 --- a/x/y
191 191 +++ /dev/null
192 192 @@ -1,1 +0,0 @@
193 193 -y1
194 194
195 195 - root to parent: --rev 0 --rev .
196 196 M a
197 197
198 198 diff --git a/a b/a
199 199 --- a/a
200 200 +++ b/a
201 201 @@ -1,1 +1,4 @@
202 202 a
203 203 +1
204 204 +a1
205 205 +a2
206 206
207 207 - parent to root: --rev . --rev 0
208 208 M a
209 209
210 210 diff --git a/a b/a
211 211 --- a/a
212 212 +++ b/a
213 213 @@ -1,4 +1,1 @@
214 214 a
215 215 -1
216 216 -a1
217 217 -a2
218 218
219 219 - branch to parent: --rev 2 --rev .
220 220 M a
221 221 R x/y
222 222
223 223 diff --git a/a b/a
224 224 --- a/a
225 225 +++ b/a
226 226 @@ -1,3 +1,4 @@
227 227 a
228 228 -m1
229 229 -m2
230 230 +1
231 231 +a1
232 232 +a2
233 233 diff --git a/x/y b/x/y
234 234 deleted file mode 100644
235 235 --- a/x/y
236 236 +++ /dev/null
237 237 @@ -1,1 +0,0 @@
238 238 -y1
239 239
240 240 - parent to branch: --rev . --rev 2
241 241 M a
242 242 A x/y
243 243
244 244 diff --git a/a b/a
245 245 --- a/a
246 246 +++ b/a
247 247 @@ -1,4 +1,3 @@
248 248 a
249 249 -1
250 250 -a1
251 251 -a2
252 252 +m1
253 253 +m2
254 254 diff --git a/x/y b/x/y
255 255 new file mode 100644
256 256 --- /dev/null
257 257 +++ b/x/y
258 258 @@ -0,0 +1,1 @@
259 259 +y1
260 260
261 261
262 262 updating to branch default
263 263 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
264 264 created new head
265 265 ** single rename **
266 266 ** hg mv a b / add b b1 / add b w
267 267 - working to parent:
268 268 M b
269 269
270 270 diff --git a/b b/b
271 271 --- a/b
272 272 +++ b/b
273 273 @@ -1,3 +1,4 @@
274 274 a
275 275 2
276 276 b1
277 277 +w
278 278
279 279 - working to root: --rev 0
280 280 A b
281 281 a
282 282 R a
283 283
284 284 diff --git a/a b/b
285 285 rename from a
286 286 rename to b
287 287 --- a/a
288 288 +++ b/b
289 289 @@ -1,1 +1,4 @@
290 290 a
291 291 +2
292 292 +b1
293 293 +w
294 294
295 295 - working to branch: --rev 2
296 296 A b
297 297 a
298 298 R a
299 299 R x/y
300 300
301 301 diff --git a/a b/b
302 302 rename from a
303 303 rename to b
304 304 --- a/a
305 305 +++ b/b
306 306 @@ -1,3 +1,4 @@
307 307 a
308 308 -m1
309 309 -m2
310 310 +2
311 311 +b1
312 312 +w
313 313 diff --git a/x/y b/x/y
314 314 deleted file mode 100644
315 315 --- a/x/y
316 316 +++ /dev/null
317 317 @@ -1,1 +0,0 @@
318 318 -y1
319 319
320 320 - root to parent: --rev 0 --rev .
321 321 A b
322 322 a
323 323 R a
324 324
325 325 diff --git a/a b/b
326 326 rename from a
327 327 rename to b
328 328 --- a/a
329 329 +++ b/b
330 330 @@ -1,1 +1,3 @@
331 331 a
332 332 +2
333 333 +b1
334 334
335 335 - parent to root: --rev . --rev 0
336 336 A a
337 337 b
338 338 R b
339 339
340 340 diff --git a/b b/a
341 341 rename from b
342 342 rename to a
343 343 --- a/b
344 344 +++ b/a
345 345 @@ -1,3 +1,1 @@
346 346 a
347 347 -2
348 348 -b1
349 349
350 350 - branch to parent: --rev 2 --rev .
351 351 A b
352 352 a
353 353 R a
354 354 R x/y
355 355
356 356 diff --git a/a b/b
357 357 rename from a
358 358 rename to b
359 359 --- a/a
360 360 +++ b/b
361 361 @@ -1,3 +1,3 @@
362 362 a
363 363 -m1
364 364 -m2
365 365 +2
366 366 +b1
367 367 diff --git a/x/y b/x/y
368 368 deleted file mode 100644
369 369 --- a/x/y
370 370 +++ /dev/null
371 371 @@ -1,1 +0,0 @@
372 372 -y1
373 373
374 374 - parent to branch: --rev . --rev 2
375 375 A a
376 376 b
377 377 A x/y
378 378 R b
379 379
380 380 diff --git a/b b/a
381 381 rename from b
382 382 rename to a
383 383 --- a/b
384 384 +++ b/a
385 385 @@ -1,3 +1,3 @@
386 386 a
387 387 -2
388 388 -b1
389 389 +m1
390 390 +m2
391 391 diff --git a/x/y b/x/y
392 392 new file mode 100644
393 393 --- /dev/null
394 394 +++ b/x/y
395 395 @@ -0,0 +1,1 @@
396 396 +y1
397 397
398 398
399 399 updating to branch default
400 400 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
401 401 created new head
402 402 ** single copy **
403 403 ** hg cp a b / add b b1 / add a w
404 404 - working to parent:
405 405 M a
406 406
407 407 diff --git a/a b/a
408 408 --- a/a
409 409 +++ b/a
410 410 @@ -1,2 +1,3 @@
411 411 a
412 412 3
413 413 +w
414 414
415 415 - working to root: --rev 0
416 416 M a
417 417 A b
418 418 a
419 419
420 420 diff --git a/a b/a
421 421 --- a/a
422 422 +++ b/a
423 423 @@ -1,1 +1,3 @@
424 424 a
425 425 +3
426 426 +w
427 427 diff --git a/a b/b
428 428 copy from a
429 429 copy to b
430 430 --- a/a
431 431 +++ b/b
432 432 @@ -1,1 +1,3 @@
433 433 a
434 434 +3
435 435 +b1
436 436
437 437 - working to branch: --rev 2
438 438 M a
439 439 A b
440 440 a
441 441 R x/y
442 442
443 443 diff --git a/a b/a
444 444 --- a/a
445 445 +++ b/a
446 446 @@ -1,3 +1,3 @@
447 447 a
448 448 -m1
449 449 -m2
450 450 +3
451 451 +w
452 452 diff --git a/a b/b
453 453 copy from a
454 454 copy to b
455 455 --- a/a
456 456 +++ b/b
457 457 @@ -1,3 +1,3 @@
458 458 a
459 459 -m1
460 460 -m2
461 461 +3
462 462 +b1
463 463 diff --git a/x/y b/x/y
464 464 deleted file mode 100644
465 465 --- a/x/y
466 466 +++ /dev/null
467 467 @@ -1,1 +0,0 @@
468 468 -y1
469 469
470 470 - root to parent: --rev 0 --rev .
471 471 M a
472 472 A b
473 473 a
474 474
475 475 diff --git a/a b/a
476 476 --- a/a
477 477 +++ b/a
478 478 @@ -1,1 +1,2 @@
479 479 a
480 480 +3
481 481 diff --git a/a b/b
482 482 copy from a
483 483 copy to b
484 484 --- a/a
485 485 +++ b/b
486 486 @@ -1,1 +1,3 @@
487 487 a
488 488 +3
489 489 +b1
490 490
491 491 - parent to root: --rev . --rev 0
492 492 M a
493 493 R b
494 494
495 495 diff --git a/a b/a
496 496 --- a/a
497 497 +++ b/a
498 498 @@ -1,2 +1,1 @@
499 499 a
500 500 -3
501 501 diff --git a/b b/b
502 502 deleted file mode 100644
503 503 --- a/b
504 504 +++ /dev/null
505 505 @@ -1,3 +0,0 @@
506 506 -a
507 507 -3
508 508 -b1
509 509
510 510 - branch to parent: --rev 2 --rev .
511 511 M a
512 512 A b
513 513 a
514 514 R x/y
515 515
516 516 diff --git a/a b/a
517 517 --- a/a
518 518 +++ b/a
519 519 @@ -1,3 +1,2 @@
520 520 a
521 521 -m1
522 522 -m2
523 523 +3
524 524 diff --git a/a b/b
525 525 copy from a
526 526 copy to b
527 527 --- a/a
528 528 +++ b/b
529 529 @@ -1,3 +1,3 @@
530 530 a
531 531 -m1
532 532 -m2
533 533 +3
534 534 +b1
535 535 diff --git a/x/y b/x/y
536 536 deleted file mode 100644
537 537 --- a/x/y
538 538 +++ /dev/null
539 539 @@ -1,1 +0,0 @@
540 540 -y1
541 541
542 542 - parent to branch: --rev . --rev 2
543 543 M a
544 544 A x/y
545 545 R b
546 546
547 547 diff --git a/a b/a
548 548 --- a/a
549 549 +++ b/a
550 550 @@ -1,2 +1,3 @@
551 551 a
552 552 -3
553 553 +m1
554 554 +m2
555 555 diff --git a/b b/b
556 556 deleted file mode 100644
557 557 --- a/b
558 558 +++ /dev/null
559 559 @@ -1,3 +0,0 @@
560 560 -a
561 561 -3
562 562 -b1
563 563 diff --git a/x/y b/x/y
564 564 new file mode 100644
565 565 --- /dev/null
566 566 +++ b/x/y
567 567 @@ -0,0 +1,1 @@
568 568 +y1
569 569
570 570
571 571 updating to branch default
572 572 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
573 573 created new head
574 574 ** rename chain **
575 575 ** hg mv a b / hg mv b c / hg mv c d
576 576 - working to parent:
577 577 A d
578 578 c
579 579 R c
580 580
581 581 diff --git a/c b/d
582 582 rename from c
583 583 rename to d
584 584
585 585 - working to root: --rev 0
586 586 A d
587 587 a
588 588 R a
589 589
590 590 diff --git a/a b/d
591 591 rename from a
592 592 rename to d
593 593 --- a/a
594 594 +++ b/d
595 595 @@ -1,1 +1,2 @@
596 596 a
597 597 +4
598 598
599 599 - working to branch: --rev 2
600 600 A d
601 601 a
602 602 R a
603 603 R x/y
604 604
605 605 diff --git a/a b/d
606 606 rename from a
607 607 rename to d
608 608 --- a/a
609 609 +++ b/d
610 610 @@ -1,3 +1,2 @@
611 611 a
612 612 -m1
613 613 -m2
614 614 +4
615 615 diff --git a/x/y b/x/y
616 616 deleted file mode 100644
617 617 --- a/x/y
618 618 +++ /dev/null
619 619 @@ -1,1 +0,0 @@
620 620 -y1
621 621
622 622 - root to parent: --rev 0 --rev .
623 623 A c
624 624 a
625 625 R a
626 626
627 627 diff --git a/a b/c
628 628 rename from a
629 629 rename to c
630 630 --- a/a
631 631 +++ b/c
632 632 @@ -1,1 +1,2 @@
633 633 a
634 634 +4
635 635
636 636 - parent to root: --rev . --rev 0
637 637 A a
638 638 c
639 639 R c
640 640
641 641 diff --git a/c b/a
642 642 rename from c
643 643 rename to a
644 644 --- a/c
645 645 +++ b/a
646 646 @@ -1,2 +1,1 @@
647 647 a
648 648 -4
649 649
650 650 - branch to parent: --rev 2 --rev .
651 651 A c
652 652 a
653 653 R a
654 654 R x/y
655 655
656 656 diff --git a/a b/c
657 657 rename from a
658 658 rename to c
659 659 --- a/a
660 660 +++ b/c
661 661 @@ -1,3 +1,2 @@
662 662 a
663 663 -m1
664 664 -m2
665 665 +4
666 666 diff --git a/x/y b/x/y
667 667 deleted file mode 100644
668 668 --- a/x/y
669 669 +++ /dev/null
670 670 @@ -1,1 +0,0 @@
671 671 -y1
672 672
673 673 - parent to branch: --rev . --rev 2
674 674 A a
675 675 c
676 676 A x/y
677 677 R c
678 678
679 679 diff --git a/c b/a
680 680 rename from c
681 681 rename to a
682 682 --- a/c
683 683 +++ b/a
684 684 @@ -1,2 +1,3 @@
685 685 a
686 686 -4
687 687 +m1
688 688 +m2
689 689 diff --git a/x/y b/x/y
690 690 new file mode 100644
691 691 --- /dev/null
692 692 +++ b/x/y
693 693 @@ -0,0 +1,1 @@
694 694 +y1
695 695
696 696
697 697 updating to branch default
698 698 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
699 699 created new head
700 700 ** copy chain **
701 701 ** hg cp a b / hg cp b c / hg cp c d
702 702 - working to parent:
703 703 A d
704 704 c
705 705
706 706 diff --git a/c b/d
707 707 copy from c
708 708 copy to d
709 709
710 710 - working to root: --rev 0
711 711 M a
712 712 A b
713 713 a
714 714 A c
715 715 a
716 716 A d
717 717 a
718 718
719 719 diff --git a/a b/a
720 720 --- a/a
721 721 +++ b/a
722 722 @@ -1,1 +1,2 @@
723 723 a
724 724 +5
725 725 diff --git a/a b/b
726 726 copy from a
727 727 copy to b
728 728 --- a/a
729 729 +++ b/b
730 730 @@ -1,1 +1,2 @@
731 731 a
732 732 +5
733 733 diff --git a/a b/c
734 734 copy from a
735 735 copy to c
736 736 --- a/a
737 737 +++ b/c
738 738 @@ -1,1 +1,2 @@
739 739 a
740 740 +5
741 741 diff --git a/a b/d
742 742 copy from a
743 743 copy to d
744 744 --- a/a
745 745 +++ b/d
746 746 @@ -1,1 +1,2 @@
747 747 a
748 748 +5
749 749
750 750 - working to branch: --rev 2
751 751 M a
752 752 A b
753 753 a
754 754 A c
755 755 a
756 756 A d
757 757 a
758 758 R x/y
759 759
760 760 diff --git a/a b/a
761 761 --- a/a
762 762 +++ b/a
763 763 @@ -1,3 +1,2 @@
764 764 a
765 765 -m1
766 766 -m2
767 767 +5
768 768 diff --git a/a b/b
769 769 copy from a
770 770 copy to b
771 771 --- a/a
772 772 +++ b/b
773 773 @@ -1,3 +1,2 @@
774 774 a
775 775 -m1
776 776 -m2
777 777 +5
778 778 diff --git a/a b/c
779 779 copy from a
780 780 copy to c
781 781 --- a/a
782 782 +++ b/c
783 783 @@ -1,3 +1,2 @@
784 784 a
785 785 -m1
786 786 -m2
787 787 +5
788 788 diff --git a/a b/d
789 789 copy from a
790 790 copy to d
791 791 --- a/a
792 792 +++ b/d
793 793 @@ -1,3 +1,2 @@
794 794 a
795 795 -m1
796 796 -m2
797 797 +5
798 798 diff --git a/x/y b/x/y
799 799 deleted file mode 100644
800 800 --- a/x/y
801 801 +++ /dev/null
802 802 @@ -1,1 +0,0 @@
803 803 -y1
804 804
805 805 - root to parent: --rev 0 --rev .
806 806 M a
807 807 A b
808 808 a
809 809 A c
810 810 a
811 811
812 812 diff --git a/a b/a
813 813 --- a/a
814 814 +++ b/a
815 815 @@ -1,1 +1,2 @@
816 816 a
817 817 +5
818 818 diff --git a/a b/b
819 819 copy from a
820 820 copy to b
821 821 --- a/a
822 822 +++ b/b
823 823 @@ -1,1 +1,2 @@
824 824 a
825 825 +5
826 826 diff --git a/a b/c
827 827 copy from a
828 828 copy to c
829 829 --- a/a
830 830 +++ b/c
831 831 @@ -1,1 +1,2 @@
832 832 a
833 833 +5
834 834
835 835 - parent to root: --rev . --rev 0
836 836 M a
837 837 R b
838 838 R c
839 839
840 840 diff --git a/a b/a
841 841 --- a/a
842 842 +++ b/a
843 843 @@ -1,2 +1,1 @@
844 844 a
845 845 -5
846 846 diff --git a/b b/b
847 847 deleted file mode 100644
848 848 --- a/b
849 849 +++ /dev/null
850 850 @@ -1,2 +0,0 @@
851 851 -a
852 852 -5
853 853 diff --git a/c b/c
854 854 deleted file mode 100644
855 855 --- a/c
856 856 +++ /dev/null
857 857 @@ -1,2 +0,0 @@
858 858 -a
859 859 -5
860 860
861 861 - branch to parent: --rev 2 --rev .
862 862 M a
863 863 A b
864 864 a
865 865 A c
866 866 a
867 867 R x/y
868 868
869 869 diff --git a/a b/a
870 870 --- a/a
871 871 +++ b/a
872 872 @@ -1,3 +1,2 @@
873 873 a
874 874 -m1
875 875 -m2
876 876 +5
877 877 diff --git a/a b/b
878 878 copy from a
879 879 copy to b
880 880 --- a/a
881 881 +++ b/b
882 882 @@ -1,3 +1,2 @@
883 883 a
884 884 -m1
885 885 -m2
886 886 +5
887 887 diff --git a/a b/c
888 888 copy from a
889 889 copy to c
890 890 --- a/a
891 891 +++ b/c
892 892 @@ -1,3 +1,2 @@
893 893 a
894 894 -m1
895 895 -m2
896 896 +5
897 897 diff --git a/x/y b/x/y
898 898 deleted file mode 100644
899 899 --- a/x/y
900 900 +++ /dev/null
901 901 @@ -1,1 +0,0 @@
902 902 -y1
903 903
904 904 - parent to branch: --rev . --rev 2
905 905 M a
906 906 A x/y
907 907 R b
908 908 R c
909 909
910 910 diff --git a/a b/a
911 911 --- a/a
912 912 +++ b/a
913 913 @@ -1,2 +1,3 @@
914 914 a
915 915 -5
916 916 +m1
917 917 +m2
918 918 diff --git a/b b/b
919 919 deleted file mode 100644
920 920 --- a/b
921 921 +++ /dev/null
922 922 @@ -1,2 +0,0 @@
923 923 -a
924 924 -5
925 925 diff --git a/c b/c
926 926 deleted file mode 100644
927 927 --- a/c
928 928 +++ /dev/null
929 929 @@ -1,2 +0,0 @@
930 930 -a
931 931 -5
932 932 diff --git a/x/y b/x/y
933 933 new file mode 100644
934 934 --- /dev/null
935 935 +++ b/x/y
936 936 @@ -0,0 +1,1 @@
937 937 +y1
938 938
939 939
940 940 updating to branch default
941 941 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
942 942 created new head
943 943 ** circular rename **
944 944 ** add a a1 / hg mv a b / hg mv b a
945 945 - working to parent:
946 946 A a
947 947 b
948 948 R b
949 949
950 950 diff --git a/b b/a
951 951 rename from b
952 952 rename to a
953 953
954 954 - working to root: --rev 0
955 955 M a
956 956
957 957 diff --git a/a b/a
958 958 --- a/a
959 959 +++ b/a
960 960 @@ -1,1 +1,3 @@
961 961 a
962 962 +6
963 963 +a1
964 964
965 965 - working to branch: --rev 2
966 966 M a
967 967 R x/y
968 968
969 969 diff --git a/a b/a
970 970 --- a/a
971 971 +++ b/a
972 972 @@ -1,3 +1,3 @@
973 973 a
974 974 -m1
975 975 -m2
976 976 +6
977 977 +a1
978 978 diff --git a/x/y b/x/y
979 979 deleted file mode 100644
980 980 --- a/x/y
981 981 +++ /dev/null
982 982 @@ -1,1 +0,0 @@
983 983 -y1
984 984
985 985 - root to parent: --rev 0 --rev .
986 986 A b
987 987 a
988 988 R a
989 989
990 990 diff --git a/a b/b
991 991 rename from a
992 992 rename to b
993 993 --- a/a
994 994 +++ b/b
995 995 @@ -1,1 +1,3 @@
996 996 a
997 997 +6
998 998 +a1
999 999
1000 1000 - parent to root: --rev . --rev 0
1001 1001 A a
1002 1002 b
1003 1003 R b
1004 1004
1005 1005 diff --git a/b b/a
1006 1006 rename from b
1007 1007 rename to a
1008 1008 --- a/b
1009 1009 +++ b/a
1010 1010 @@ -1,3 +1,1 @@
1011 1011 a
1012 1012 -6
1013 1013 -a1
1014 1014
1015 1015 - branch to parent: --rev 2 --rev .
1016 1016 A b
1017 1017 a
1018 1018 R a
1019 1019 R x/y
1020 1020
1021 1021 diff --git a/a b/b
1022 1022 rename from a
1023 1023 rename to b
1024 1024 --- a/a
1025 1025 +++ b/b
1026 1026 @@ -1,3 +1,3 @@
1027 1027 a
1028 1028 -m1
1029 1029 -m2
1030 1030 +6
1031 1031 +a1
1032 1032 diff --git a/x/y b/x/y
1033 1033 deleted file mode 100644
1034 1034 --- a/x/y
1035 1035 +++ /dev/null
1036 1036 @@ -1,1 +0,0 @@
1037 1037 -y1
1038 1038
1039 1039 - parent to branch: --rev . --rev 2
1040 1040 A a
1041 1041 b
1042 1042 A x/y
1043 1043 R b
1044 1044
1045 1045 diff --git a/b b/a
1046 1046 rename from b
1047 1047 rename to a
1048 1048 --- a/b
1049 1049 +++ b/a
1050 1050 @@ -1,3 +1,3 @@
1051 1051 a
1052 1052 -6
1053 1053 -a1
1054 1054 +m1
1055 1055 +m2
1056 1056 diff --git a/x/y b/x/y
1057 1057 new file mode 100644
1058 1058 --- /dev/null
1059 1059 +++ b/x/y
1060 1060 @@ -0,0 +1,1 @@
1061 1061 +y1
1062 1062
1063 1063
1064 1064 updating to branch default
1065 1065 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1066 1066 created new head
1067 1067 moving x/x to y/x
1068 1068 ** directory move **
1069 1069 ** hg mv x y / add y/x x1 / add y/x x2
1070 1070 - working to parent:
1071 1071 M y/x
1072 1072
1073 1073 diff --git a/y/x b/y/x
1074 1074 --- a/y/x
1075 1075 +++ b/y/x
1076 1076 @@ -1,2 +1,3 @@
1077 1077 x
1078 1078 x1
1079 1079 +x2
1080 1080
1081 1081 - working to root: --rev 0
1082 1082 M a
1083 1083 A y/x
1084 1084 x/x
1085 1085 R x/x
1086 1086
1087 1087 diff --git a/a b/a
1088 1088 --- a/a
1089 1089 +++ b/a
1090 1090 @@ -1,1 +1,2 @@
1091 1091 a
1092 1092 +7
1093 1093 diff --git a/x/x b/y/x
1094 1094 rename from x/x
1095 1095 rename to y/x
1096 1096 --- a/x/x
1097 1097 +++ b/y/x
1098 1098 @@ -1,1 +1,3 @@
1099 1099 x
1100 1100 +x1
1101 1101 +x2
1102 1102
1103 1103 - working to branch: --rev 2
1104 1104 M a
1105 1105 A y/x
1106 1106 x/x
1107 1107 R x/x
1108 1108 R x/y
1109 1109
1110 1110 diff --git a/a b/a
1111 1111 --- a/a
1112 1112 +++ b/a
1113 1113 @@ -1,3 +1,2 @@
1114 1114 a
1115 1115 -m1
1116 1116 -m2
1117 1117 +7
1118 1118 diff --git a/x/y b/x/y
1119 1119 deleted file mode 100644
1120 1120 --- a/x/y
1121 1121 +++ /dev/null
1122 1122 @@ -1,1 +0,0 @@
1123 1123 -y1
1124 1124 diff --git a/x/x b/y/x
1125 1125 rename from x/x
1126 1126 rename to y/x
1127 1127 --- a/x/x
1128 1128 +++ b/y/x
1129 1129 @@ -1,1 +1,3 @@
1130 1130 x
1131 1131 +x1
1132 1132 +x2
1133 1133
1134 1134 - root to parent: --rev 0 --rev .
1135 1135 M a
1136 1136 A y/x
1137 1137 x/x
1138 1138 R x/x
1139 1139
1140 1140 diff --git a/a b/a
1141 1141 --- a/a
1142 1142 +++ b/a
1143 1143 @@ -1,1 +1,2 @@
1144 1144 a
1145 1145 +7
1146 1146 diff --git a/x/x b/y/x
1147 1147 rename from x/x
1148 1148 rename to y/x
1149 1149 --- a/x/x
1150 1150 +++ b/y/x
1151 1151 @@ -1,1 +1,2 @@
1152 1152 x
1153 1153 +x1
1154 1154
1155 1155 - parent to root: --rev . --rev 0
1156 1156 M a
1157 1157 A x/x
1158 1158 y/x
1159 1159 R y/x
1160 1160
1161 1161 diff --git a/a b/a
1162 1162 --- a/a
1163 1163 +++ b/a
1164 1164 @@ -1,2 +1,1 @@
1165 1165 a
1166 1166 -7
1167 1167 diff --git a/y/x b/x/x
1168 1168 rename from y/x
1169 1169 rename to x/x
1170 1170 --- a/y/x
1171 1171 +++ b/x/x
1172 1172 @@ -1,2 +1,1 @@
1173 1173 x
1174 1174 -x1
1175 1175
1176 1176 - branch to parent: --rev 2 --rev .
1177 1177 M a
1178 1178 A y/x
1179 1179 x/x
1180 1180 R x/x
1181 1181 R x/y
1182 1182
1183 1183 diff --git a/a b/a
1184 1184 --- a/a
1185 1185 +++ b/a
1186 1186 @@ -1,3 +1,2 @@
1187 1187 a
1188 1188 -m1
1189 1189 -m2
1190 1190 +7
1191 1191 diff --git a/x/y b/x/y
1192 1192 deleted file mode 100644
1193 1193 --- a/x/y
1194 1194 +++ /dev/null
1195 1195 @@ -1,1 +0,0 @@
1196 1196 -y1
1197 1197 diff --git a/x/x b/y/x
1198 1198 rename from x/x
1199 1199 rename to y/x
1200 1200 --- a/x/x
1201 1201 +++ b/y/x
1202 1202 @@ -1,1 +1,2 @@
1203 1203 x
1204 1204 +x1
1205 1205
1206 1206 - parent to branch: --rev . --rev 2
1207 1207 M a
1208 1208 A x/x
1209 1209 y/x
1210 1210 A x/y
1211 1211 R y/x
1212 1212
1213 1213 diff --git a/a b/a
1214 1214 --- a/a
1215 1215 +++ b/a
1216 1216 @@ -1,2 +1,3 @@
1217 1217 a
1218 1218 -7
1219 1219 +m1
1220 1220 +m2
1221 1221 diff --git a/y/x b/x/x
1222 1222 rename from y/x
1223 1223 rename to x/x
1224 1224 --- a/y/x
1225 1225 +++ b/x/x
1226 1226 @@ -1,2 +1,1 @@
1227 1227 x
1228 1228 -x1
1229 1229 diff --git a/x/y b/x/y
1230 1230 new file mode 100644
1231 1231 --- /dev/null
1232 1232 +++ b/x/y
1233 1233 @@ -0,0 +1,1 @@
1234 1234 +y1
1235 1235
1236 1236
1237 % testing copies with unrelated branch
1238 adding a
1239 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1240 adding a
1241 created new head
1242 % unrelated branch diff
1243 diff --git a/a b/a
1244 deleted file mode 100644
1245 --- a/a
1246 +++ /dev/null
1247 @@ -1,1 +0,0 @@
1248 -a
1249 diff --git a/b b/b
1250 new file mode 100644
1251 --- /dev/null
1252 +++ b/b
1253 @@ -0,0 +1,1 @@
1254 +a
General Comments 0
You need to be logged in to leave comments. Login now