Rev 1973: Fix last convert test. in file:///data/jelmer/bzr-svn/trunk/

Jelmer Vernooij jelmer at samba.org
Mon Nov 10 05:10:31 GMT 2008


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

------------------------------------------------------------
revno: 1973
revision-id: jelmer at samba.org-20081110051027-musv6tajvhlozrf3
parent: jelmer at samba.org-20081110044930-slqzvj7wkekn0lxg
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Mon 2008-11-10 06:10:27 +0100
message:
  Fix last convert test.
modified:
  convert.py                     svn2bzr.py-20051018015439-cb4563bff29e632d
=== modified file 'convert.py'
--- a/convert.py	2008-11-10 04:49:30 +0000
+++ b/convert.py	2008-11-10 05:10:27 +0000
@@ -129,6 +129,15 @@
         branches, should be imported
     :param format: Format to use
     """
+    def remove_branches(to_transport, removed_branches):
+        # Remove removed branches
+        for bp in removed_branches:
+            # TODO: Perhaps check if path is a valid branch with the right last
+            # revid?
+            fullpath = to_transport.local_abspath(bp)
+            if not os.path.isdir(fullpath):
+                continue
+            osutils.rmtree(fullpath)
     assert not all or create_shared_repo
     if format is None:
         format = get_rich_root_format()
@@ -180,7 +189,7 @@
             removed_branches = source_repos.find_deleted_branches_between(layout=layout, 
                 from_revnum=from_revnum, to_revnum=to_revnum, project=project)
         else:
-            removed_branches = []
+            removed_branches = set([])
         mapping = source_repos.get_mapping()
         revmetas = []
         existing_branches = {}
@@ -218,14 +227,7 @@
                 inter.fetch(revmetas=revmetas, mapping=source_repos.get_mapping())
 
         if not keep:
-            # Remove removed branches
-            for bp in removed_branches:
-                # TODO: Perhaps check if path is a valid branch with the right last
-                # revid?
-                fullpath = to_transport.local_abspath(bp)
-                if not os.path.isdir(fullpath):
-                    continue
-                osutils.rmtree(fullpath)
+            remove_branches(to_transport, removed_branches)
 
         source_graph = source_repos.get_graph()
         pb = ui.ui_factory.nested_progress_bar()
@@ -261,6 +263,9 @@
     finally:
         source_repos.unlock()
 
+    if not keep:
+        remove_branches(to_transport, removed_branches)
+
     if target_repos is not None:
         put_latest_svn_import_revision(target_repos, source_repos.uuid, to_revnum)
         




More information about the bazaar-commits mailing list