##// END OF EJS Templates
manifestmerge: handle abort on local unknown, remote created files...
Siddharth Agarwal -
r18606:95773237 default
parent child Browse files
Show More
@@ -224,7 +224,7 b' def manifestmerge(repo, p1, p2, pa, bran'
224 m1['.hgsubstate'] += "+"
224 m1['.hgsubstate'] += "+"
225 break
225 break
226
226
227 prompts = []
227 aborts, prompts = [], []
228 # Compare manifests
228 # Compare manifests
229 for f, n in m1.iteritems():
229 for f, n in m1.iteritems():
230 if partial and not partial(f):
230 if partial and not partial(f):
@@ -285,15 +285,40 b' def manifestmerge(repo, p1, p2, pa, bran'
285 actions.append((f2, "m", (f, f, True),
285 actions.append((f2, "m", (f, f, True),
286 "remote moved to " + f))
286 "remote moved to " + f))
287 elif f not in ma:
287 elif f not in ma:
288 if (not overwrite
288 # local unknown, remote created: the logic is described by the
289 and _checkunknownfile(repo, p1, p2, f)):
289 # following table:
290 actions.append((f, "m", (f, f, False),
290 #
291 "remote differs from untracked local"))
291 # force branchmerge different | action
292 # n * n | get
293 # n * y | abort
294 # y n * | get
295 # y y n | get
296 # y y y | merge
297 #
298 # Checking whether the files are different is expensive, so we
299 # don't do that when we can avoid it.
300 if force and not branchmerge:
301 actions.append((f, "g", (m2.flags(f),), "remote created"))
292 else:
302 else:
293 actions.append((f, "g", (m2.flags(f),), "remote created"))
303 different = _checkunknownfile(repo, p1, p2, f)
304 if force and branchmerge and different:
305 actions.append((f, "m", (f, f, False),
306 "remote differs from untracked local"))
307 elif not force and different:
308 aborts.append((f, "ud"))
309 else:
310 actions.append((f, "g", (m2.flags(f),), "remote created"))
294 elif n != ma[f]:
311 elif n != ma[f]:
295 prompts.append((f, "dc")) # prompt deleted/changed
312 prompts.append((f, "dc")) # prompt deleted/changed
296
313
314 for f, m in sorted(aborts):
315 if m == "ud":
316 repo.ui.warn(_("%s: untracked file differs\n") % f)
317 else: assert False, m
318 if aborts:
319 raise util.Abort(_("untracked files in working directory differ "
320 "from files in requested revision"))
321
297 for f, m in sorted(prompts):
322 for f, m in sorted(prompts):
298 if m == "cd":
323 if m == "cd":
299 if repo.ui.promptchoice(
324 if repo.ui.promptchoice(
@@ -447,8 +472,6 b' def calculateupdates(repo, tctx, mctx, a'
447 _checkcollision(mctx, None)
472 _checkcollision(mctx, None)
448 else:
473 else:
449 _checkcollision(mctx, (tctx, ancestor))
474 _checkcollision(mctx, (tctx, ancestor))
450 if not force:
451 _checkunknown(repo, tctx, mctx)
452 if tctx.rev() is None:
475 if tctx.rev() is None:
453 actions += _forgetremoved(tctx, mctx, branchmerge)
476 actions += _forgetremoved(tctx, mctx, branchmerge)
454 actions += manifestmerge(repo, tctx, mctx,
477 actions += manifestmerge(repo, tctx, mctx,
General Comments 0
You need to be logged in to leave comments. Login now