##// END OF EJS Templates
merge: branch code into {n1 and n2, n1, n2} top-level cases...
Martin von Zweigbergk -
r23473:922b10c8 default
parent child Browse files
Show More
@@ -414,7 +414,7 b' def manifestmerge(repo, wctx, p2, pa, br'
414 414 for f, ((n1, fl1), (n2, fl2)) in diff.iteritems():
415 415 if partial and not partial(f):
416 416 continue
417 if n1 and n2:
417 if n1 and n2: # file exists on both local and remote side
418 418 if f not in ma:
419 419 fa = copy.get(f, None)
420 420 if fa is not None:
@@ -443,72 +443,76 b' def manifestmerge(repo, wctx, p2, pa, br'
443 443 "versions differ"))
444 444 elif f in copied: # files we'll deal with on m2 side
445 445 pass
446 elif n1 and f in movewithdir: # directory rename, move local
447 f2 = movewithdir[f]
448 actions['dm'].append((f2, (f, fl1),
449 "remote directory rename - move from " + f))
450 elif n1 and f in copy:
451 f2 = copy[f]
452 actions['m'].append((f, (f, f2, f2, False, pa.node()),
453 "local copied/moved from " + f2))
454 elif n1 and f in ma: # clean, a different, no remote
455 if n1 != ma[f]:
456 if acceptremote:
457 actions['r'].append((f, None, "remote delete"))
446 elif n1: # file exists only on local side
447 if f in movewithdir: # directory rename, move local
448 f2 = movewithdir[f]
449 actions['dm'].append((f2, (f, fl1),
450 "remote directory rename - move from " + f))
451 elif f in copy:
452 f2 = copy[f]
453 actions['m'].append((f, (f, f2, f2, False, pa.node()),
454 "local copied/moved from " + f2))
455 elif f in ma: # clean, a different, no remote
456 if n1 != ma[f]:
457 if acceptremote:
458 actions['r'].append((f, None, "remote delete"))
459 else:
460 actions['cd'].append((f, None,
461 "prompt changed/deleted"))
462 elif n1[20:] == 'a':
463 # This extra 'a' is added by working copy manifest to mark
464 # the file as locally added. We should forget it instead of
465 # deleting it.
466 actions['f'].append((f, None, "remote deleted"))
458 467 else:
459 actions['cd'].append((f, None, "prompt changed/deleted"))
460 elif n1[20:] == 'a':
461 # This extra 'a' is added by working copy manifest to mark the
462 # file as locally added. We should forget it instead of
463 # deleting it.
464 actions['f'].append((f, None, "remote deleted"))
465 else:
466 actions['r'].append((f, None, "other deleted"))
467 elif n2 and f in movewithdir:
468 f2 = movewithdir[f]
469 actions['dg'].append((f2, (f, fl2),
470 "local directory rename - get from " + f))
471 elif n2 and f in copy:
472 f2 = copy[f]
473 if f2 in m2:
474 actions['m'].append((f, (f2, f, f2, False, pa.node()),
475 "remote copied from " + f2))
476 else:
477 actions['m'].append((f, (f2, f, f2, True, pa.node()),
478 "remote moved from " + f2))
479 elif n2 and f not in ma:
480 # local unknown, remote created: the logic is described by the
481 # following table:
482 #
483 # force branchmerge different | action
484 # n * n | get
485 # n * y | abort
486 # y n * | get
487 # y y n | get
488 # y y y | merge
489 #
490 # Checking whether the files are different is expensive, so we
491 # don't do that when we can avoid it.
492 if force and not branchmerge:
493 actions['g'].append((f, (fl2,), "remote created"))
494 else:
468 actions['r'].append((f, None, "other deleted"))
469 elif n2: # file exists only on remote side
470 if f in movewithdir:
471 f2 = movewithdir[f]
472 actions['dg'].append((f2, (f, fl2),
473 "local directory rename - get from " + f))
474 elif f in copy:
475 f2 = copy[f]
476 if f2 in m2:
477 actions['m'].append((f, (f2, f, f2, False, pa.node()),
478 "remote copied from " + f2))
479 else:
480 actions['m'].append((f, (f2, f, f2, True, pa.node()),
481 "remote moved from " + f2))
482 elif f not in ma:
483 # local unknown, remote created: the logic is described by the
484 # following table:
485 #
486 # force branchmerge different | action
487 # n * n | get
488 # n * y | abort
489 # y n * | get
490 # y y n | get
491 # y y y | merge
492 #
493 # Checking whether the files are different is expensive, so we
494 # don't do that when we can avoid it.
495 if force and not branchmerge:
496 actions['g'].append((f, (fl2,), "remote created"))
497 else:
498 different = _checkunknownfile(repo, wctx, p2, f)
499 if force and branchmerge and different:
500 actions['m'].append((f, (f, f, None, False, pa.node()),
501 "remote differs from untracked local"))
502 elif not force and different:
503 aborts.append((f, 'ud'))
504 else:
505 actions['g'].append((f, (fl2,), "remote created"))
506 elif n2 != ma[f]:
495 507 different = _checkunknownfile(repo, wctx, p2, f)
496 if force and branchmerge and different:
497 actions['m'].append((f, (f, f, None, False, pa.node()),
498 "remote differs from untracked local"))
499 elif not force and different:
508 if not force and different:
500 509 aborts.append((f, 'ud'))
501 510 else:
502 actions['g'].append((f, (fl2,), "remote created"))
503 elif n2 and n2 != ma[f]:
504 different = _checkunknownfile(repo, wctx, p2, f)
505 if not force and different:
506 aborts.append((f, 'ud'))
507 else:
508 if acceptremote:
509 actions['g'].append((f, (fl2,), "remote recreating"))
510 else:
511 actions['dc'].append((f, (fl2,), "prompt deleted/changed"))
511 if acceptremote:
512 actions['g'].append((f, (fl2,), "remote recreating"))
513 else:
514 actions['dc'].append((f, (fl2,),
515 "prompt deleted/changed"))
512 516
513 517 for f, m in sorted(aborts):
514 518 if m == 'ud':
General Comments 0
You need to be logged in to leave comments. Login now