Rev 2095: Use more revmeta infrastructure. in http://people.samba.org/bzr/jelmer/bzr-svn/0.5

Jelmer Vernooij jelmer at samba.org
Sat Nov 29 02:52:17 GMT 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/0.5

------------------------------------------------------------
revno: 2095
revision-id: jelmer at samba.org-20081129025214-d5dl1fttrb0h1yr8
parent: jelmer at samba.org-20081129023725-5zhqpzdze9in6zsk
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.5
timestamp: Sat 2008-11-29 03:52:14 +0100
message:
  Use more revmeta infrastructure.
modified:
  upgrade.py                     upgrade.py-20070106192108-0rakplee2lzah4gs-1
=== modified file 'upgrade.py'
--- a/upgrade.py	2008-11-24 22:24:16 +0000
+++ b/upgrade.py	2008-11-29 02:52:14 +0000
@@ -34,6 +34,9 @@
     assert from_revnum <= to_revnum
     pb = ui.ui_factory.nested_progress_bar()
     logcache = getattr(repository._log, "cache", None)
+    def set_skip_revprop(revnum, revprops):
+        if not mapping.SVN_REVPROP_BZR_SKIP in revprops:
+            repository.transport.change_rev_prop(revnum, mapping.SVN_REVPROP_BZR_SKIP, "")
     try:
         for (paths, revnum, revprops) in repository._log.iter_changes(None, to_revnum, from_revnum, pb=pb):
             if revnum == 0:
@@ -42,29 +45,30 @@
             # Find the root path of the change
             bp = changes.changes_root(paths.keys())
             if bp is None:
-                fileprops = {}
-            else:
-                fileprops = logwalker.lazy_dict({}, repository.branchprop_list.get_properties, bp, revnum)
-            old_mapping = mapping.find_mapping(revprops, fileprops)
+                bp = revprops.get(mapping.SVN_REVPROP_BZR_ROOT)
+            if bp is None:
+                # Not a bzr-svn revision, since there is not a single root
+                # (fileproperties) nor a bzr:root revision property
+                set_skip_revprop(revnum, revprops)
+                continue
+            revmeta = repository._revmeta_provider.get_revision(bp, revnum, changes, revprops)
+            old_mapping = revmeta.get_original_mapping()
             if old_mapping is None:
-                # Not a bzr-svn revision
-                if not mapping.SVN_REVPROP_BZR_SKIP in revprops:
-                    repository.transport.change_rev_prop(revnum, mapping.SVN_REVPROP_BZR_SKIP, "")
+                set_skip_revprop(revnum, revprops)
                 continue
             if old_mapping == new_mapping:
                 # Already the latest mapping
                 continue
             assert old_mapping.can_use_revprops or bp is not None
             new_revprops = dict(revprops.iteritems())
-            revmeta = repository._revmeta_provider.get_revision(bp, revnum, changes, revprops, fileprops)
             rev = revmeta.get_revision(old_mapping)
             revno = graph.find_distance_to_null(rev.revision_id, [])
             assert bp is not None
             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(old_mapping.import_fileid_map(revprops, fileprops), 
+            new_mapping.export_fileid_map(revmeta.get_fileid_map(old_mapping),
                 new_revprops, None)
-            new_mapping.export_text_parents(old_mapping.import_text_parents(revprops, fileprops), new_revprops, None)
-            new_mapping.export_text_revisions(old_mapping.import_text_revisions(revprops, fileprops), new_revprops, None)
+            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)
             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