Mercurial > public > mercurial-scm > hg
comparison hgext/uncommit.py @ 34285:7b1e524ad73f
uncommit: add an experimental.uncommitondirtywdir config
There are people who wants to do `hg uncommit` on dirty working directory, so
this patch adds a config which can be used to the achieve that.
Adds tests for the same.
Differential Revision: https://phab.mercurial-scm.org/D735
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 20 Sep 2017 02:40:25 +0530 |
parents | 624c53e4121d |
children | 9ea416a4b4f7 |
comparison
equal
deleted
inserted
replaced
34284:624c53e4121d | 34285:7b1e524ad73f |
---|---|
147 """ | 147 """ |
148 | 148 |
149 with repo.wlock(), repo.lock(): | 149 with repo.wlock(), repo.lock(): |
150 wctx = repo[None] | 150 wctx = repo[None] |
151 | 151 |
152 if not pats: | 152 if not pats and not repo.ui.configbool('experimental', |
153 'uncommitondirtywdir', False): | |
153 cmdutil.bailifchanged(repo) | 154 cmdutil.bailifchanged(repo) |
154 if wctx.parents()[0].node() == node.nullid: | 155 if wctx.parents()[0].node() == node.nullid: |
155 raise error.Abort(_("cannot uncommit null changeset")) | 156 raise error.Abort(_("cannot uncommit null changeset")) |
156 if len(wctx.parents()) > 1: | 157 if len(wctx.parents()) > 1: |
157 raise error.Abort(_("cannot uncommit while merging")) | 158 raise error.Abort(_("cannot uncommit while merging")) |