Rev 1729: More paranoia checking for other mapping versions. in file:///data/jelmer/bzr-svn/trunk/

Jelmer Vernooij jelmer at samba.org
Sun Aug 31 05:01:18 BST 2008


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

------------------------------------------------------------
revno: 1729
revision-id: jelmer at samba.org-20080831040117-cb0wdxsohs0lpdam
parent: jelmer at samba.org-20080831040100-fqmf7uccy56yuzc9
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sun 2008-08-31 06:01:17 +0200
message:
  More paranoia checking for other mapping versions.
modified:
  mapping.py                     mapping.py-20080128201303-6cp01phc0dmc0kiv-1
  mapping4.py                    mapping4.py-20080827182338-y4xzpsf43vyiwcir-1
=== modified file 'mapping.py'
--- a/mapping.py	2008-08-31 01:15:57 +0000
+++ b/mapping.py	2008-08-31 04:01:17 +0000
@@ -33,6 +33,7 @@
 SVN_PROP_BZR_REVISION_ID = 'bzr:revision-id:'
 SVN_PROP_BZR_TEXT_PARENTS = 'bzr:text-parents'
 SVN_PROP_BZR_LOG = 'bzr:log'
+SVN_PROP_BZR_REQUIRED_FEATURES = 'bzr:required-features'
 
 SVN_REVPROP_BZR_COMMITTER = 'bzr:committer'
 SVN_REVPROP_BZR_FILEIDS = 'bzr:file-ids'
@@ -275,6 +276,9 @@
             rev.properties[name[len(SVN_REVPROP_BZR_REVPROP_PREFIX):]] = value
 
 
+def parse_required_features_property(text):
+    return set(text.split(","))
+
 class BzrSvnMapping(foreign.VcsMapping):
     """Class that maps between Subversion and Bazaar semantics."""
     experimental = False

=== modified file 'mapping4.py'
--- a/mapping4.py	2008-08-30 22:14:26 +0000
+++ b/mapping4.py	2008-08-31 04:01:17 +0000
@@ -114,7 +114,7 @@
         if svn_revprops is not None:
             self.revprops.export_revision(branch_root, timestamp, timezone, committer, 
                                           revprops, revision_id, revno, parent_ids, svn_revprops, svn_fileprops)
-            svn_revprops[mapping.SVN_REVPROP_BZR_MAPPING_VERSION] = "v4"
+            svn_revprops[mapping.SVN_REVPROP_BZR_MAPPING_VERSION] = self.name
         else:
             self.fileprops.export_revision(branch_root, timestamp, timezone, committer, 
                                       revprops, revision_id, revno, parent_ids, svn_revprops, svn_fileprops)
@@ -133,11 +133,15 @@
 
     def import_revision(self, svn_revprops, fileprops, uuid, branch, revnum, rev):
         if svn_revprops.has_key(mapping.SVN_REVPROP_BZR_REQUIRED_FEATURES):
-            features = set(svn_revprops[mapping.SVN_REVPROP_BZR_REQUIRED_FEATURES].split(","))
+            features = mapping.parse_required_features_property(svn_revprops[mapping.SVN_REVPROP_BZR_REQUIRED_FEATURES])
             assert features.issubset(supported_features), "missing feature: %r" % features.difference(supported_features)
         if svn_revprops.has_key(mapping.SVN_REVPROP_BZR_MAPPING_VERSION):
+            assert svn_revprops[mapping.SVN_REVPROP_BZR_MAPPING_VERSION] == self.name, "unknown mapping: %s" % svn_revprops[mapping.SVN_REVPROP_BZR_MAPPING_VERSION]
             self.revprops.import_revision(svn_revprops, fileprops, uuid, branch, revnum, rev)
         else:
+            if fileprops.has_key(mapping.SVN_PROP_BZR_REQUIRED_FEATURES):
+                features = mapping.parse_required_features_property(fileprops[mapping.SVN_PROP_BZR_REQUIRED_FEATURES])
+                assert features.issubset(supported_features), "missing feature: %r" % features.difference(supported_features)
             self.fileprops.import_revision(svn_revprops, fileprops, uuid, branch, revnum, rev)
 
     def get_mandated_layout(self, repository):




More information about the bazaar-commits mailing list