Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 27655:af13eaf9ab8c
merge: add a new 'backup' argument to get actions
We're going to use this in an upcoming patch to back untracked files up when
they're replaced by tracked ones.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Sat, 02 Jan 2016 03:02:57 -0800 |
parents | 95dc67f10239 |
children | 57c0d4888ca8 |
comparison
equal
deleted
inserted
replaced
27654:95dc67f10239 | 27655:af13eaf9ab8c |
---|---|
586 raise error.Abort(_("untracked files in working directory differ " | 586 raise error.Abort(_("untracked files in working directory differ " |
587 "from files in requested revision")) | 587 "from files in requested revision")) |
588 | 588 |
589 for f, (m, args, msg) in actions.iteritems(): | 589 for f, (m, args, msg) in actions.iteritems(): |
590 if m == 'c': | 590 if m == 'c': |
591 actions[f] = ('g', args, msg) | 591 flags, = args |
592 actions[f] = ('g', (flags, False), msg) | |
592 elif m == 'cm': | 593 elif m == 'cm': |
593 fl2, anc = args | 594 fl2, anc = args |
594 different = _checkunknownfile(repo, wctx, mctx, f) | 595 different = _checkunknownfile(repo, wctx, mctx, f) |
595 if different: | 596 if different: |
596 actions[f] = ('m', (f, f, None, False, anc), | 597 actions[f] = ('m', (f, f, None, False, anc), |
597 "remote differs from untracked local") | 598 "remote differs from untracked local") |
598 else: | 599 else: |
599 actions[f] = ('g', (fl2,), "remote created") | 600 actions[f] = ('g', (fl2, False), "remote created") |
600 | 601 |
601 def _forgetremoved(wctx, mctx, branchmerge): | 602 def _forgetremoved(wctx, mctx, branchmerge): |
602 """ | 603 """ |
603 Forget removed files | 604 Forget removed files |
604 | 605 |
746 actions[f] = ('k' , (), "remote unchanged") | 747 actions[f] = ('k' , (), "remote unchanged") |
747 elif n1 == a and fl1 == fla: # local unchanged - use remote | 748 elif n1 == a and fl1 == fla: # local unchanged - use remote |
748 if n1 == n2: # optimization: keep local content | 749 if n1 == n2: # optimization: keep local content |
749 actions[f] = ('e', (fl2,), "update permissions") | 750 actions[f] = ('e', (fl2,), "update permissions") |
750 else: | 751 else: |
751 actions[f] = ('g', (fl2,), "remote is newer") | 752 actions[f] = ('g', (fl2, False), "remote is newer") |
752 elif nol and n2 == a: # remote only changed 'x' | 753 elif nol and n2 == a: # remote only changed 'x' |
753 actions[f] = ('e', (fl2,), "update permissions") | 754 actions[f] = ('e', (fl2,), "update permissions") |
754 elif nol and n1 == a: # local only changed 'x' | 755 elif nol and n1 == a: # local only changed 'x' |
755 actions[f] = ('g', (fl1,), "remote is newer") | 756 actions[f] = ('g', (fl1, False), "remote is newer") |
756 else: # both changed something | 757 else: # both changed something |
757 actions[f] = ('m', (f, f, f, False, pa.node()), | 758 actions[f] = ('m', (f, f, f, False, pa.node()), |
758 "versions differ") | 759 "versions differ") |
759 elif n1: # file exists only on local side | 760 elif n1: # file exists only on local side |
760 if f in copied: | 761 if f in copied: |
1457 flags = p2[f2].flags() | 1458 flags = p2[f2].flags() |
1458 if repo.ui.promptchoice( | 1459 if repo.ui.promptchoice( |
1459 _("remote changed %s which local deleted\n" | 1460 _("remote changed %s which local deleted\n" |
1460 "use (c)hanged version or leave (d)eleted?" | 1461 "use (c)hanged version or leave (d)eleted?" |
1461 "$$ &Changed $$ &Deleted") % f, 0) == 0: | 1462 "$$ &Changed $$ &Deleted") % f, 0) == 0: |
1462 actions['g'].append((f, (flags,), "prompt recreating")) | 1463 actions['g'].append((f, (flags, False), "prompt recreating")) |
1463 | 1464 |
1464 # divergent renames | 1465 # divergent renames |
1465 for f, fl in sorted(diverge.iteritems()): | 1466 for f, fl in sorted(diverge.iteritems()): |
1466 repo.ui.warn(_("note: possible conflict - %s was renamed " | 1467 repo.ui.warn(_("note: possible conflict - %s was renamed " |
1467 "multiple times to:\n") % f) | 1468 "multiple times to:\n") % f) |