comparison hgext/uncommit.py @ 41859:bf22e370ae9a

uncommit: don't allow dirty working copy with PATH (issue5977) On a dirty PATH, uncommit was working without even setting the config `experimental.uncommitondirtydir` to `True`. Ideally, it should abort as it does for a dirty dir. This patch makes uncommit to require the config option `experimental.uncommitondirtydir` on a dirty PATH. Original patch to evolve extension authored by Dan Villiom Podlaski Christiansen: https://bitbucket.org/octobus/evolve-devel/pull-requests/8/bug-5977-uncommit-dirtiness/diff Differential Revision: https://phab.mercurial-scm.org/D5940
author Navaneeth Suresh <navaneeths1998@gmail.com>
date Tue, 12 Feb 2019 00:17:42 +0530
parents 1040d54eb7eb
children aa284d9a33ca
comparison
equal deleted inserted replaced
41858:e0384d4c51ae 41859:bf22e370ae9a
156 """ 156 """
157 opts = pycompat.byteskwargs(opts) 157 opts = pycompat.byteskwargs(opts)
158 158
159 with repo.wlock(), repo.lock(): 159 with repo.wlock(), repo.lock():
160 160
161 if not pats and not repo.ui.configbool('experimental', 161 m, a, r, d = repo.status()[:4]
162 'uncommitondirtywdir'): 162 isdirtypath = any(set(m + a + r + d) & set(pats))
163 cmdutil.bailifchanged(repo) 163 if (not repo.ui.configbool('experimental', 'uncommitondirtywdir') and
164 (not pats or isdirtypath)):
165 cmdutil.bailifchanged(repo, hint=_('requires '
166 'experimental.uncommitondirtywdir to uncommit'))
164 old = repo['.'] 167 old = repo['.']
165 rewriteutil.precheck(repo, [old.rev()], 'uncommit') 168 rewriteutil.precheck(repo, [old.rev()], 'uncommit')
166 if len(old.parents()) > 1: 169 if len(old.parents()) > 1:
167 raise error.Abort(_("cannot uncommit merge changeset")) 170 raise error.Abort(_("cannot uncommit merge changeset"))
168 171