comparison hgext/uncommit.py @ 34758:9ea416a4b4f7

configitems: register the 'experimental.uncommitondirtywdir' config
author Boris Feld <boris.feld@octobus.net>
date Thu, 12 Oct 2017 00:38:18 +0200
parents 7b1e524ad73f
children 3ebae3ec4664
comparison
equal deleted inserted replaced
34757:8cf0a6cd1ed2 34758:9ea416a4b4f7
33 scmutil, 33 scmutil,
34 ) 34 )
35 35
36 cmdtable = {} 36 cmdtable = {}
37 command = registrar.command(cmdtable) 37 command = registrar.command(cmdtable)
38
39 configtable = {}
40 configitem = registrar.configitem(configtable)
41
42 configitem('experimental', 'uncommitondirtywdir',
43 default=False,
44 )
38 45
39 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for 46 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
40 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should 47 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
41 # be specifying the version(s) of Mercurial they are tested with, or 48 # be specifying the version(s) of Mercurial they are tested with, or
42 # leave the attribute unspecified. 49 # leave the attribute unspecified.
148 155
149 with repo.wlock(), repo.lock(): 156 with repo.wlock(), repo.lock():
150 wctx = repo[None] 157 wctx = repo[None]
151 158
152 if not pats and not repo.ui.configbool('experimental', 159 if not pats and not repo.ui.configbool('experimental',
153 'uncommitondirtywdir', False): 160 'uncommitondirtywdir'):
154 cmdutil.bailifchanged(repo) 161 cmdutil.bailifchanged(repo)
155 if wctx.parents()[0].node() == node.nullid: 162 if wctx.parents()[0].node() == node.nullid:
156 raise error.Abort(_("cannot uncommit null changeset")) 163 raise error.Abort(_("cannot uncommit null changeset"))
157 if len(wctx.parents()) > 1: 164 if len(wctx.parents()) > 1:
158 raise error.Abort(_("cannot uncommit while merging")) 165 raise error.Abort(_("cannot uncommit while merging"))