Mercurial > public > mercurial-scm > hg
diff hgext/mq.py @ 31556:448acdee9161
mq: reject new patch name containing leading/trailing whitespace
We could create a patch of such name, but it wouldn't be processed properly
by mq as parseseries() strips leading/trailing whitespace.
The test of default message (added by b9a16ed5acec) is no longer be useful
so removed.
This issue was reported as:
https://bitbucket.org/tortoisehg/thg/issues/4693/
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 20 Mar 2017 11:38:37 +0900 |
parents | 03d99d08147b |
children | c6cbd0b66465 |
line wrap: on
line diff
--- a/hgext/mq.py Fri Mar 10 16:18:43 2017 -0800 +++ b/hgext/mq.py Mon Mar 20 11:38:37 2017 +0900 @@ -1116,6 +1116,10 @@ if name in self._reserved: raise error.Abort(_('"%s" cannot be used as the name of a patch') % name) + if name != name.strip(): + # whitespace is stripped by parseseries() + raise error.Abort(_('patch name cannot begin or end with ' + 'whitespace')) for prefix in ('.hg', '.mq'): if name.startswith(prefix): raise error.Abort(_('patch name cannot begin with "%s"')