Rev 2206: Split export_text_revisions. in file:///data/jelmer/bzr-svn/mappings/

Jelmer Vernooij jelmer at samba.org
Sat Dec 6 23:21:40 GMT 2008


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

------------------------------------------------------------
revno: 2206
revision-id: jelmer at samba.org-20081206232138-n7rfmoy4pnftyq15
parent: jelmer at samba.org-20081206231550-y7xfzpfxkii31ms3
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: mappings
timestamp: Sun 2008-12-07 00:21:38 +0100
message:
  Split export_text_revisions.
modified:
  commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
  mapping.py                     mapping.py-20080128201303-6cp01phc0dmc0kiv-1
  mapping3/__init__.py           __init__.py-20080502174630-9324zh25kka98vlw-1
  mapping4.py                    mapping4.py-20080827182338-y4xzpsf43vyiwcir-1
  tests/mapping_implementations/test_base.py test_base.py-20080904055908-3t0g1y0qnmr6aeiq-1
  upgrade.py                     upgrade.py-20070106192108-0rakplee2lzah4gs-1
=== modified file 'commit.py'
--- a/commit.py	2008-12-06 23:15:50 +0000
+++ b/commit.py	2008-12-06 23:21:38 +0000
@@ -541,7 +541,8 @@
         if self.push_metadata:
             (fileids, text_revisions, text_parents) = self._determine_texts_identity()
 
-            self.mapping.export_text_revisions(text_revisions, self._svn_revprops, self._svnprops)
+            self.mapping.export_text_revisions_revprops(text_revisions, self._svn_revprops)
+            self.mapping.export_text_revisions_fileprops(text_revisions, self._svnprops)
             self.mapping.export_text_parents(text_parents, self._svn_revprops, self._svnprops)
             self.mapping.export_fileid_map_revprops(fileids, self._svn_revprops)
             self.mapping.export_fileid_map_fileprops(fileids, self._svnprops)

=== modified file 'mapping.py'
--- a/mapping.py	2008-12-06 23:15:50 +0000
+++ b/mapping.py	2008-12-06 23:21:38 +0000
@@ -479,14 +479,21 @@
         """
         raise NotImplementedError(self.export_text_parents)
 
-    def export_text_revisions(self, text_revisions, revprops, fileprops):
+    def export_text_revisions_revprops(self, text_revisions, revprops):
         """Store a text revisions map.
 
         :param text_parents: Text revision map
         :param revprops: Revision properties
+        """
+        raise NotImplementedError(self.export_text_revisions_revprops)
+
+    def export_text_revisions_fileprops(self, text_revisions, fileprops):
+        """Store a text revisions map.
+
+        :param text_parents: Text revision map
         :param fileprops: File properties
         """
-        raise NotImplementedError(self.export_text_revisions)
+        raise NotImplementedError(self.export_text_revisions_fileprops)
 
     def import_text_revisions_revprops(self, revprops):
         raise NotImplementedError(self.import_text_revisions_revprops)
@@ -614,12 +621,15 @@
         elif SVN_PROP_BZR_TEXT_PARENTS in fileprops:
             fileprops[SVN_PROP_BZR_TEXT_PARENTS] = ""
 
-    def export_text_revisions(self, text_revisions, svn_revprops, fileprops):
+    def export_text_revisions_fileprops(self, text_revisions, fileprops):
         if text_revisions != {}:
             fileprops[SVN_PROP_BZR_TEXT_REVISIONS] = generate_text_revisions_property(text_revisions)
         elif SVN_PROP_BZR_TEXT_REVISIONS in fileprops:
             fileprops[SVN_PROP_BZR_TEXT_REVISIONS] = ""
 
+    def export_text_revisions_revprops(self, text_revisions, revprops):
+        pass
+
     def get_rhs_parents_fileprops(self, fileprops):
         bzr_merges = fileprops.get(SVN_PROP_BZR_ANCESTRY+self.name, None)
         if bzr_merges is not None:
@@ -749,10 +759,13 @@
     def import_text_revisions_fileprops(self, fileprops):
         return {}
 
-    def export_text_revisions(self, text_revisions, svn_revprops, fileprops):
+    def export_text_revisions_revprops(self, text_revisions, svn_revprops):
         if text_revisions != {}:
             svn_revprops[SVN_REVPROP_BZR_TEXT_REVISIONS] = generate_text_revisions_property(text_revisions)
 
+    def export_text_revisions_fileprops(self, text_revisions, fileprops):
+        pass
+
     def get_lhs_parent_revprops(self, svn_revprops):
         return svn_revprops.get(SVN_REVPROP_BZR_BASE_REVISION)
 

=== modified file 'mapping3/__init__.py'
--- a/mapping3/__init__.py	2008-12-06 23:15:50 +0000
+++ b/mapping3/__init__.py	2008-12-06 23:21:38 +0000
@@ -315,10 +315,11 @@
         if svn_revprops is not None:
             self.revprop_map.export_text_parents(text_parents, svn_revprops, fileprops)
 
-    def export_text_revisions(self, text_revisions, svn_revprops, fileprops):
-        mapping.BzrSvnMappingFileProps.export_text_revisions(self, text_revisions, svn_revprops, fileprops)
-        if svn_revprops is not None:
-            self.revprop_map.export_text_revisions(text_revisions, svn_revprops, fileprops)
+    def export_text_revisions_revprops(self, text_revisions, svn_revprops):
+        self.revprop_map.export_text_revisions_revprops(text_revisions, svn_revprops)
+
+    def export_text_revisions_fileprops(self, text_revisions, fileprops):
+        mapping.BzrSvnMappingFileProps.export_text_revisions_fileprops(self, text_revisions, fileprops)
 
     def export_revision(self, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, parent_ids, svn_revprops, svn_fileprops):
         mapping.BzrSvnMappingFileProps.export_revision(self, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, parent_ids, svn_revprops, svn_fileprops)

=== modified file 'mapping4.py'
--- a/mapping4.py	2008-12-06 23:15:50 +0000
+++ b/mapping4.py	2008-12-06 23:21:38 +0000
@@ -150,11 +150,11 @@
         else:
             self.fileprops.export_text_parents(text_parents, revprops, fileprops)
 
-    def export_text_revisions(self, text_revisions, revprops, fileprops):
-        if revprops is not None:
-            self.revprops.export_text_revisions(text_revisions, revprops, fileprops)
-        else:
-            self.fileprops.export_text_revisions(text_revisions, revprops, fileprops)
+    def export_text_revisions(self, text_revisions, revprops):
+        self.revprops.export_text_revisions(text_revisions, revprops)
+
+    def export_text_revisions_fileprops(self, text_revisions, fileprops):
+        self.fileprops.export_text_revisions(text_revisions, fileprops)
 
     def import_revision_revprops(self, svn_revprops, foreign_revid, rev):
         if svn_revprops.has_key(mapping.SVN_REVPROP_BZR_REQUIRED_FEATURES):

=== modified file 'tests/mapping_implementations/test_base.py'
--- a/tests/mapping_implementations/test_base.py	2008-12-06 23:15:50 +0000
+++ b/tests/mapping_implementations/test_base.py	2008-12-06 23:21:38 +0000
@@ -69,19 +69,27 @@
             self.assertEquals(text_parents,
                 self.mapping.import_text_parents_fileprops(changed_props(fileprops)))
 
-    def test_text_revisions(self):
-        if not self.mapping.roundtripping:
+    def test_text_revisions_fileprops(self):
+        if not self.mapping.roundtripping:
+            raise TestNotApplicable
+        if not self.mapping.can_use_fileprops:
+            raise TestNotApplicable
+        fileprops = {}
+        text_revisions = {"bla": "bloe", "ll": "12"}
+        self.mapping.export_text_revisions_fileprops(text_revisions, fileprops)
+        self.assertEquals(text_revisions,
+            self.mapping.import_text_revisions_fileprops(changed_props(fileprops)))
+
+    def test_text_revisions_revprops(self):
+        if not self.mapping.roundtripping:
+            raise TestNotApplicable
+        if not self.mapping.can_use_revprops:
             raise TestNotApplicable
         revprops = {}
-        fileprops = {}
         text_revisions = {"bla": "bloe", "ll": "12"}
-        self.mapping.export_text_revisions(text_revisions, revprops, fileprops)
-        if self.mapping.can_use_revprops:
-            self.assertEquals(text_revisions,
-                self.mapping.import_text_revisions_revprops(revprops))
-        if self.mapping.can_use_fileprops:
-            self.assertEquals(text_revisions,
-                self.mapping.import_text_revisions_fileprops(changed_props(fileprops)))
+        self.mapping.export_text_revisions_revprops(text_revisions, revprops)
+        self.assertEquals(text_revisions,
+            self.mapping.import_text_revisions_revprops(revprops))
 
     def test_message(self):
         if not self.mapping.roundtripping:

=== modified file 'upgrade.py'
--- a/upgrade.py	2008-12-06 23:15:50 +0000
+++ b/upgrade.py	2008-12-06 23:21:38 +0000
@@ -76,7 +76,7 @@
             new_mapping.export_revision(bp, rev.timestamp, rev.timezone, rev.committer, rev.properties, rev.revision_id, revno, rev.parent_ids, new_revprops, None)
             new_mapping.export_fileid_map_revprops(revmeta.get_fileid_map(old_mapping), new_revprops)
             new_mapping.export_text_parents(revmeta.get_text_parents(old_mapping), new_revprops, None)
-            new_mapping.export_text_revisions(revmeta.get_text_revisions(old_mapping), new_revprops, None)
+            new_mapping.export_text_revisions_revprops(revmeta.get_text_revisions(old_mapping), new_revprops)
             if rev.message != mapping.parse_svn_log(revprops.get(properties.PROP_REVISION_LOG)):
                 new_mapping.export_message(rev.message, new_revprops, None)
             changed_revprops = dict(ifilter(lambda (k,v): k not in revprops or revprops[k] != v, new_revprops.iteritems()))




More information about the bazaar-commits mailing list