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

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Wed Sep 20 12:26:43 EDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG624c53e4121d: uncommit: don'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

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:



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


More information about the Mercurial-devel mailing list