Rev 2503: (John Arbash Meinel) add [merge] for short log messages in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sat Jun 2 00:10:20 BST 2007


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

------------------------------------------------------------
revno: 2503
revision-id: pqm at pqm.ubuntu.com-20070601231018-i374u1n4yt6rpg7x
parent: pqm at pqm.ubuntu.com-20070601221655-eeiryluirj5h73hp
parent: john at arbash-meinel.com-20070601214045-zalht5mx39yg11l6
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2007-06-02 00:10:18 +0100
message:
  (John Arbash Meinel) add [merge] for short log messages
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
  bzrlib/tests/test_log.py       testlog.py-20050728115707-1a514809d7d49309
    ------------------------------------------------------------
    revno: 2483.2.5
    merged: john at arbash-meinel.com-20070601214045-zalht5mx39yg11l6
    parent: john at arbash-meinel.com-20070508220459-wvpmol3nkg91j5e6
    parent: pqm at pqm.ubuntu.com-20070601212622-4hy742yfww9270dw
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: log_short_merges_83887
    timestamp: Fri 2007-06-01 16:40:45 -0500
    message:
      [merge] bzr.dev 2501
    ------------------------------------------------------------
    revno: 2483.2.4
    merged: john at arbash-meinel.com-20070508220459-wvpmol3nkg91j5e6
    parent: john at arbash-meinel.com-20070508220207-yvs5og03igv48k5g
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: log_short_merges_83887
    timestamp: Tue 2007-05-08 17:04:59 -0500
    message:
      Update NEWS to include a reference to bug #83887
      (which is actually a minor feature request)
    ------------------------------------------------------------
    revno: 2483.2.3
    merged: john at arbash-meinel.com-20070508220207-yvs5og03igv48k5g
    parent: john at arbash-meinel.com-20070508201017-w968czcnrzvjttze
    parent: pqm at pqm.ubuntu.com-20070508203256-wcxwdphd1y2psezh
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: log_short_merges_83887
    timestamp: Tue 2007-05-08 17:02:07 -0500
    message:
      [merge] bzr.dev 2484
    ------------------------------------------------------------
    revno: 2483.2.2
    merged: john at arbash-meinel.com-20070508201017-w968czcnrzvjttze
    parent: john at arbash-meinel.com-20070508193100-64xg2gv8oc40tiri
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: log_short_merges_83887
    timestamp: Tue 2007-05-08 15:10:17 -0500
    message:
      Add [merge] after the timestamp for revisions with merges.
    ------------------------------------------------------------
    revno: 2483.2.1
    merged: john at arbash-meinel.com-20070508193100-64xg2gv8oc40tiri
    parent: pqm at pqm.ubuntu.com-20070507175017-mvwcdqzq0w4z36lr
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: log_short_merges_83887
    timestamp: Tue 2007-05-08 14:31:00 -0500
    message:
      Add a test with a merged revision
      now we need to figure out what it should look like :)
=== modified file 'NEWS'
--- a/NEWS	2007-06-01 22:16:55 +0000
+++ b/NEWS	2007-06-01 23:10:18 +0000
@@ -24,6 +24,11 @@
     * Revert does not try to preserve file contents that were originally
       produced by reverting to a historical revision.  (Aaron Bentley)
 
+    * ``bzr log --short`` now includes ``[merge]`` for revisions which
+      have more than one parent. This is a small improvement to help
+      understanding what changes have occurred
+      (John Arbash Meinel, #83887)
+
   BUGFIXES:
 
     * ``bzr push`` should only connect to the remote location one time.

=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py	2007-05-25 04:00:47 +0000
+++ b/bzrlib/log.py	2007-06-01 21:40:45 +0000
@@ -567,15 +567,19 @@
         from bzrlib.osutils import format_date
 
         to_file = self.to_file
-        date_str = format_date(revision.rev.timestamp, 
+        date_str = format_date(revision.rev.timestamp,
                                revision.rev.timezone or 0,
                                self.show_timezone)
-        print >>to_file, "%5s %s\t%s" % (revision.revno, 
+        is_merge = ''
+        if len(revision.rev.parent_ids) > 1:
+            is_merge = ' [merge]'
+        print >>to_file, "%5s %s\t%s%s" % (revision.revno,
                 self.short_committer(revision.rev),
-                format_date(revision.rev.timestamp, 
+                format_date(revision.rev.timestamp,
                             revision.rev.timezone or 0,
                             self.show_timezone, date_fmt="%Y-%m-%d",
-                            show_offset=False))
+                            show_offset=False),
+                is_merge)
         if self.show_ids:
             print >>to_file,  '      revision-id:', revision.rev.revision_id
         if not revision.rev.message:

=== modified file 'bzrlib/tests/test_log.py'
--- a/bzrlib/tests/test_log.py	2007-05-24 12:13:06 +0000
+++ b/bzrlib/tests/test_log.py	2007-06-01 21:40:45 +0000
@@ -280,6 +280,37 @@
         log_contents = logfile.read()
         self.assertEqualDiff(log_contents, '1: Line-Log-Formatte... 2005-11-23 add a\n')
 
+    def test_short_log_with_merges(self):
+        wt = self.make_branch_and_memory_tree('.')
+        wt.lock_write()
+        try:
+            wt.add('')
+            wt.commit('rev-1', rev_id='rev-1',
+                      timestamp=1132586655, timezone=36000,
+                      committer='Joe Foo <joe at foo.com>')
+            wt.commit('rev-merged', rev_id='rev-2a',
+                      timestamp=1132586700, timezone=36000,
+                      committer='Joe Foo <joe at foo.com>')
+            wt.set_parent_ids(['rev-1', 'rev-2a'])
+            wt.branch.set_last_revision_info(1, 'rev-1')
+            wt.commit('rev-2', rev_id='rev-2b',
+                      timestamp=1132586800, timezone=36000,
+                      committer='Joe Foo <joe at foo.com>')
+            logfile = StringIO()
+            formatter = ShortLogFormatter(to_file=logfile)
+            show_log(wt.branch, formatter)
+            logfile.flush()
+            self.assertEqualDiff("""\
+    2 Joe Foo\t2005-11-22 [merge]
+      rev-2
+
+    1 Joe Foo\t2005-11-22
+      rev-1
+
+""", logfile.getvalue())
+        finally:
+            wt.unlock()
+
     def make_tree_with_commits(self):
         """Create a tree with well-known revision ids"""
         wt = self.make_branch_and_tree('tree1')




More information about the bazaar-commits mailing list