Rev 1935: Support log -v. in file:///data/jelmer/bzr-svn/trunk/

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


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

------------------------------------------------------------
revno: 1935
revision-id: jelmer at samba.org-20081006163629-o75p6xhb08efw9t6
parent: jelmer at samba.org-20081006154231-0f588k3sbms4gh0y
parent: jelmer at samba.org-20081006155633-62a058iac22ltfrg
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Mon 2008-10-06 18:36:29 +0200
message:
  Support log -v.
modified:
  server.py                      server.py-20081006150454-t45tvwmbhpesdh7d-1
  subvertpy/subvertpy/marshall.py marshall.py-20081006140850-jzf2dbt55rwefdqm-1
  subvertpy/subvertpy/server.py  server.py-20081006143330-f9p0l7eih6izgoct-1
    ------------------------------------------------------------
    revno: 1925.1.22
    revision-id: jelmer at samba.org-20081006155633-62a058iac22ltfrg
    parent: jelmer at samba.org-20081006155536-muiy5an0g29fbi8m
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Mon 2008-10-06 17:56:33 +0200
    message:
      Allow clients to send more arguments to log.
    modified:
      subvertpy/server.py            server.py-20081006143330-f9p0l7eih6izgoct-1
    ------------------------------------------------------------
    revno: 1925.1.21
    revision-id: jelmer at samba.org-20081006155536-muiy5an0g29fbi8m
    parent: jelmer at samba.org-20081006155512-1xvvy7by3ka8z2zx
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Mon 2008-10-06 17:55:36 +0200
    message:
      Allow reporting changed paths.
    modified:
      subvertpy/server.py            server.py-20081006143330-f9p0l7eih6izgoct-1
    ------------------------------------------------------------
    revno: 1925.1.20
    revision-id: jelmer at samba.org-20081006155512-1xvvy7by3ka8z2zx
    parent: jelmer at samba.org-20081006153317-9upi10nu9kg8v4ah
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Mon 2008-10-06 17:55:12 +0200
    message:
      Allow reporting changed paths.
    modified:
      subvertpy/server.py            server.py-20081006143330-f9p0l7eih6izgoct-1
=== modified file 'server.py'
--- a/server.py	2008-10-06 15:42:31 +0000
+++ b/server.py	2008-10-06 16:36:29 +0000
@@ -18,9 +18,28 @@
 from bzrlib.branch import Branch
 
 from subvertpy.server import SVNServer, ServerBackend, ServerRepositoryBackend
+from subvertpy.properties import time_to_cstring
 
 import os, time
 
+def determine_changed_paths(repository, branch_path, rev, revno):
+    def fixpath(p):
+        return "%s/%s" % (branch_path, p.encode("utf-8"))
+    changes = {}
+    changes[branch_path] = ("M", None, -1) # Always changes
+    delta = repository.get_revision_delta(rev.revision_id)
+    for (path, id, kind) in delta.added:
+        changes[fixpath(path)] = ("A", None, -1)
+    for (path, id, kind) in delta.removed:
+        changes[fixpath(path)] = ("D", None, -1)
+    for (oldpath, newpath, id, kind, text_modified, meta_modified) in delta.renamed:
+        changes[fixpath(newpath)] = ("A", fixpath(oldpath), revno-1)
+        changes[fixpath(oldpath)] = ("D", None, -1)
+    for (path, id, kind, text_modified, meta_modified) in delta.modified:
+        changes[fixpath(path)] = ("M", None, -1)
+    return changes
+
+
 class RepositoryBackend(ServerRepositoryBackend):
 
     def __init__(self, branch):
@@ -38,7 +57,7 @@
     def get_latest_revnum(self):
         return self.branch.revno()
 
-    def log(self, send_revision, target_path, start_rev, end_rev, changed_paths,
+    def log(self, send_revision, target_path, start_rev, end_rev, report_changed_paths,
             strict_node, limit):
         i = 0
         revno = start_rev
@@ -53,9 +72,15 @@
                     revno-=1
                 if limit != 0 and i == limit:
                     break
-                if revno != 0:
+                if revno > 0:
                     rev = self.branch.repository.get_revision(self.branch.get_rev_id(revno))
-                    send_revision(revno, rev.committer.encode("utf-8"), time.strftime("%Y-%m-%dT%H:%M:%S.00000Z", time.gmtime(rev.timestamp)), rev.message.encode("utf-8"))
+                    if report_changed_paths:
+                        changes = determine_changed_paths(self.branch.repository, "/trunk", rev, revno)
+                    else:
+                        changes = None
+                    send_revision(revno, 
+                            rev.committer, time.strftime("%Y-%m-%dT%H:%M:%S.00000Z", time.gmtime(rev.timestamp)),
+                            rev.message, changed_paths=changes)
         finally:
             self.branch.repository.unlock()
     

=== modified file 'subvertpy/subvertpy/marshall.py'
--- a/subvertpy/subvertpy/marshall.py	2008-10-06 14:10:31 +0000
+++ b/subvertpy/subvertpy/marshall.py	2008-10-06 16:36:29 +0000
@@ -50,8 +50,10 @@
         return "( " + "".join(map(marshall, x)) + ") "
     elif isinstance(x, literal):
         return "%s " % x
-    elif isinstance(x, basestring):
+    elif isinstance(x, str):
         return "%d:%s " % (len(x), x)
+    elif isinstance(x, unicode):
+        return "%d:%s " % (len(x), x.encode("utf-8"))
     raise MarshallError("Unable to marshall type %s" % x)
 
 

=== modified file 'subvertpy/subvertpy/server.py'
--- a/subvertpy/subvertpy/server.py	2008-10-06 15:42:31 +0000
+++ b/subvertpy/subvertpy/server.py	2008-10-06 16:36:29 +0000
@@ -82,12 +82,18 @@
     def log(self, target_path, start_rev, end_rev, changed_paths, 
             strict_node, limit=None, include_merged_revisions=False, 
             all_revprops=None, revprops=None):
-        def send_revision(revno, author, date, message):
-            self.send_msg([[], revno, [author], [date], [message]])
+        def send_revision(revno, author, date, message, changed_paths=None):
+            changes = []
+            if changed_paths is not None:
+                for p, (action, cf, cr) in changed_paths.items():
+                    if cf is not None:
+                        changes.append((p, literal(action), (cf, cr)))
+                    else:
+                        changes.append((p, literal(action), ()))
+            self.send_msg([changes, revno, [author], [date], [message]])
         self.send_success([], "")
         self.repo_backend.log(send_revision, target_path, start_rev[0], 
-                              end_rev[0],
-                              changed_paths, strict_node, limit)
+                              end_rev[0], changed_paths, strict_node, limit)
         self.send_msg(literal("done"))
         self.send_success()
 




More information about the bazaar-commits mailing list