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