changeset 3667:a346b1641dfa

topic: allow '.' in topic names This is also commonly used.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 16 Apr 2018 20:18:10 +0200
parents af9981930dbd
children a6bac0492eff
files CHANGELOG hgext3rd/topic/__init__.py tests/test-topic.t
diffstat 3 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Mon Apr 16 10:58:06 2018 -0700
+++ b/CHANGELOG	Mon Apr 16 20:18:10 2018 +0200
@@ -18,6 +18,8 @@
 
   * fixed issue 5833 and 5832
 
+  * topic: restring name to letter, '-', '_' and '.'
+
 7.3.0 -- 2018-03-21
 ---------------------
 
--- a/hgext3rd/topic/__init__.py	Mon Apr 16 10:58:06 2018 -0700
+++ b/hgext3rd/topic/__init__.py	Mon Apr 16 20:18:10 2018 +0200
@@ -594,10 +594,10 @@
         # Have some restrictions on the topic name just like bookmark name
         scmutil.checknewlabel(repo, topic, 'topic')
 
-        rmatch = re.match(br'[\w\-]+', topic)
+        rmatch = re.match(br'[-_.\w]+', topic)
         if not rmatch or rmatch.group(0) != topic:
             helptxt = _("topic names can only consist of alphanumeric, '-'"
-                        " and '_' characters")
+                        " '_' and '.' characters")
             raise error.Abort(_("invalid topic name: '%s'") % topic, hint=helptxt)
 
     compat.startpager(ui, 'topics')
--- a/tests/test-topic.t	Mon Apr 16 10:58:06 2018 -0700
+++ b/tests/test-topic.t	Mon Apr 16 20:18:10 2018 +0200
@@ -117,12 +117,12 @@
 
   $ hg topic 'a12#45'
   abort: invalid topic name: 'a12#45'
-  (topic names can only consist of alphanumeric, '-' and '_' characters)
+  (topic names can only consist of alphanumeric, '-' '_' and '.' characters)
   [255]
 
   $ hg topic 'foo bar'
   abort: invalid topic name: 'foo bar'
-  (topic names can only consist of alphanumeric, '-' and '_' characters)
+  (topic names can only consist of alphanumeric, '-' '_' and '.' characters)
   [255]
 
 this is trying to list topic names
@@ -130,7 +130,7 @@
 
   $ hg topic '*12 B23'
   abort: invalid topic name: '*12 B23'
-  (topic names can only consist of alphanumeric, '-' and '_' characters)
+  (topic names can only consist of alphanumeric, '-' '_' and '.' characters)
   [255]
 
 Test commit flag and help text