Patchwork D7996: merge: don't auto-pick destination with `hg merge 'wdir()'`

login
register
mail settings
Submitter phabricator
Date Jan. 25, 2020, 6:07 a.m.
Message ID <279c080d6a46e3376671991cff3774b8@localhost.localdomain>
Download mbox | patch
Permalink /patch/44655/
State Not Applicable
Headers show

Comments

phabricator - Jan. 25, 2020, 6:07 a.m.
martinvonz edited the summary of this revision.
martinvonz updated this revision to Diff 19602.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7996?vs=19587&id=19602

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7996/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7996

AFFECTED FILES
  mercurial/commands.py
  tests/test-merge2.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: pulkit, mercurial-devel

Patch

diff --git a/tests/test-merge2.t b/tests/test-merge2.t
--- a/tests/test-merge2.t
+++ b/tests/test-merge2.t
@@ -50,4 +50,8 @@ 
   adding b
   created new head
 
+  $ hg merge 'wdir()'
+  abort: merging with the working copy has no effect
+  [255]
+
   $ cd ..
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4866,8 +4866,7 @@ 
 
     if node:
         node = scmutil.revsingle(repo, node).node()
-
-    if not node:
+    else:
         if ui.configbool(b'commands', b'merge.require-rev'):
             raise error.Abort(
                 _(
@@ -4877,6 +4876,9 @@ 
             )
         node = repo[destutil.destmerge(repo)].node()
 
+    if node is None:
+        raise error.Abort(_(b'merging with the working copy has no effect'))
+
     if opts.get(b'preview'):
         # find nodes that are ancestors of p2 but not of p1
         p1 = repo.lookup(b'.')