Rev 1120: finish implementation of checkout function in python. in http://people.samba.org/bzr/jelmer/bzr-svn/cext

Jelmer Vernooij jelmer at samba.org
Fri Jul 4 06:06:53 BST 2008


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

------------------------------------------------------------
revno: 1120
revision-id: jelmer at samba.org-20080704050647-l3nffvkflhqyuq1c
parent: jelmer at samba.org-20080704044712-k2nrluj143dk2c6j
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: cext
timestamp: Fri 2008-07-04 07:06:47 +0200
message:
  finish implementation of checkout function in python.
modified:
  branch.py                      svnbranch.py-20051017135706-11c749eb0dab04a7
=== modified file 'branch.py'
--- a/branch.py	2008-07-04 04:35:32 +0000
+++ b/branch.py	2008-07-04 05:06:47 +0000
@@ -178,7 +178,8 @@
 
         :param relpath: path from the repository root.
         """
-        assert relpath.startswith(self.get_branch_path())
+        assert relpath.startswith(self.get_branch_path()), \
+                "expected %s prefix, got %s" % (self.get_branch_path(), relpath)
         return relpath[len(self.get_branch_path()):].strip("/")
 
     def get_branch_path(self, revnum=None):
@@ -262,17 +263,20 @@
         else:
             revnum = self.get_revnum()
 
+        svn_url = bzr_to_svn_url(self.base)
         os.mkdir(to_location)
-        svn_url = bzr_to_svn_url(self.base)
-        wc.ensure_adm(to_location, self.repository.uuid, bzr_to_svn_url(self.base),
-                      svn_url, revnum)
-        adm = wc.WorkingCopy(None, to_location)
-        conn = self.repository.transport.get_connection()
+        wc.ensure_adm(to_location, self.repository.uuid, svn_url,
+                      bzr_to_svn_url(self.repository.base), revnum)
+        adm = wc.WorkingCopy(None, to_location, write_lock=True)
         try:
-            update_wc(adm, to_location, conn, revnum)
+            conn = self.repository.transport.connections.get(svn_url)
+            try:
+                update_wc(adm, to_location, conn, revnum)
+            finally:
+                if not conn.busy:
+                    self.repository.transport.add_connection(conn)
         finally:
-            if not conn.busy:
-                self.repository.transport.add_connection(conn)
+            adm.close()
         wt = WorkingTree.open(to_location)
         return wt
 




More information about the bazaar-commits mailing list