Rev 640: Avoid direct use of the scheme API in a couple more places. in file:///data/jelmer/bzr-svn/noschemes/

Jelmer Vernooij jelmer at samba.org
Sun Feb 3 15:02:26 GMT 2008


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

------------------------------------------------------------
revno: 640
revision-id:jelmer at samba.org-20080203150225-l8qjw2lcvugoza9f
parent: jelmer at samba.org-20080203145527-a2gsjfajwqviy1s7
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: noschemes
timestamp: Sun 2008-02-03 16:02:25 +0100
message:
  Avoid direct use of the scheme API in a couple more places.
modified:
  upgrade.py                     upgrade.py-20070106192108-0rakplee2lzah4gs-1
  workingtree.py                 workingtree.py-20060306120941-b083cb0fdd4a69de
=== modified file 'upgrade.py'
--- a/upgrade.py	2008-02-03 03:08:33 +0000
+++ b/upgrade.py	2008-02-03 15:02:25 +0000
@@ -100,7 +100,7 @@
         raise UpgradeChangesContent(oldrev.revision_id)
 
 
-def generate_upgrade_map(revs):
+def generate_upgrade_map(new_mapping, revs):
     rename_map = {}
     pb = ui.ui_factory.nested_progress_bar()
     # Create a list of revisions that can be renamed during the upgade
@@ -112,8 +112,6 @@
             except InvalidRevisionId:
                 # Not a bzr-svn revision, nothing to do
                 continue
-            if mapping.scheme is None:
-                scheme = guess_scheme_from_branch_path(bp)
             newrevid = new_mapping.generate_revision_id(uuid, rev, bp)
             if revid == newrevid:
                 continue
@@ -136,13 +134,14 @@
 
 
 def create_upgrade_plan(repository, svn_repository, revision_id=None,
-                        allow_changes=False):
+                        new_mapping=None, allow_changes=False):
     """Generate a rebase plan for upgrading revisions.
 
     :param repository: Repository to do upgrade in
     :param svn_repository: Subversion repository to fetch new revisions from.
     :param revision_id: Revision to upgrade (None for all revisions in 
         repository.)
+    :param new_mapping: New mapping to use.
     :param allow_changes: Whether an upgrade is allowed to change the contents
         of revisions.
     :return: Tuple with a rebase plan and map of renamed revisions.
@@ -150,8 +149,11 @@
     from bzrlib.plugins.rebase.rebase import generate_transpose_plan
     check_rebase_version()
 
+    if new_mapping is None:
+        new_mapping = svn_repository.get_mapping() # FIXME?
+
     graph = repository.get_revision_graph(revision_id)
-    upgrade_map = generate_upgrade_map(graph.keys())
+    upgrade_map = generate_upgrade_map(new_mapping, graph.keys())
    
     # Make sure all the required current version revisions are present
     for revid in upgrade_map.values():

=== modified file 'workingtree.py'
--- a/workingtree.py	2008-02-03 03:08:33 +0000
+++ b/workingtree.py	2008-02-03 15:02:25 +0000
@@ -440,7 +440,7 @@
             extra = ""
         wc = self._get_wc(write_lock=True)
         try:
-            svn.wc.prop_set(SVN_PROP_BZR_REVISION_ID+str(self.branch.scheme), 
+            svn.wc.prop_set(SVN_PROP_BZR_REVISION_ID+str(self.branch.mapping.scheme), 
                              self._get_bzr_revids() + extra,
                              self.basedir, wc)
             svn.wc.prop_set(SVN_PROP_BZR_REVISION_INFO, 
@@ -464,7 +464,7 @@
             # Reset properties so the next subversion commit won't 
             # accidently set these properties.
             wc = self._get_wc(write_lock=True)
-            svn.wc.prop_set(SVN_PROP_BZR_REVISION_ID+str(self.branch.scheme), 
+            svn.wc.prop_set(SVN_PROP_BZR_REVISION_ID+str(self.branch.mapping.scheme), 
                              self._get_bzr_revids(), self.basedir, wc)
             svn.wc.prop_set(SVN_PROP_BZR_REVISION_INFO, 
                 self.branch.repository.branchprop_list.get_property(
@@ -615,12 +615,12 @@
         return self.branch.repository.branchprop_list.get_property(
                 self.branch.get_branch_path(self.base_revnum), 
                 self.base_revnum, 
-                SVN_PROP_BZR_REVISION_ID+str(self.branch.scheme), "")
+                SVN_PROP_BZR_REVISION_ID+str(self.branch.mapping.scheme), "")
 
     def _get_bzr_merges(self):
         return self.branch.repository.branchprop_list.get_property(
                 self.branch.get_branch_path(self.base_revnum), 
-                self.base_revnum, SVN_PROP_BZR_ANCESTRY+str(self.branch.scheme), "")
+                self.base_revnum, SVN_PROP_BZR_ANCESTRY+str(self.branch.mapping.scheme), "")
 
     def _get_svk_merges(self):
         return self.branch.repository.branchprop_list.get_property(
@@ -637,7 +637,7 @@
             else:
                 bzr_merge = ""
 
-            svn.wc.prop_set(SVN_PROP_BZR_ANCESTRY+str(self.branch.scheme), 
+            svn.wc.prop_set(SVN_PROP_BZR_ANCESTRY+str(self.branch.mapping.scheme), 
                                  self._get_bzr_merges() + bzr_merge, 
                                  self.basedir, wc)
 
@@ -665,7 +665,7 @@
         wc = self._get_wc()
         try:
             merged_data = svn.wc.prop_get(
-                SVN_PROP_BZR_ANCESTRY+str(self.branch.scheme), self.basedir, wc)
+                SVN_PROP_BZR_ANCESTRY+str(self.branch.mapping.scheme), self.basedir, wc)
             if merged_data is None:
                 set_merged = []
             else:




More information about the bazaar-commits mailing list