D734: uncommit: don't allow bare uncommit on dirty working directory
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Tue Sep 19 21:11:24 UTC 2017
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
As per IRC discussion and suggestion by Augie, we should not allow bare `hg
uncommit` on dirty working directory.
REPOSITORY
rHG Mercurial
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
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list