[PATCH][RFC] Make log filename faster

Robert Collins robertc at robertcollins.net
Wed Mar 29 08:47:55 BST 2006


This trivial patch changes the 'log filename' behaviour to filter the
revisions by the versioned-file index of the file in question.

It works but ...

Its a bit non obvious to not show the mainline commit where the change
was merged into the mainline - which this results in.

One way to address this is to 'promote' a selected revision which is at
a merge depth of [say] 2 and to force its parent at depth 1 and thats
parent at depth 0 to also be shown. But this is wrong: if the change is
reverted, it may in fact not ever have reached the mainline.

So the question resolves around 'what does it mean to do "log
FILENAME"' ?

Thoughts?

Rob

=== modified file 'a/bzrlib/log.py'  
--- a/bzrlib/log.py
+++ b/bzrlib/log.py
@@ -232,6 +232,14 @@
     for index, rev_id in cut_revs:  
         rev_nos[rev_id] = index

+    # generate a subset of revisions to report on if a specific file id
has
+    # been requested.
+    if specific_fileid:
+        fileid_revisions = branch.repository.weave_store.get_weave(
+            specific_fileid,
branch.repository.get_transaction()).versions()
+    else:
+        fileid_revisions = None
+
     # now we just print all the revisions
     for sequence, rev_id, merge_depth, end_of_merge in
merge_sorted_revisions:
         rev = branch.repository.get_revision(rev_id)
@@ -240,15 +248,15 @@
             if not searchRE.search(rev.message):
                 continue

+        if specific_fileid:
+            if not rev_id in fileid_revisions:
+                continue
+
         if merge_depth == 0:
             # a mainline revision.
-            if verbose or specific_fileid:
+            if verbose:
                 delta = _get_revision_delta(branch, rev_nos[rev_id])

-            if specific_fileid:
-                if not delta.touches_file_id(specific_fileid):
-                    continue
-
             if not verbose:
                 # although we calculated it, throw it away without
display
                 delta = None



-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060329/1392e306/attachment.pgp 


More information about the bazaar mailing list