[PATCH] diffing between revisions

Chris McCormick chris at mccormick.cx
Tue May 10 03:07:53 BST 2005


Just incase you are unable to move at will through space and time,
I've actually attached the patch to this one.

Chris.

On Tue, May 10, 2005 at 09:51:12AM +0800, Chris McCormick wrote:
> Hey,
> 
> This adds the ability to specify a third argument to show_diff() which
> is from_revision=None which if set to some int other than None
> will look up that revision to patch against. Needed so I can just wrap
> cmd_diff() for the web interface. I couldn't see the right place to
> write test cases for this change (but maybe I'm blind).
> 
> Best,
> 
> Chris.
> -------------------
> chris at mccormick.cx
> http://mccormick.cx
> 
> -- 
> bazaar-ng mailing list
> bazaar-ng at lists.canonical.com
> http://lists.canonical.com/mailman/listinfo/bazaar-ng
-------------------
chris at mccormick.cx
http://mccormick.cx
-------------- next part --------------
*** modified file 'bzrlib/diff.py'
--- bzrlib/diff.py 
+++ bzrlib/diff.py 
@@ -140,15 +140,20 @@
 
 
 
-def show_diff(b, revision, file_list):
+def show_diff(b, revision, file_list=None, from_revision=None):
     import difflib, sys, types
     
     if revision == None:
         old_tree = b.basis_tree()
     else:
         old_tree = b.revision_tree(b.lookup_revision(revision))
-        
-    new_tree = b.working_tree()
+    
+    if (from_revision):
+        new_tree = b.revision_tree(b.lookup_revision(from_revision))
+    else:
+        new_tree = b.working_tree()
+
+    # new_tree = b.working_tree()
 
     # TODO: Options to control putting on a prefix or suffix, perhaps as a format string
     old_label = ''


More information about the bazaar mailing list