Mercurial > public > mercurial-scm > hg
comparison hgext/uncommit.py @ 34284: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 |
comparison
equal
deleted
inserted
replaced
34283:f94442d46984 | 34284:624c53e4121d |
---|---|
20 from __future__ import absolute_import | 20 from __future__ import absolute_import |
21 | 21 |
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, |
28 error, | 29 error, |
29 node, | 30 node, |
146 """ | 147 """ |
147 | 148 |
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: |
154 raise error.Abort(_("cannot uncommit while merging")) | 157 raise error.Abort(_("cannot uncommit while merging")) |
155 old = repo['.'] | 158 old = repo['.'] |