[Pkg-bazaar-commits] ./bzr/unstable r367: - New --show-ids option for bzr log

Martin Pool mbp at sourcefrog.net
Fri Apr 10 07:52:03 UTC 2009


------------------------------------------------------------
revno: 367
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Thu 2005-05-05 16:51:01 +1000
message:
  - New --show-ids option for bzr log
modified:
  NEWS
  bzrlib/branch.py
  bzrlib/commands.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2005-05-05 03:34:34 +0000
+++ b/NEWS	2005-05-05 06:51:01 +0000
@@ -15,6 +15,8 @@
     * Per-branch locks keyed on ``.bzr/branch-lock``, available in
       either read or write mode.
 
+    * New option ``bzr log --show-ids``.
+
   TESTING:
 
     * Converted black-box test suites from Bourne shell into Python;

=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2005-05-05 06:45:22 +0000
+++ b/bzrlib/branch.py	2005-05-05 06:51:01 +0000
@@ -773,14 +773,20 @@
 
 
 
-    def write_log(self, show_timezone='original', verbose=False):
+    def write_log(self, show_timezone='original', verbose=False,
+                  show_ids=False):
         """Write out human-readable log of commits to this branch.
 
-        show_timezone -- may be 'original' (committer's timezone),
-            'utc' (universal time), or 'local' (local user's timezone)
-
-        verbose -- if true, also list which files were changed in each
-            revision.
+        show_timezone
+            'original' (committer's timezone),
+            'utc' (universal time), or
+            'local' (local user's timezone)
+
+        verbose
+            If true show added/changed/deleted/renamed files.
+
+        show_ids
+            If true, show revision and file ids.
         """
         
         self._need_readlock()
@@ -789,9 +795,9 @@
         for p in self.revision_history():
             print '-' * 40
             print 'revno:', revno
-            ## TODO: Show hash if --id is given.
-            ##print 'revision-hash:', p
             rev = self.get_revision(p)
+            if show_ids:
+                print 'revision-id:', rev.revision_id
             print 'committer:', rev.committer
             print 'timestamp: %s' % (format_date(rev.timestamp, rev.timezone or 0,
                                                  show_timezone))
@@ -808,6 +814,8 @@
                     print '  ' + l
 
             if verbose == True and precursor != None:
+                # TODO: Group as added/deleted/renamed instead
+                # TODO: Show file ids
                 print 'changed files:'
                 tree = self.revision_tree(p)
                 prevtree = self.revision_tree(precursor)

=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2005-05-05 06:14:53 +0000
+++ b/bzrlib/commands.py	2005-05-05 06:51:01 +0000
@@ -416,11 +416,19 @@
 class cmd_log(Command):
     """Show log of this branch.
 
-    TODO: Options to show ids; to limit range; etc.
+    TODO: Option to limit range.
+
+    TODO: Perhaps show most-recent first with an option for last.
+
+    TODO: Option to limit to only a single file or to get log for a
+          different directory.
     """
-    takes_options = ['timezone', 'verbose']
-    def run(self, timezone='original', verbose=False):
-        Branch('.', lock_mode='r').write_log(show_timezone=timezone, verbose=verbose)
+    takes_options = ['timezone', 'verbose', 'show-ids']
+    def run(self, timezone='original', verbose=False, show_ids=False):
+        b = Branch('.', lock_mode='r')
+        b.write_log(show_timezone=timezone,
+                    verbose=verbose,
+                    show_ids=show_ids)
 
 
 class cmd_ls(Command):



More information about the Pkg-bazaar-commits mailing list