Mercurial > hg-stable
changeset 27741:3951f132958f
merge: determine what untracked conflicts cause warns and aborts separately
This is written in a somewhat weird style, but it's designed for code reuse in
an upcoming patch.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 12 Jan 2016 18:17:07 -0800 |
parents | da5634e1b8a3 |
children | 6b639caa1652 |
files | mercurial/merge.py |
diffstat | 1 files changed, 17 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/merge.py Tue Jan 12 18:12:35 2016 -0800 +++ b/mercurial/merge.py Tue Jan 12 18:17:07 2016 -0800 @@ -583,6 +583,14 @@ """ conflicts = set() if not force: + abortconflicts = set() + warnconflicts = set() + def collectconflicts(conflicts, config): + if config == 'abort': + abortconflicts.update(conflicts) + elif config == 'warn': + warnconflicts.update(conflicts) + config = _getcheckunknownconfig(repo, 'merge', 'checkunknown') for f, (m, args, msg) in actions.iteritems(): if m in ('c', 'dc'): @@ -592,15 +600,15 @@ if _checkunknownfile(repo, wctx, mctx, f, args[0]): conflicts.add(f) - if config == 'abort': - for f in sorted(conflicts): - repo.ui.warn(_("%s: untracked file differs\n") % f) - if conflicts: - raise error.Abort(_("untracked files in working directory " - "differ from files in requested revision")) - elif config == 'warn': - for f in sorted(conflicts): - repo.ui.warn(_("%s: replacing untracked file\n") % f) + collectconflicts(conflicts, config) + 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