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: 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