Mercurial > public > mercurial-scm > hg-stable
diff mercurial/merge.py @ 27137:25e4b2f000c5
merge: move almost all change/delete conflicts to resolve phase (BC) (API)
We have finally laid all the groundwork to make this happen.
The only change/delete conflicts that haven't been moved are .hgsubstate
conflicts. Those are trickier to deal with and well outside the scope of this
series.
We add comprehensive testing not just for the initial selections but also for
re-resolves and all possible dirstate transitions caused by merge tools. That
testing managed to shake out several bugs in the way we were handling dirstate
transitions.
The other test changes are because we now treat change/delete conflicts as
proper merges, and increment the 'merged' counter rather than the 'updated'
counter. I believe this is the right approach here.
For third-party extensions, if they're interacting with filemerge code they
might have to deal with an absentfilectx rather than a regular filectx.
Still to come:
- add a 'leave unresolved' option to merges
- change the default for non-interactive change/delete conflicts to be 'leave
unresolved'
- add debug output to go alongside debug outputs for binary and symlink file
merges
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 25 Nov 2015 14:25:33 -0800 |
parents | baa7571f40c5 |
children | d6859d86a5d5 |
line wrap: on
line diff
--- a/mercurial/merge.py Wed Nov 25 14:26:46 2015 -0800 +++ b/mercurial/merge.py Wed Nov 25 14:25:33 2015 -0800 @@ -997,8 +997,11 @@ for m, l in actions.items(): l.sort() - # prescan for merges - for f, args, msg in actions['m']: + # 'cd' and 'dc' actions are treated like other merge conflicts + mergeactions = sorted(actions['cd']) + mergeactions.extend(sorted(actions['dc'])) + mergeactions.extend(actions['m']) + for f, args, msg in mergeactions: f1, f2, fa, move, anc = args if f == '.hgsubstate': # merged internally continue @@ -1111,7 +1114,6 @@ util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags) updated += 1 - mergeactions = actions['m'] # the ordering is important here -- ms.mergedriver will raise if the merge # driver has changed, and we want to be able to bypass it when overwrite is # True @@ -1419,8 +1421,12 @@ else: _checkcollision(repo, wc.manifest(), actions) - # Prompt and create actions. TODO: Move this towards resolve phase. + # Prompt and create actions. Most of this is in the resolve phase + # already, but we can't handle .hgsubstate in filemerge or + # subrepo.submerge yet so we have to keep prompting for it. for f, args, msg in sorted(actions['cd']): + if f != '.hgsubstate': + continue if repo.ui.promptchoice( _("local changed %s which remote deleted\n" "use (c)hanged version or (d)elete?" @@ -1432,6 +1438,8 @@ actions['a'].append((f, None, "prompt keep")) for f, args, msg in sorted(actions['dc']): + if f != '.hgsubstate': + continue f1, f2, fa, move, anc = args flags = p2[f2].flags() if repo.ui.promptchoice(