[PATCH] Added option to show bzr log entries in forward order

uws uws at xs4all.nl
Wed May 18 19:30:52 BST 2005


Hi all,

This patch adds a --direction option to the log command. Usage:

For reverse logs:
  bzr log                        # reverse is the default
  bzr log --direction=reverse
  bzr log --direction=r          # shorthand syntax

For forward logs:
  bzr log --direction=forward
  bzr log --direction=f          # shorthand syntax

Hope this helps.

  bye, Wouter

-- 
:wq

nobody loves me :: it's true :: not like you do                -- portishead
-------------- next part --------------
*** modified file 'bzrlib/commands.py'
--- bzrlib/commands.py 
+++ bzrlib/commands.py 
@@ -586,14 +586,13 @@
     """Show log of this branch.
 
     TODO: Option to limit range.
-
-    TODO: Option to show in forward order.
     """
     takes_args = ['filename?']
-    takes_options = ['timezone', 'verbose', 'show-ids']
-    def run(self, filename=None, timezone='original', verbose=False, show_ids=False):
+    takes_options = ['timezone', 'verbose', 'show-ids', 'direction']
+    def run(self, filename=None, timezone='original', verbose=False, \
+            show_ids=False, direction='reverse'):
         from bzrlib import show_log, find_branch
-        
+
         if filename:
             b = find_branch(filename, lock_mode='r')
             fp = b.relpath(filename)
@@ -605,11 +604,22 @@
             b = find_branch('.', lock_mode='r')
             file_id = None
 
+        reverse_values = ('reverse', 'r')
+        forward_values = ('forward', 'f')
+        if direction in reverse_values:
+            direction = 'reverse'
+        elif direction in forward_values:
+            direction = 'forward'
+        else:
+            bailout("invalid direction. try one of these: %s" % \
+                    ', '.join(reverse_values + forward_values))
+
         show_log(b, file_id,
                  show_timezone=timezone,
                  verbose=verbose,
                  show_ids=show_ids,
-                 to_file=sys.stdout)
+                 to_file=sys.stdout,
+                 direction=direction)
 
 
 
@@ -968,6 +978,7 @@
     'verbose':                None,
     'version':                None,
     'email':                  None,
+    'direction':              str,
     }
 
 SHORT_OPTIONS = {

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050518/48a17ccd/attachment.pgp 


More information about the bazaar mailing list