Rev 511: Deal with working trees in svn-upgrade. in file:///data/jelmer/bzr-svn/0.4/

Jelmer Vernooij jelmer at samba.org
Thu Jul 12 09:28:35 BST 2007


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

------------------------------------------------------------
revno: 511
revision-id: jelmer at samba.org-20070704231159-js1y7mxto2gkfg90
parent: jelmer at samba.org-20070704213340-2vdea0othb2leoms
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Thu 2007-07-05 01:11:59 +0200
message:
  Deal with working trees in svn-upgrade.
modified:
  TODO                           todo-20060729211917-2kpobww0zyvvo0j2-1
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
=== modified file 'TODO'
--- a/TODO	2007-06-25 00:34:58 +0000
+++ b/TODO	2007-07-04 23:11:59 +0000
@@ -6,6 +6,7 @@
 - report changes to delta editor in Branch.pull()
 - more blackbox tests
 - integrate bzr:merge into bzr:revision-info or rename to bzr:merge-vXXYY
+- transform file ids in workingtree in svn-upgrade
 
 Working trees:
 - custom implementation of WorkingTree.revert() / WorkingTree.merge()

=== modified file '__init__.py'
--- a/__init__.py	2007-07-02 22:09:13 +0000
+++ b/__init__.py	2007-07-04 23:11:59 +0000
@@ -168,8 +168,14 @@
     @display_command
     def run(self, svn_repository=None, allow_changes=False):
         from upgrade import upgrade_branch
-        
-        branch_to = Branch.open(".")
+        from bzrlib.errors import NoWorkingTree
+        from bzrlib.workingtree import WorkingTree
+        try:
+            wt_to = WorkingTree.open(".")
+            branch_to = wt_to.branch
+        except NoWorkingTree:
+            wt_to = None
+            branch_to = Branch.open(".")
 
         stored_loc = branch_to.get_parent()
         if svn_repository is None:
@@ -180,10 +186,14 @@
                 display_url = urlutils.unescape_for_display(stored_loc,
                         self.outf.encoding)
                 self.outf.write("Using saved location: %s\n" % display_url)
-                svn_repository = stored_loc
-
-        upgrade_branch(branch_to, Repository.open(svn_repository), 
-                       allow_changes)
+                svn_repository = Branch.open(stored_loc).repository
+        else:
+            svn_repository = Repository.open(svn_repository)
+
+        upgrade_branch(branch_to, svn_repository, allow_changes)
+
+        if wt_to is not None:
+            wt_to.set_last_revision(branch_to.last_revision())
 
 register_command(cmd_svn_upgrade)
 




More information about the bazaar-commits mailing list