Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
31555:7c7d3ad7ca5c | 31556:448acdee9161 |
---|---|
1114 _reserved = ('series', 'status', 'guards', '.', '..') | 1114 _reserved = ('series', 'status', 'guards', '.', '..') |
1115 def checkreservedname(self, name): | 1115 def checkreservedname(self, name): |
1116 if name in self._reserved: | 1116 if name in self._reserved: |
1117 raise error.Abort(_('"%s" cannot be used as the name of a patch') | 1117 raise error.Abort(_('"%s" cannot be used as the name of a patch') |
1118 % name) | 1118 % name) |
1119 if name != name.strip(): | |
1120 # whitespace is stripped by parseseries() | |
1121 raise error.Abort(_('patch name cannot begin or end with ' | |
1122 'whitespace')) | |
1119 for prefix in ('.hg', '.mq'): | 1123 for prefix in ('.hg', '.mq'): |
1120 if name.startswith(prefix): | 1124 if name.startswith(prefix): |
1121 raise error.Abort(_('patch name cannot begin with "%s"') | 1125 raise error.Abort(_('patch name cannot begin with "%s"') |
1122 % prefix) | 1126 % prefix) |
1123 for c in ('#', ':', '\r', '\n'): | 1127 for c in ('#', ':', '\r', '\n'): |