Rev 725: Avoid = in property names (#125751). in file:///data/jelmer/bzr-svn/0.4/

Jelmer Vernooij jelmer at samba.org
Wed Oct 17 01:13:57 BST 2007


At file:///data/jelmer/bzr-svn/0.4/

------------------------------------------------------------
revno: 725
revision-id: jelmer at samba.org-20071016124017-kmwoodryt9t90x1r
parent: jelmer at samba.org-20071010232417-mydh3vng3z78oi9v
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2007-10-16 14:40:17 +0200
message:
  Avoid = in property names (#125751).
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  scheme.py                      scheme.py-20060516195850-95181aae6b272f9e
  tests/test_scheme.py           test_scheme.py-20060621221855-va2xabhlxpmc9llx-1
=== modified file 'NEWS'
--- a/NEWS	2007-10-09 12:27:42 +0000
+++ b/NEWS	2007-10-16 12:40:17 +0000
@@ -30,6 +30,9 @@
 
    * Support svn+ hack when committing in bound branches. (#150699)
 
+   * Encode = in list branching scheme names (unusable in Subversion property 
+     names). (#125751)
+
   DOCUMENTATION
 
    * Add simple FAQ file. (#144388)

=== modified file 'scheme.py'
--- a/scheme.py	2007-09-24 19:07:59 +0000
+++ b/scheme.py	2007-10-16 12:40:17 +0000
@@ -19,7 +19,7 @@
 from bzrlib.errors import NotBranchError, BzrError
 from bzrlib.trace import mutter
 
-import base64
+from base64 import urlsafe_b64decode, urlsafe_b64encode
 import bz2
 
 class BranchingScheme:
@@ -130,12 +130,12 @@
         :param branch_list: List of know branch locations.
         """
         if isinstance(branch_list, basestring):
-            branch_list = bz2.decompress(base64.b64decode(branch_list)).splitlines()
+            branch_list = bz2.decompress(urlsafe_b64decode(branch_list.replace(".", "="))).splitlines()
         self.branch_list = [p.strip("/") for p in branch_list]
         self.split_branch_list = [p.split("/") for p in self.branch_list]
 
     def __str__(self):
-        return "list-%s" % base64.b64encode(bz2.compress("".join(map(lambda x:x+"\n", self.branch_list))))
+        return "list-%s" % urlsafe_b64encode(bz2.compress("".join(map(lambda x:x+"\n", self.branch_list)))).replace("=", ".")
 
     def is_tag(self, path):
         """See BranchingScheme.is_tag()."""

=== modified file 'tests/test_scheme.py'
--- a/tests/test_scheme.py	2007-09-24 19:07:59 +0000
+++ b/tests/test_scheme.py	2007-10-16 12:40:17 +0000
@@ -252,7 +252,7 @@
         self.assertEqual(self.scheme.unprefix("bar/bloe"), ("bar/bloe", ""))
 
     def test_str(self):
-        self.assertEqual("list-QlpoOTFBWSZTWSDz6woAAAPRgAAQAACzBJAAIAAiDRo9QgyYjmbjatAeLuSKcKEgQefWFA==", str(self.scheme))
+        self.assertEqual("list-QlpoOTFBWSZTWSDz6woAAAPRgAAQAACzBJAAIAAiDRo9QgyYjmbjatAeLuSKcKEgQefWFA..", str(self.scheme))
 
     def test_parse_text(self):
         self.assertEqual(["bla/bloe"], parse_list_scheme_text("bla/bloe\n"))




More information about the bazaar-commits mailing list