##// 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 def manifestmerge(repo, p1, p2, pa, bran
224 224 m1['.hgsubstate'] += "+"
225 225 break
226 226
227 prompts = []
227 aborts, prompts = [], []
228 228 # Compare manifests
229 229 for f, n in m1.iteritems():
230 230 if partial and not partial(f):
@@ -285,15 +285,40 def manifestmerge(repo, p1, p2, pa, bran
285 285 actions.append((f2, "m", (f, f, True),
286 286 "remote moved to " + f))
287 287 elif f not in ma:
288 if (not overwrite
289 and _checkunknownfile(repo, p1, p2, f)):
288 # local unknown, remote created: the logic is described by the
289 # following table:
290 #
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"))
302 else:
303 different = _checkunknownfile(repo, p1, p2, f)
304 if force and branchmerge and different:
290 305 actions.append((f, "m", (f, f, False),
291 306 "remote differs from untracked local"))
307 elif not force and different:
308 aborts.append((f, "ud"))
292 309 else:
293 310 actions.append((f, "g", (m2.flags(f),), "remote created"))
294 311 elif n != ma[f]:
295 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 322 for f, m in sorted(prompts):
298 323 if m == "cd":
299 324 if repo.ui.promptchoice(
@@ -447,8 +472,6 def calculateupdates(repo, tctx, mctx, a
447 472 _checkcollision(mctx, None)
448 473 else:
449 474 _checkcollision(mctx, (tctx, ancestor))
450 if not force:
451 _checkunknown(repo, tctx, mctx)
452 475 if tctx.rev() is None:
453 476 actions += _forgetremoved(tctx, mctx, branchmerge)
454 477 actions += manifestmerge(repo, tctx, mctx,
General Comments 0
You need to be logged in to leave comments. Login now