##// END OF EJS Templates
uncommit: don't allow bare uncommit on dirty working directory...
Pulkit Goyal -
r34285:624c53e4 default
parent child Browse files
Show More
@@ -22,6 +22,7 b' from __future__ import absolute_import'
22 from mercurial.i18n import _
22 from mercurial.i18n import _
23
23
24 from mercurial import (
24 from mercurial import (
25 cmdutil,
25 commands,
26 commands,
26 context,
27 context,
27 copies,
28 copies,
@@ -148,6 +149,8 b' def uncommit(ui, repo, *pats, **opts):'
148 with repo.wlock(), repo.lock():
149 with repo.wlock(), repo.lock():
149 wctx = repo[None]
150 wctx = repo[None]
150
151
152 if not pats:
153 cmdutil.bailifchanged(repo)
151 if wctx.parents()[0].node() == node.nullid:
154 if wctx.parents()[0].node() == node.nullid:
152 raise error.Abort(_("cannot uncommit null changeset"))
155 raise error.Abort(_("cannot uncommit null changeset"))
153 if len(wctx.parents()) > 1:
156 if len(wctx.parents()) > 1:
@@ -149,6 +149,9 b' Uncommit with dirty state'
149 foo
149 foo
150 $ hg status
150 $ hg status
151 M files
151 M files
152 $ hg uncommit
153 abort: uncommitted changes
154 [255]
152 $ hg uncommit files
155 $ hg uncommit files
153 $ cat files
156 $ cat files
154 abcde
157 abcde
@@ -337,7 +340,7 b' Add and expect uncommit to fail on both '
337 (branch merge, don't forget to commit)
340 (branch merge, don't forget to commit)
338
341
339 $ hg uncommit
342 $ hg uncommit
340 abort: cannot uncommit while merging
343 abort: outstanding uncommitted merge
341 [255]
344 [255]
342
345
343 $ hg status
346 $ hg status
General Comments 0
You need to be logged in to leave comments. Login now