Rev 3945: Add a test case which exercises this code path. in lp:///~jameinel/bzr/1.12-fix-short-log

John Arbash Meinel john at arbash-meinel.com
Fri Jan 16 22:28:03 GMT 2009


At lp:///~jameinel/bzr/1.12-fix-short-log

------------------------------------------------------------
revno: 3945
revision-id: john at arbash-meinel.com-20090116222734-9mgzsmtcvv9qr2mt
parent: john at arbash-meinel.com-20090116221614-k8su03l5d22tq6iv
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.12-fix-short-log
timestamp: Fri 2009-01-16 16:27:34 -0600
message:
  Add a test case which exercises this code path.
  
  It turns out that you need --short *and* a revision range.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_log.py'
--- a/bzrlib/tests/test_log.py	2008-12-12 03:45:03 +0000
+++ b/bzrlib/tests/test_log.py	2009-01-16 22:27:34 +0000
@@ -301,8 +301,8 @@
         wt.commit('rev-merged', rev_id='rev-2a',
                   timestamp=1132586700, timezone=36000,
                   committer='Joe Foo <joe at foo.com>')
+        wt.branch.set_last_revision_info(1, 'rev-1')
         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>')
@@ -319,6 +319,44 @@
 """,
                              logfile.getvalue())
 
+    def test_short_log_with_merges_and_range(self):
+        wt = self.make_branch_and_memory_tree('.')
+        wt.lock_write()
+        self.addCleanup(wt.unlock)
+        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.branch.set_last_revision_info(1, 'rev-1')
+        wt.set_parent_ids(['rev-1', 'rev-2a'])
+        wt.commit('rev-2b', rev_id='rev-2b',
+                  timestamp=1132586800, timezone=36000,
+                  committer='Joe Foo <joe at foo.com>')
+        wt.commit('rev-3a', rev_id='rev-3a',
+                  timestamp=1132586800, timezone=36000,
+                  committer='Joe Foo <joe at foo.com>')
+        wt.branch.set_last_revision_info(2, 'rev-2b')
+        wt.set_parent_ids(['rev-2b', 'rev-3a'])
+        wt.commit('rev-3b', rev_id='rev-3b',
+                  timestamp=1132586800, timezone=36000,
+                  committer='Joe Foo <joe at foo.com>')
+        logfile = self.make_utf8_encoded_stringio()
+        formatter = log.ShortLogFormatter(to_file=logfile)
+        log.show_log(wt.branch, formatter,
+            start_revision=2, end_revision=3)
+        self.assertEqualDiff("""\
+    3 Joe Foo\t2005-11-22 [merge]
+      rev-3b
+
+    2 Joe Foo\t2005-11-22 [merge]
+      rev-2b
+
+""",
+                             logfile.getvalue())
+
     def test_short_log_single_merge_revision(self):
         wt = self.make_branch_and_memory_tree('.')
         wt.lock_write()



More information about the bazaar-commits mailing list