Rev 2210: Fix more tests. in file:///data/jelmer/bzr-svn/mappings/

Jelmer Vernooij jelmer at samba.org
Sun Dec 7 00:59:04 GMT 2008


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

------------------------------------------------------------
revno: 2210
revision-id: jelmer at samba.org-20081207005859-1ekwkp5du0ohv7rk
parent: jelmer at samba.org-20081207003228-riotuhhh9jxf600f
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: mappings
timestamp: Sun 2008-12-07 01:58:59 +0100
message:
  Fix more tests.
modified:
  TODO                           todo-20060729211917-2kpobww0zyvvo0j2-1
  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
=== modified file 'TODO'
--- a/TODO	2008-12-06 23:50:23 +0000
+++ b/TODO	2008-12-07 00:58:59 +0000
@@ -4,6 +4,7 @@
  - cope with old mappings in find_tags_between_*
  - set-revprops upgrades v3 stuff as well?
  - set-revprops should refuse to work when there is no commit-revprops capability
+ - special fileproperty bzr:use-revprops for use when quick_revprops is not available
 - automatically disable cache in some situations, allow partial cache?
 - avoid checking properties in get_appropriate_mappings() unless really necessary
 - in-memory caching of revid mapping (LRUCache ?)

=== modified file 'commit.py'
--- a/commit.py	2008-12-07 00:32:28 +0000
+++ b/commit.py	2008-12-07 00:58:59 +0000
@@ -757,7 +757,8 @@
     fileprops = dict(revmeta.get_fileprops().iteritems())
     if set_metadata:
         assert mapping.supports_hidden
-        mapping.export_hidden(branch_path, revprops, fileprops)
+        mapping.export_hidden_revprops(branch_path, revprops)
+        mapping.export_hidden_fileprops(fileprops)
     parent = urlutils.dirname(branch_path)
 
     bp_parts = branch_path.split("/")
@@ -774,8 +775,8 @@
                 root.delete_entry(urlutils.basename(branch_path))
             branch_dir = root.add_directory(urlutils.basename(branch_path), 
                     _url_escape_uri(urlutils.join(repository.base, revmeta.branch_path)), revmeta.revnum)
-            for k, v in properties.diff(fileprops, revmeta.get_fileprops()).iteritems():
-                branch_dir.change_prop(k, v)
+            for k, (ov, nv) in properties.diff(fileprops, revmeta.get_fileprops()).iteritems():
+                branch_dir.change_prop(k, nv)
             branch_dir.close()
             root.close()
         except:

=== modified file 'mapping.py'
--- a/mapping.py	2008-12-07 00:32:28 +0000
+++ b/mapping.py	2008-12-07 00:58:59 +0000
@@ -291,6 +291,7 @@
     roundtripping = False
     can_use_revprops = False
     can_use_fileprops = False
+    must_use_fileprops = False
     supports_hidden = False
     restricts_branch_paths = False
 
@@ -543,8 +544,11 @@
     def is_bzr_revision_hidden_fileprops(self, changed_fileprops):
         return False
 
-    def export_hidden(self, branch_path, revprops, fileprops):
-        raise NotImplementedError(self.export_hidden)
+    def export_hidden_revprops(self, branch_root, revprops):
+        raise NotImplementedError(self.export_hidden_revprops)
+
+    def export_hidden_fileprops(self, fileprops):
+        raise NotImplementedError(self.export_hidden_fileprops)
 
     def show_foreign_revid(self, (uuid, bp, revnum)):
         return { "svn revno": "%d (on /%s)" % (revnum, bp)}

=== modified file 'mapping3/__init__.py'
--- a/mapping3/__init__.py	2008-12-06 23:50:23 +0000
+++ b/mapping3/__init__.py	2008-12-07 00:58:59 +0000
@@ -170,6 +170,8 @@
     revid_prefix = "svn-v3-"
     roundtripping = True
     can_use_fileprops = True
+    must_use_fileprops = True
+    can_use_revprops = True
     restricts_branch_paths = True
 
     def __init__(self, scheme, guessed_scheme=None):
@@ -334,8 +336,9 @@
     def export_fileid_map_revprops(self, fileids, revprops):
         self.revprop_map.export_fileid_map(fileids, revprops)
 
-    def export_message(self, log, revprops, fileprops):
-        mapping.BzrSvnMappingFileProps.export_message(self, log, revprops, fileprops)
-        if revprops is not None:
-            self.revprop_map.export_message(log, revprops, fileprops)
+    def export_message_fileprops(self, log, fileprops):
+        mapping.BzrSvnMappingFileProps.export_message_fileprops(self, log, fileprops)
+
+    def export_message_revprops(self, log, revprops):
+        self.revprop_map.export_message(log, revprops)
 

=== modified file 'mapping4.py'
--- a/mapping4.py	2008-12-07 00:32:28 +0000
+++ b/mapping4.py	2008-12-07 00:58:59 +0000
@@ -179,11 +179,11 @@
     def get_hidden_lhs_ancestors_count(self, fileprops):
         return int(fileprops.get(mapping.SVN_PROP_BZR_HIDDEN, "0"))
 
-    def export_hidden(self, branch_path, revprops, fileprops):
-        if revprops is not None:
-            revprops[mapping.SVN_REVPROP_BZR_HIDDEN] = ""
-            revprops[mapping.SVN_REVPROP_BZR_ROOT] = branch_path
-            return
+    def export_hidden_revprops(self, branch_root, revprops):
+        revprops[mapping.SVN_REVPROP_BZR_HIDDEN] = ""
+        revprops[mapping.SVN_REVPROP_BZR_ROOT] = branch_root
+
+    def export_hidden_fileprops(self, fileprops):
         old_value = fileprops.get(mapping.SVN_PROP_BZR_HIDDEN, "0")
         fileprops[mapping.SVN_PROP_BZR_HIDDEN] = str(int(old_value)+1)
 

=== modified file 'tests/mapping_implementations/test_base.py'
--- a/tests/mapping_implementations/test_base.py	2008-12-06 23:50:23 +0000
+++ b/tests/mapping_implementations/test_base.py	2008-12-07 00:58:59 +0000
@@ -113,7 +113,7 @@
         self.mapping.export_revision_fileprops(432432432.0, 0, "somebody", 
                                      {"arevprop": "val"}, "arevid", 4, ["merge1"], fileprops)
         try:
-            self.mapping.export_message("My Commit message", None, fileprops)
+            self.mapping.export_message_fileprops("My Commit message", fileprops)
         except NotImplementedError:
             raise TestNotApplicable
         targetrev = Revision(None)
@@ -130,7 +130,7 @@
                                      {"arevprop": "val"}, "arevid", 4, ["merge1"], revprops)
         revprops["svn:date"] = "2008-11-03T09:33:00.716938Z"
         try:
-            self.mapping.export_message("My Commit message", revprops)
+            self.mapping.export_message_revprops("My Commit message", revprops)
         except NotImplementedError:
             raise TestNotApplicable
         targetrev = Revision(None)




More information about the bazaar-commits mailing list