##// END OF EJS Templates
commitextras: make sure keys are not empty...
Pulkit Goyal -
r33607:80635169 stable
parent child Browse files
Show More
@@ -54,6 +54,9 b' def _commit(orig, ui, repo, *pats, **opt'
54 "KEY=VALUE format")
54 "KEY=VALUE format")
55 raise error.Abort(msg % raw)
55 raise error.Abort(msg % raw)
56 k, v = raw.split('=', 1)
56 k, v = raw.split('=', 1)
57 if not k:
58 msg = _("unable to parse '%s', keys can't be empty")
59 raise error.Abort(msg % raw)
57 if re.search('[^\w-]', k):
60 if re.search('[^\w-]', k):
58 msg = _("keys can only contain ascii letters, digits,"
61 msg = _("keys can only contain ascii letters, digits,"
59 " '_' and '-'")
62 " '_' and '-'")
@@ -138,6 +138,9 b' Using the advanced --extra flag'
138 $ hg commit -m "special chars in extra" --extra id@phab=214
138 $ hg commit -m "special chars in extra" --extra id@phab=214
139 abort: keys can only contain ascii letters, digits, '_' and '-'
139 abort: keys can only contain ascii letters, digits, '_' and '-'
140 [255]
140 [255]
141 $ hg commit -m "empty key" --extra =value
142 abort: unable to parse '=value', keys can't be empty
143 [255]
141 $ hg commit -m "adding extras" --extra sourcehash=foo --extra oldhash=bar
144 $ hg commit -m "adding extras" --extra sourcehash=foo --extra oldhash=bar
142 $ hg log -r . -T '{extras % "{extra}\n"}'
145 $ hg log -r . -T '{extras % "{extra}\n"}'
143 branch=default
146 branch=default
General Comments 0
You need to be logged in to leave comments. Login now