Rev 1020: Merge 0.4. in file:///data/jelmer/bzr-svn/pyrex/

Jelmer Vernooij jelmer at samba.org
Fri Mar 21 12:44:59 GMT 2008


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

------------------------------------------------------------
revno: 1020
revision-id: jelmer at samba.org-20080321124458-92ulq3k4e9lijzsv
parent: jelmer at samba.org-20080321123725-rcq2u0nb2b06c8p7
parent: jelmer at samba.org-20080321031902-tx2f9kddff5gvoe6
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: pyrex
timestamp: Fri 2008-03-21 13:44:58 +0100
message:
  Merge 0.4.
modified:
  commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
  scheme.py                      scheme.py-20060516195850-95181aae6b272f9e
    ------------------------------------------------------------
    revno: 950.1.6
    revision-id: jelmer at samba.org-20080321031902-tx2f9kddff5gvoe6
    parent: jelmer at samba.org-20080321023621-rwdv5acu9j0n6f5s
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Fri 2008-03-21 04:19:02 +0100
    message:
      Fix bug in prop.
    modified:
      commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
      scheme.py                      scheme.py-20060516195850-95181aae6b272f9e
    ------------------------------------------------------------
    revno: 950.1.5
    revision-id: jelmer at samba.org-20080321023621-rwdv5acu9j0n6f5s
    parent: jelmer at samba.org-20080321011504-76ycbcwvsmlpwt1q
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Fri 2008-03-21 03:36:21 +0100
    message:
      Add functions for unescaping/escaping strings for use in property names.
    modified:
      commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
      scheme.py                      scheme.py-20060516195850-95181aae6b272f9e
    ------------------------------------------------------------
    revno: 950.1.4
    revision-id: jelmer at samba.org-20080321011504-76ycbcwvsmlpwt1q
    parent: jelmer at samba.org-20080318194550-jea4hwu2jqshsq9c
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Fri 2008-03-21 02:15:04 +0100
    message:
      Debug file property.
    modified:
      commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
=== modified file 'commit.py'
--- a/commit.py	2008-03-17 20:59:03 +0000
+++ b/commit.py	2008-03-21 12:44:58 +0000
@@ -38,6 +38,14 @@
 from repository import (SvnRepositoryFormat, SvnRepository)
 import urllib
 
+
+def is_valid_property_name(prop):
+    for c in prop:
+        if not c.isalnum() and not c in "-:":
+            return False
+    return True
+
+
 def _revision_id_to_svk_feature(revid):
     """Create a SVK feature identifier from a revision id.
 
@@ -460,6 +468,8 @@
         try:
             existing_bp_parts = _check_dirs_exist(self.repository.transport, 
                                               bp_parts, -1)
+            for prop in self._svn_revprops:
+                assert is_valid_property_name(prop)
             try:
                 self.editor = self.repository.transport.get_commit_editor(
                         self._svn_revprops, done, None, False)
@@ -494,9 +504,11 @@
 
             # Set all the revprops
             for prop, value in self._svnprops.items():
+                assert is_valid_property_name(prop)
                 if value is not None:
                     value = value.encode('utf-8')
                 branch_editors[-1].change_prop(prop, value)
+                self.mutter("Setting root file property %r -> %r" % (prop, value))
 
             for dir_editor in reversed(branch_editors):
                 dir_editor.close()

=== modified file 'scheme.py'
--- a/scheme.py	2008-02-03 19:41:38 +0000
+++ b/scheme.py	2008-03-21 03:19:02 +0000
@@ -124,6 +124,14 @@
     return branches
 
 
+def prop_name_unquote(text):
+    return urlsafe_b64decode(text.replace(".", "="))
+
+
+def prop_name_quote(text):
+    return urlsafe_b64encode(text).replace("=", ".")
+
+
 class ListBranchingScheme(BranchingScheme):
     """Branching scheme that keeps a list of branch paths, including 
     wildcards."""
@@ -134,13 +142,13 @@
         """
         assert isinstance(branch_list, list) or isinstance(branch_list, str)
         if isinstance(branch_list, str):
-            branch_list = bz2.decompress(urlsafe_b64decode(branch_list.encode("ascii").replace(".", "="))).splitlines()
+            branch_list = bz2.decompress(prop_name_unquote(branch_list.encode("ascii"))).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" % urlsafe_b64encode(bz2.compress("".join(map(lambda x:x+"\n", self.branch_list)))).replace("=", ".")
-
+        return "list-%s" % prop_name_quote(bz2.compress("".join(map(lambda x:x+"\n", self.branch_list))))
+            
     def is_tag(self, path):
         """See BranchingScheme.is_tag()."""
         return False




More information about the bazaar-commits mailing list