diff hgext/uncommit.py @ 34291:624c53e4121d

uncommit: don't allow bare uncommit on dirty working directory As per IRC discussion and suggestion by Augie, we should not allow bare `hg uncommit` on dirty working directory. Differential Revision: https://phab.mercurial-scm.org/D734
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 20 Sep 2017 02:18:01 +0530
parents f94442d46984
children 7b1e524ad73f
line wrap: on
line diff
--- a/hgext/uncommit.py	Sat Sep 16 02:34:13 2017 +0530
+++ b/hgext/uncommit.py	Wed Sep 20 02:18:01 2017 +0530
@@ -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: