Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 23654:9d56be47b5d6
merge: create 'cm' action for 'get or merge' case
We still have one case of a call to _checkunknownfile() in
manifestmerge(): when force=True and branchmerge=True and the remote
side has a file that the local side doesn't. This combination of
arguments is used by 'hg merge --force', but also by rebase and
unshelve. In this scenario, we try to create the file from the
contents from the remote, but if there is already a local untracked
file in place, we merge it instead.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 15 Dec 2014 16:45:19 -0800 |
parents | 0297d8469350 |
children | 79235b46062c |
comparison
equal
deleted
inserted
replaced
23653:0297d8469350 | 23654:9d56be47b5d6 |
---|---|
499 if not force: | 499 if not force: |
500 actions[f] = ('c', (fl2,), "remote created") | 500 actions[f] = ('c', (fl2,), "remote created") |
501 elif not branchmerge: | 501 elif not branchmerge: |
502 actions[f] = ('c', (fl2,), "remote created") | 502 actions[f] = ('c', (fl2,), "remote created") |
503 else: | 503 else: |
504 different = _checkunknownfile(repo, wctx, p2, f) | 504 actions[f] = ('cm', (fl2, pa.node()), |
505 if different: | 505 "remote created, get or merge") |
506 actions[f] = ('m', (f, f, None, False, pa.node()), | |
507 "remote differs from untracked local") | |
508 else: | |
509 actions[f] = ('g', (fl2,), "remote created") | |
510 elif n2 != ma[f]: | 506 elif n2 != ma[f]: |
511 if acceptremote: | 507 if acceptremote: |
512 actions[f] = ('c', (fl2,), "remote recreating") | 508 actions[f] = ('c', (fl2,), "remote recreating") |
513 else: | 509 else: |
514 actions[f] = ('dc', (fl2,), "prompt deleted/changed") | 510 actions[f] = ('dc', (fl2,), "prompt deleted/changed") |
530 "from files in requested revision")) | 526 "from files in requested revision")) |
531 | 527 |
532 for f, (m, args, msg) in actions.iteritems(): | 528 for f, (m, args, msg) in actions.iteritems(): |
533 if m == 'c': | 529 if m == 'c': |
534 actions[f] = ('g', args, msg) | 530 actions[f] = ('g', args, msg) |
531 elif m == 'cm': | |
532 fl2, anc = args | |
533 different = _checkunknownfile(repo, wctx, p2, f) | |
534 if different: | |
535 actions[f] = ('m', (f, f, None, False, anc), | |
536 "remote differs from untracked local") | |
537 else: | |
538 actions[f] = ('g', (fl2,), "remote created") | |
535 | 539 |
536 return actions, diverge, renamedelete | 540 return actions, diverge, renamedelete |
537 | 541 |
538 def _resolvetrivial(repo, wctx, mctx, ancestor, actions): | 542 def _resolvetrivial(repo, wctx, mctx, ancestor, actions): |
539 """Resolves false conflicts where the nodeid changed but the content | 543 """Resolves false conflicts where the nodeid changed but the content |