Rev 1950: Get most of the tree content reporting working. in file:///data/jelmer/bzr-svn/trunk/

Jelmer Vernooij jelmer at samba.org
Mon Oct 6 20:31:36 BST 2008


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

------------------------------------------------------------
revno: 1950
revision-id: jelmer at samba.org-20081006193135-x4cq7m0xb6tyx429
parent: jelmer at samba.org-20081006191601-c5lmu0rpdc6gfpdd
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Mon 2008-10-06 21:31:35 +0200
message:
  Get most of the tree content reporting working.
modified:
  server.py                      server.py-20081006150454-t45tvwmbhpesdh7d-1
  subvertpy/subvertpy/server.py  server.py-20081006143330-f9p0l7eih6izgoct-1
=== modified file 'server.py'
--- a/server.py	2008-10-06 18:46:13 +0000
+++ b/server.py	2008-10-06 19:31:35 +0000
@@ -16,6 +16,9 @@
 """Subversion server implementation."""
 
 from bzrlib.branch import Branch
+from bzrlib.inventory import Inventory
+
+from bzrlib.plugins.svn.commit import dir_editor_send_changes
 
 from subvertpy import NODE_DIR
 from subvertpy.server import SVNServer, ServerBackend, ServerRepositoryBackend
@@ -102,11 +105,31 @@
     def update(self, editor, revnum, target_path, recurse=True):
         if revnum is None:
             revnum = self.get_latest_revnum()
+        path, revid = self._get_revid(revnum)
         editor.set_target_revision(revnum)
         root = editor.open_root()
-        # FIXME
-        root.close()
-        editor.close()
+        old_inv = Inventory(None)
+        self.branch.repository.lock_read()
+        try:
+            new_tree = self.branch.repository.revision_tree(revid)
+            new_inv = new_tree.inventory
+            modified_files = {}
+            visit_dirs = set()
+            for name, ie in new_inv.iter_entries():
+                if ie.kind == "directory":
+                    visit_dirs.add(ie.file_id)
+                elif ie.kind == 'file':
+                    modified_files[ie.file_id] = new_tree.get_file_text(ie.file_id)
+                elif ie.kind == 'symlink':
+                    modified_files[ie.file_id] = "link %s" % ie.symlink_target
+
+            dir_editor_send_changes(old_inv, new_inv, "", new_inv.root.file_id, 
+                    root, "svn://localhost/", revnum-1, "trunk", 
+                                modified_files, visit_dirs)
+            root.close()
+            editor.close()
+        finally:
+            self.branch.repository.unlock()
 
     def check_path(self, path, revnum):
         return NODE_DIR

=== modified file 'subvertpy/subvertpy/server.py'
--- a/subvertpy/subvertpy/server.py	2008-10-06 18:57:02 +0000
+++ b/subvertpy/subvertpy/server.py	2008-10-06 19:31:35 +0000
@@ -360,8 +360,9 @@
                 return ret
             except NeedMoreData:
                 newdata = self.recv_fn(512)
-                self.mutter("IN: %r" % newdata)
-                self.inbuffer += newdata
+                if newdata != "":
+                    self.mutter("IN: %r" % newdata)
+                    self.inbuffer += newdata
             except MarshallError, e:
                 self.mutter('ERROR: %r' % e)
                 raise




More information about the bazaar-commits mailing list