Patchwork D782: merge: improve error messages for path conflicts during update

login
register
mail settings
Submitter phabricator
Date Oct. 10, 2017, 1:31 a.m.
Message ID <d345f290a43d412e997b22652d8b5be3@localhost.localdomain>
Download mbox | patch
Permalink /patch/24692/
State Not Applicable
Headers show

Comments

phabricator - Oct. 10, 2017, 1:31 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG67c075d6cec1: merge: improve error messages for path conflicts during update (authored by mbthomas, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D782?vs=2359&id=2553

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




To: mbthomas, #hg-reviewers, ryanmce
Cc: ryanmce, mercurial-devel

Patch

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
@@ -741,13 +741,23 @@ 
                     actions[f] = ('g', (fl2, True), "remote created")
 
     for f in sorted(abortconflicts):
-        repo.ui.warn(_("%s: untracked file differs\n") % f)
+        warn = repo.ui.warn
+        if f in pathconflicts:
+            if repo.wvfs.isfileorlink(f):
+                warn(_("%s: untracked file conflicts with directory\n") % f)
+            else:
+                warn(_("%s: untracked directory conflicts with file\n") % f)
+        else:
+            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':