D782: merge: improve error messages for path conflicts during update
mbthomas (Mark Thomas)
phabricator at mercurial-scm.org
Fri Sep 22 09:28:45 UTC 2017
mbthomas created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D782
AFFECTED FILES
mercurial/merge.py
tests/test-merge1.t
tests/test-pathconflicts-basic.t
tests/test-update-names.t
CHANGE DETAILS
diff --git a/tests/test-update-names.t b/tests/test-update-names.t
--- a/tests/test-update-names.t
+++ b/tests/test-update-names.t
@@ -50,7 +50,7 @@
$ hg st
? name/file
$ hg up 1
- name: untracked file differs
+ name: untracked directory conflicts with file
abort: untracked files in working directory differ from files in requested revision
[255]
$ cd ..
diff --git a/tests/test-pathconflicts-basic.t b/tests/test-pathconflicts-basic.t
--- a/tests/test-pathconflicts-basic.t
+++ b/tests/test-pathconflicts-basic.t
@@ -37,7 +37,7 @@
$ mkdir a
$ echo 3 > a/b
$ hg up file
- a: untracked file differs
+ a: untracked directory conflicts with file
abort: untracked files in working directory differ from files in requested revision
[255]
$ hg up --clean file
diff --git a/tests/test-merge1.t b/tests/test-merge1.t
--- a/tests/test-merge1.t
+++ b/tests/test-merge1.t
@@ -30,7 +30,7 @@
$ mkdir b && touch b/nonempty
$ hg up
- b: untracked file differs
+ b: untracked directory conflicts with file
abort: untracked files in working directory differ from files in requested revision
[255]
$ hg ci
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -738,13 +738,24 @@
actions[f] = ('g', (fl2, True), "remote created")
for f in sorted(abortconflicts):
- repo.ui.warn(_("%s: untracked file differs\n") % f)
+ if f in pathconflicts:
+ if repo.wvfs.isfileorlink(f):
+ repo.ui.warn(_("%s: untracked file conflicts with directory\n")
+ % f)
+ else:
+ repo.ui.warn(_("%s: untracked directory conflicts with file\n")
+ % f)
+ else:
+ 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)
+ if repo.wvfs.isfileorlink(f):
+ repo.ui.warn(_("%s: replacing untracked file\n") % f)
+ else:
+ repo.ui.warn(_("%s: replacing untracked files in directory\n") % f)
for f, (m, args, msg) in actions.iteritems():
if m == 'c':
To: mbthomas, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list