Rev 3985: (Neil Martinsen-Burrell) Add custom properties handling to short log in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sun Feb 8 13:33:11 GMT 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3985
revision-id: pqm at pqm.ubuntu.com-20090208133308-rn4wcu897hduyl2d
parent: pqm at pqm.ubuntu.com-20090205215322-dlhyepy2fid5i7w6
parent: jelmer at samba.org-20090208120124-yi4fukycecd16qrn
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sun 2009-02-08 13:33:08 +0000
message:
  (Neil Martinsen-Burrell) Add custom properties handling to short log
  	format.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
  bzrlib/tests/test_log.py       testlog.py-20050728115707-1a514809d7d49309
    ------------------------------------------------------------
    revno: 3976.3.3
    revision-id: jelmer at samba.org-20090208120124-yi4fukycecd16qrn
    parent: nmb at wartburg.edu-20090205034455-timja65lybsk0yd6
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: short-log-foreign
    timestamp: Sun 2009-02-08 13:01:24 +0100
    message:
      remove a tab character.
    modified:
      bzrlib/tests/test_log.py       testlog.py-20050728115707-1a514809d7d49309
    ------------------------------------------------------------
    revno: 3976.3.2
    revision-id: nmb at wartburg.edu-20090205034455-timja65lybsk0yd6
    parent: nmb at wartburg.edu-20090205033036-a14ugk99kprd6o1w
    committer: Neil Martinsen-Burrell <nmb at wartburg.edu>
    branch nick: short-log-foreign
    timestamp: Wed 2009-02-04 21:44:55 -0600
    message:
      Change the NEWS file because of changing the output of a user-visible command
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3976.3.1
    revision-id: nmb at wartburg.edu-20090205033036-a14ugk99kprd6o1w
    parent: pqm at pqm.ubuntu.com-20090131231933-8o4phfvmuuizyyn6
    committer: Neil Martinsen-Burrell <nmb at wartburg.edu>
    branch nick: short-log-foreign
    timestamp: Wed 2009-02-04 21:30:36 -0600
    message:
      Add custom properties handling to short log format
    modified:
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/tests/test_log.py       testlog.py-20050728115707-1a514809d7d49309
=== modified file 'NEWS'
--- a/NEWS	2009-02-05 10:20:51 +0000
+++ b/NEWS	2009-02-08 13:33:08 +0000
@@ -19,6 +19,11 @@
       from this command, you may need to adjust them accordingly.
       (Ian Clatworthy)
 
+    * ``bzr log --short`` now shows any additional revision properties
+      after the date and before the commit message.  Scripts that parse 
+      output of the log command in this situation may need to adjust.
+      (Neil Martinsen-Burrell)
+
   NEW FEATURES:
 
     * Add support for filtering `bzr missing` on revisions.  Remote revisions

=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py	2009-02-02 08:28:54 +0000
+++ b/bzrlib/log.py	2009-02-08 13:33:08 +0000
@@ -1294,6 +1294,7 @@
                             self.show_timezone, date_fmt="%Y-%m-%d",
                             show_offset=False),
                 tags, is_merge))
+        self.show_properties(revision.rev, indent+offset)
         if self.show_ids:
             to_file.write(indent + offset + 'revision-id:%s\n'
                           % (revision.rev.revision_id,))

=== modified file 'bzrlib/tests/test_log.py'
--- a/bzrlib/tests/test_log.py	2009-01-31 04:17:43 +0000
+++ b/bzrlib/tests/test_log.py	2009-02-08 13:33:08 +0000
@@ -735,6 +735,41 @@
 ''',
                                  sio.getvalue())
 
+    def test_properties_in_short_log(self):
+        """Log includes the custom properties returned by the registered 
+        handlers.
+        """
+        wt = self.make_branch_and_tree('.')
+        b = wt.branch
+        self.build_tree(['a'])
+        wt.add('a')
+        b.nick = 'test_properties_in_short_log'
+        wt.commit(message='add a',
+                  timestamp=1132711707,
+                  timezone=36000,
+                  committer='Lorem Ipsum <test at example.com>',
+                  author='John Doe <jdoe at example.com>')
+        sio = StringIO()
+        formatter = log.ShortLogFormatter(to_file=sio)
+        try:
+            def trivial_custom_prop_handler(revision):
+                return {'test_prop':'test_value'}
+
+            log.properties_handler_registry.register(
+                'trivial_custom_prop_handler',
+                trivial_custom_prop_handler)
+            log.show_log(b, formatter)
+        finally:
+            log.properties_handler_registry.remove(
+                'trivial_custom_prop_handler')
+            self.assertEqualDiff('''\
+    1 John Doe\t2005-11-23
+      test_prop: test_value
+      add a
+
+''',
+                                 sio.getvalue())
+
     def test_error_in_properties_handler(self):
         """Log includes the custom properties returned by the registered 
         handlers.




More information about the bazaar-commits mailing list