Skip to content
Snippets Groups Projects

topic: allow unicode symbols in names as long as they are alphanumeric

Merged Anton Shestakov requested to merge topic/default/unicode-topics into branch/default
Files
3
+ 11
4
@@ -169,6 +169,7 @@
cmdutil,
commands,
context,
encoding,
error,
exchange,
extensions,
@@ -827,10 +828,16 @@
# Have some restrictions on the topic name just like bookmark name
scmutil.checknewlabel(repo, topic, b'topic')
rmatch = re.match(br'[-_.\w]+', topic)
if not rmatch or rmatch.group(0) != topic:
helptxt = _(b"topic names can only consist of alphanumeric, '-'"
b" '_' and '.' characters")
helptxt = _(b"topic names can only consist of alphanumeric, '-'"
b" '_' and '.' characters")
try:
utopic = encoding.unifromlocal(topic)
except error.Abort:
# Maybe we should allow these topic names as well, as long as they
# don't break any other rules
utopic = ''
rmatch = re.match(r'[-_.\w]+', utopic, re.UNICODE)
if not utopic or not rmatch or rmatch.group(0) != utopic:
raise error.Abort(_(b"invalid topic name: '%s'") % topic, hint=helptxt)
if list:
Loading