Patchwork D734: uncommit: don't allow bare uncommit on dirty working directory

login
register
mail settings
Submitter phabricator
Date Sept. 20, 2017, 4:26 p.m.
Message ID <01fcc87fc14137ced3dbfc8f4e818f3c@localhost.localdomain>
Download mbox | patch
Permalink /patch/24047/
State Not Applicable
Headers show

Comments

phabricator - Sept. 20, 2017, 4:26 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG624c53e4121d: uncommit: don&#039;t allow bare uncommit on dirty working directory (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D734?vs=1900&id=1925

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

AFFECTED FILES
  hgext/uncommit.py
  tests/test-uncommit.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -149,6 +149,9 @@ 
   foo
   $ hg status
   M files
+  $ hg uncommit
+  abort: uncommitted changes
+  [255]
   $ hg uncommit files
   $ cat files
   abcde
@@ -337,7 +340,7 @@ 
   (branch merge, don't forget to commit)
 
   $ hg uncommit
-  abort: cannot uncommit while merging
+  abort: outstanding uncommitted merge
   [255]
 
   $ hg status
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -22,6 +22,7 @@ 
 from mercurial.i18n import _
 
 from mercurial import (
+    cmdutil,
     commands,
     context,
     copies,
@@ -148,6 +149,8 @@ 
     with repo.wlock(), repo.lock():
         wctx = repo[None]
 
+        if not pats:
+            cmdutil.bailifchanged(repo)
         if wctx.parents()[0].node() == node.nullid:
             raise error.Abort(_("cannot uncommit null changeset"))
         if len(wctx.parents()) > 1: