merge: move abort/warn checks up to the top level of _checkunknownfiles
In upcoming patches, we're also going to do these checks when force is True.
--- a/mercurial/merge.py Fri Feb 05 21:09:32 2016 -0800
+++ b/mercurial/merge.py Mon Feb 01 20:28:32 2016 -0800
@@ -610,17 +610,17 @@
choose a different action.
"""
conflicts = set()
+ warnconflicts = set()
+ abortconflicts = set()
+ unknownconfig = _getcheckunknownconfig(repo, 'merge', 'checkunknown')
+ ignoredconfig = _getcheckunknownconfig(repo, 'merge', 'checkignored')
if not force:
- abortconflicts = set()
- warnconflicts = set()
def collectconflicts(conflicts, config):
if config == 'abort':
abortconflicts.update(conflicts)
elif config == 'warn':
warnconflicts.update(conflicts)
- unknownconfig = _getcheckunknownconfig(repo, 'merge', 'checkunknown')
- ignoredconfig = _getcheckunknownconfig(repo, 'merge', 'checkignored')
for f, (m, args, msg) in actions.iteritems():
if m in ('c', 'dc'):
if _checkunknownfile(repo, wctx, mctx, f):
@@ -634,14 +634,15 @@
unknownconflicts = conflicts - ignoredconflicts
collectconflicts(ignoredconflicts, ignoredconfig)
collectconflicts(unknownconflicts, unknownconfig)
- for f in sorted(abortconflicts):
- repo.ui.warn(_("%s: untracked file differs\n") % f)
- if abortconflicts:
- raise error.Abort(_("untracked files in working directory "
- "differ from files in requested revision"))
- for f in sorted(warnconflicts):
- repo.ui.warn(_("%s: replacing untracked file\n") % f)
+ for f in sorted(abortconflicts):
+ repo.ui.warn(_("%s: untracked file differs\n") % f)
+ if abortconflicts:
+ raise error.Abort(_("untracked files in working directory "
+ "differ from files in requested revision"))
+
+ for f in sorted(warnconflicts):
+ repo.ui.warn(_("%s: replacing untracked file\n") % f)
for f, (m, args, msg) in actions.iteritems():
backup = f in conflicts