diff mercurial/bundle2.py @ 20814:8532f5e1b9df

bundle2: force the first char of parameter to be an letter. We need a case sensitive character to convey mandatory/advisory parameter semantic in a later patches.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 18 Mar 2014 18:56:08 -0700
parents 8c74b3ce5b70
children 938718d72624
line wrap: on
line diff
--- a/mercurial/bundle2.py	Tue Mar 18 18:40:31 2014 -0700
+++ b/mercurial/bundle2.py	Tue Mar 18 18:56:08 2014 -0700
@@ -47,6 +47,10 @@
 
   Empty name are obviously forbidden.
 
+  Name MUST start with a letter. This first character has to be capitalizable.
+  The capitalisation of the first letter will be used to know if an option is
+  advisory or mandatory. This is not implemented yet.
+
   Stream parameters use a simple textual format for two main reasons:
 
   - Stream level parameters should remains simple and we want to discourage any
@@ -72,6 +76,7 @@
 import util
 import struct
 import urllib
+import string
 
 import changegroup
 from i18n import _
@@ -100,6 +105,8 @@
         """add a stream level parameter"""
         if not name:
             raise ValueError('empty parameter name')
+        if name[0] not in string.letters:
+            raise ValueError('non letter first character: %r' % name)
         self._params.append((name, value))
 
     def getchunks(self):