##// END OF EJS Templates
merge: unify merge and copy actions
Matt Mackall -
r3308:ecc1bf27 default
parent child Browse files
Show More
@@ -210,7 +210,7 b' def manifestmerge(repo, p1, p2, pa, over'
210 210 a = ma.get(f, nullid)
211 211 # are both different from the ancestor?
212 212 if not overwrite and n != a and m2[f] != a:
213 act("versions differ", "m", f, fmerge(f))
213 act("versions differ", "m", f, f, f, fmerge(f), False)
214 214 # are we clobbering?
215 215 # is remote's version newer?
216 216 # or are we going back in time and clean?
@@ -226,14 +226,13 b' def manifestmerge(repo, p1, p2, pa, over'
226 226 elif f in copy:
227 227 f2 = copy[f]
228 228 if f in ma: # case 3,20 A/B/A
229 act("remote moved", "c",
230 f, f2, f2, fmerge(f, f2, f), True)
229 act("remote moved", "m", f, f2, f2, fmerge(f, f2, f), True)
231 230 else:
232 231 if f2 in m1: # case 2 A,B/B/B
233 act("local copied", "c",
232 act("local copied", "m",
234 233 f, f2, f, fmerge(f, f2, f2), False)
235 234 else: # case 4,21 A/B/B
236 act("local moved", "c",
235 act("local moved", "m",
237 236 f, f2, f, fmerge(f, f2, f2), False)
238 237 elif f in ma:
239 238 if n != ma[f] and not overwrite:
@@ -258,7 +257,7 b' def manifestmerge(repo, p1, p2, pa, over'
258 257 if f2 not in m2: # already seen
259 258 continue
260 259 # rename case 1, A/A,B/A
261 act("remote copied", "c", f2, f, f, fmerge(f2, f, f2), False)
260 act("remote copied", "m", f2, f, f, fmerge(f2, f, f2), False)
262 261 elif f in ma:
263 262 if overwrite or backwards:
264 263 act("recreating", "g", f, m2.execf(f))
@@ -289,20 +288,16 b' def applyupdates(repo, action, wctx, mct'
289 288 repo.ui.warn(_("update failed to remove %s: %s!\n") %
290 289 (f, inst.strerror))
291 290 removed +=1
292 elif m == "c": # copy
291 elif m == "m": # merge
293 292 f2, fd, flag, move = a[2:]
294 repo.ui.status(_("merging %s and %s to %s\n") % (f, f2, fd))
293 if f != f2:
294 repo.ui.status(_("merging %s and %s to %s\n") % (f, f2, fd))
295 else:
296 repo.ui.status(_("merging %s\n") % f)
295 297 if filemerge(repo, f, f2, fd, wctx, mctx, move):
296 298 unresolved += 1
297 299 util.set_exec(repo.wjoin(fd), flag)
298 300 merged += 1
299 elif m == "m": # merge
300 flag = a[2]
301 repo.ui.status(_("merging %s\n") % f)
302 if filemerge(repo, f, f, f, wctx, mctx, False):
303 unresolved += 1
304 util.set_exec(repo.wjoin(f), flag)
305 merged += 1
306 301 elif m == "g": # get
307 302 flag = a[2]
308 303 repo.ui.note(_("getting %s\n") % f)
@@ -332,21 +327,6 b' def recordupdates(repo, action, branchme'
332 327 else:
333 328 repo.dirstate.update([f], 'n')
334 329 elif m == "m": # merge
335 flag = a[2]
336 if branchmerge:
337 # We've done a branch merge, mark this file as merged
338 # so that we properly record the merger later
339 repo.dirstate.update([f], 'm')
340 else:
341 # We've update-merged a locally modified file, so
342 # we set the dirstate to emulate a normal checkout
343 # of that file some time in the past. Thus our
344 # merge will appear as a normal local file
345 # modification.
346 fl = repo.file(f)
347 f_len = mctx.filectx(f).size()
348 repo.dirstate.update([f], 'n', st_size=f_len, st_mtime=-1)
349 elif m == "c": # copy
350 330 f2, fd, flag, move = a[2:]
351 331 if branchmerge:
352 332 # We've done a branch merge, mark this file as merged
@@ -358,15 +338,15 b' def recordupdates(repo, action, branchme'
358 338 # of that file some time in the past. Thus our
359 339 # merge will appear as a normal local file
360 340 # modification.
361 fl = repo.file(f)
362 341 f_len = mctx.filectx(f).size()
363 342 repo.dirstate.update([fd], 'n', st_size=f_len, st_mtime=-1)
364 if move:
365 repo.dirstate.update([f], 'r')
366 if f != fd:
367 repo.dirstate.copy(f, fd)
368 else:
369 repo.dirstate.copy(f2, fd)
343 if f != f2: # copy/rename
344 if move:
345 repo.dirstate.update([f], 'r')
346 if f != fd:
347 repo.dirstate.copy(f, fd)
348 else:
349 repo.dirstate.copy(f2, fd)
370 350
371 351 def update(repo, node, branchmerge=False, force=False, partial=None,
372 352 wlock=None, show_stats=True, remind=True):
@@ -4,7 +4,7 b' merge'
4 4 resolving manifests
5 5 overwrite None branchmerge True partial False
6 6 ancestor f26ec4fc3fa3 local 8e765a822af2 remote af1939970a1c
7 a: remote moved -> c
7 a: remote moved -> m
8 8 b2: remote created -> g
9 9 merging a and b to b
10 10 resolving a
@@ -5,7 +5,7 b' resolving manifests'
5 5 overwrite None branchmerge True partial False
6 6 ancestor e300d1c794ec local 735846fee2d7 remote 924404dff337
7 7 rev: versions differ -> m
8 a: remote copied -> c
8 a: remote copied -> m
9 9 merging a and b to b
10 10 resolving a
11 11 my a@. other b@735846fee2d7 ancestor a@924404dff337
@@ -28,7 +28,7 b' resolving manifests'
28 28 overwrite None branchmerge True partial False
29 29 ancestor ac809aeed39a local f4db7e329e71 remote 924404dff337
30 30 a: remote is newer -> g
31 b: local copied -> c
31 b: local copied -> m
32 32 rev: versions differ -> m
33 33 getting a
34 34 merging b and a to b
@@ -51,7 +51,7 b' test L:up a R:nm a b W: - 3 get'
51 51 resolving manifests
52 52 overwrite None branchmerge True partial False
53 53 ancestor e300d1c794ec local e03727d2d66b remote 924404dff337
54 a: remote moved -> c
54 a: remote moved -> m
55 55 rev: versions differ -> m
56 56 merging a and b to b
57 57 resolving a
@@ -74,7 +74,7 b' test L:nm a b R:up a W: - 4 get'
74 74 resolving manifests
75 75 overwrite None branchmerge True partial False
76 76 ancestor ecf3cb2a4219 local f4db7e329e71 remote 924404dff337
77 b: local moved -> c
77 b: local moved -> m
78 78 rev: versions differ -> m
79 79 merging b and a to b
80 80 resolving b
@@ -96,7 +96,7 b' resolving manifests'
96 96 overwrite None branchmerge True partial False
97 97 ancestor 94b33a1b7f2d local 735846fee2d7 remote 924404dff337
98 98 rev: versions differ -> m
99 a: remote copied -> c
99 a: remote copied -> m
100 100 merging a and b to b
101 101 resolving a
102 102 my a@. other b@735846fee2d7 ancestor a@924404dff337
@@ -118,7 +118,7 b' test L:nc a b R: W: - 6 not'
118 118 resolving manifests
119 119 overwrite None branchmerge True partial False
120 120 ancestor ac809aeed39a local 97c705ade336 remote 924404dff337
121 b: local copied -> c
121 b: local copied -> m
122 122 rev: versions differ -> m
123 123 merging b and a to b
124 124 resolving b
@@ -140,7 +140,7 b' test L: R:nm a b W: - 7 get'
140 140 resolving manifests
141 141 overwrite None branchmerge True partial False
142 142 ancestor 94b33a1b7f2d local e03727d2d66b remote 924404dff337
143 a: remote moved -> c
143 a: remote moved -> m
144 144 rev: versions differ -> m
145 145 merging a and b to b
146 146 resolving a
@@ -163,7 +163,7 b' test L:nm a b R: W: - 8 not'
163 163 resolving manifests
164 164 overwrite None branchmerge True partial False
165 165 ancestor ecf3cb2a4219 local 97c705ade336 remote 924404dff337
166 b: local moved -> c
166 b: local moved -> m
167 167 rev: versions differ -> m
168 168 merging b and a to b
169 169 resolving b
@@ -399,7 +399,7 b' test L:up a R:um a b W: - 20 mer'
399 399 resolving manifests
400 400 overwrite None branchmerge True partial False
401 401 ancestor e300d1c794ec local 79cc6877a3b7 remote 924404dff337
402 a: remote moved -> c
402 a: remote moved -> m
403 403 rev: versions differ -> m
404 404 merging a and b to b
405 405 resolving a
@@ -422,7 +422,7 b' test L:um a b R:up a W: - 21 mer'
422 422 resolving manifests
423 423 overwrite None branchmerge True partial False
424 424 ancestor ec03c2ca8642 local f4db7e329e71 remote 924404dff337
425 b: local moved -> c
425 b: local moved -> m
426 426 rev: versions differ -> m
427 427 merging b and a to b
428 428 resolving b
@@ -443,7 +443,7 b' test L:nm a b R:up a c W: - 23 get'
443 443 resolving manifests
444 444 overwrite None branchmerge True partial False
445 445 ancestor ecf3cb2a4219 local 2b958612230f remote 924404dff337
446 b: local moved -> c
446 b: local moved -> m
447 447 rev: versions differ -> m
448 448 c: remote created -> g
449 449 merging b and a to b
General Comments 0
You need to be logged in to leave comments. Login now