[PATCH] merge: report all files in _checkunknown
Jordi Gutiérrez Hermoso
jordigh at octave.org
Fri Jan 13 12:53:11 CST 2012
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh at octave.org>
# Date 1326315222 18000
# Node ID 46d716242ad454d7959554aa4cee1f13cacd6d84
# Parent c47d69ce5208d5b5cfd2fb2f0f1d7a2b4795fbf5
merge: report all files in _checkunknown
When doing hg up, if there is a file conflict with untracked files,
currently only the first such conflict is reported. With this patch,
all of them are listed.
With this patch error message is now reported as
a: untracked file differs
b: untracked file differs
abort: untracked files in working directory conflict with files in
requested revision
instead of
abort: untracked file in working directory differs from file in
requested revision: 'a'
This is a follow up to an old attempt to do this here:
http://selenic.com/pipermail/mercurial-devel/2011-August/033625.html
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -81,7 +81,7 @@
self.mark(dfile, 'r')
return r
-def _checkunknown(wctx, mctx, folding):
+def _checkunknown(wctx, mctx, folding, repo):
"check for collisions between unknown files and files in mctx"
if folding:
foldf = util.normcase
@@ -90,11 +90,16 @@
folded = {}
for fn in mctx:
folded[foldf(fn)] = fn
+
+ error = False
for fn in wctx.unknown():
f = foldf(fn)
if f in folded and mctx[folded[f]].cmp(wctx[f]):
- raise util.Abort(_("untracked file in working directory differs"
- " from file in requested revision: '%s'") % fn)
+ error = True
+ repo.ui.warn(_("%s: untracked file differs\n") % fn)
+ if error:
+ raise util.Abort(_("untracked files in working directory conflict "
+ "with files in requested revision"))
def _checkcollision(mctx, wctx):
"check for case folding collisions in the destination context"
@@ -557,7 +562,7 @@
wc.status(unknown=True) # prime cache
folding = not util.checkcase(repo.path)
if not force:
- _checkunknown(wc, p2, folding)
+ _checkunknown(wc, p2, folding, repo)
if folding:
_checkcollision(p2, branchmerge and p1)
action += _forgetremoved(wc, p2, branchmerge)
More information about the Mercurial-devel
mailing list