Mercurial > hg
changeset 28519:518a5030acba
histedit: have dropmissing abort on empty plan
We noticed that many users have the intuition of laving the editor empty when
they want to abort the operation. The fact that dropmissing allows user to
delete all edited commits is not intuitive even for users that asked for it.
Let's prevent people from this footgun.
author | Mateusz Kwapich <mitrandir@fb.com> |
---|---|
date | Sun, 13 Mar 2016 16:46:49 -0700 |
parents | 3bf2892f685f |
children | 84cc72c5771e |
files | hgext/histedit.py tests/test-histedit-drop.t |
diffstat | 2 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/histedit.py Mon Mar 14 12:52:35 2016 +0000 +++ b/hgext/histedit.py Sun Mar 13 16:46:49 2016 -0700 @@ -1379,6 +1379,10 @@ missing = sorted(expected - seen) # sort to stabilize output if state.repo.ui.configbool('histedit', 'dropmissing'): + if len(actions) == 0: + raise error.ParseError(_('no rules provided'), + hint=_('use strip extension to remove commits')) + drops = [drop(state, node.bin(n)) for n in missing] # put the in the beginning so they execute immediately and # don't show in the edit-plan in the future
--- a/tests/test-histedit-drop.t Mon Mar 14 12:52:35 2016 +0000 +++ b/tests/test-histedit-drop.t Sun Mar 13 16:46:49 2016 -0700 @@ -153,6 +153,10 @@ hg: parse error: missing rules for changeset a4f7421b80f7 (use "drop a4f7421b80f7" to discard, see also: "hg help -e histedit.config") $ hg --config histedit.dropmissing=True histedit cb9a9f314b8b --commands - 2>&1 << EOF | fixbundle + > EOF + hg: parse error: no rules provided + (use strip extension to remove commits) + $ hg --config histedit.dropmissing=True histedit cb9a9f314b8b --commands - 2>&1 << EOF | fixbundle > pick cb9a9f314b8b a > pick ee283cb5f2d5 e > EOF