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

login
register
mail settings
Submitter phabricator
Date Jan. 26, 2020, 12:26 a.m.
Message ID <f29bca465bcedf4210b3bc131e55fab7@localhost.localdomain>
Download mbox | patch
Permalink /patch/44669/
State Not Applicable
Headers show

Comments

phabricator - Jan. 26, 2020, 12:26 a.m.
Closed by commit rHG1850066f9e36: merge: don&#039;t auto-pick destination with `hg merge &#039;wdir()&#039;` (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

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

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, pulkit
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'.')