[Pkg-bazaar-commits] ./bzr/unstable r900: - patch from john to search for matching commits

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:21:23 UTC 2009


------------------------------------------------------------
revno: 900
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Mon 2005-07-11 16:41:00 +1000
message:
  - patch from john to search for matching commits
modified:
  NEWS
  bzrlib/commands.py
  bzrlib/log.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2005-07-11 03:40:02 +0000
+++ b/NEWS	2005-07-11 06:41:00 +0000
@@ -10,6 +10,9 @@
     * Commit mesage is fetched from an editor if not given on the
       command line; patch from Torsten Marek.
 
+    * ``bzr log -m FOO`` displays commits whose message matches regexp 
+      FOO.
+
   CHANGES:
 
     * When exporting to a tarball with ``bzr export --format tgz``, put 

=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2005-07-11 06:13:18 +0000
+++ b/bzrlib/commands.py	2005-07-11 06:41:00 +0000
@@ -887,18 +887,22 @@
     -r revision requests a specific revision, -r :end or -r begin: are
     also valid.
 
+    --message allows you to give a regular expression, which will be evaluated
+    so that only matching entries will be displayed.
+
     TODO: Make --revision support uuid: and hash: [future tag:] notation.
   
     """
 
     takes_args = ['filename?']
-    takes_options = ['forward', 'timezone', 'verbose', 'show-ids', 'revision','long']
+    takes_options = ['forward', 'timezone', 'verbose', 'show-ids', 'revision','long', 'message']
     
     def run(self, filename=None, timezone='original',
             verbose=False,
             show_ids=False,
             forward=False,
             revision=None,
+            message=None,
             long=False):
         from bzrlib.branch import find_branch
         from bzrlib.log import log_formatter, show_log
@@ -954,7 +958,8 @@
                  verbose=verbose,
                  direction=direction,
                  start_revision=rev1,
-                 end_revision=rev2)
+                 end_revision=rev2,
+                 search=message)
 
 
 

=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py	2005-06-29 04:11:40 +0000
+++ b/bzrlib/log.py	2005-07-11 06:41:00 +0000
@@ -89,7 +89,8 @@
              verbose=False,
              direction='reverse',
              start_revision=None,
-             end_revision=None):
+             end_revision=None,
+             search=None):
     """Write out human-readable log of commits to this branch.
 
     lf
@@ -124,6 +125,12 @@
     if specific_fileid:
         mutter('get log for file_id %r' % specific_fileid)
 
+    if search is not None:
+        import re
+        searchRE = re.compile(search, re.IGNORECASE)
+    else:
+        searchRE = None
+
     which_revs = branch.enum_history(direction)
     which_revs = [x for x in which_revs if (
             (start_revision is None or x[0] >= start_revision)
@@ -146,7 +153,8 @@
             # although we calculated it, throw it away without display
             delta = None
 
-        lf.show(revno, rev, delta)
+        if searchRE is None or searchRE.search(rev.message):
+            lf.show(revno, rev, delta)
 
 
 



More information about the Pkg-bazaar-commits mailing list