Rev 3737: (vila) Fix bug #248427 by adding a --change option to log in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Sep 25 08:55:19 BST 2008


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

------------------------------------------------------------
revno: 3737
revision-id: pqm at pqm.ubuntu.com-20080925075516-olnl5p5au2u1ml5v
parent: pqm at pqm.ubuntu.com-20080925061707-6upxinw1nuuj0zl3
parent: v.ladeuil+lp at free.fr-20080925072330-vjtvs9lnjjdk3zhc
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-09-25 08:55:16 +0100
message:
  (vila) Fix bug #248427 by adding a --change option to log
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
    ------------------------------------------------------------
    revno: 3734.1.2
    revision-id: v.ladeuil+lp at free.fr-20080925072330-vjtvs9lnjjdk3zhc
    parent: v.ladeuil+lp at free.fr-20080924134348-s1tz1xjuxppe2caw
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: 248427-log-c
    timestamp: Thu 2008-09-25 09:23:30 +0200
    message:
      Mark bug #248427 as fixed
    ------------------------------------------------------------
    revno: 3734.1.1
    revision-id: v.ladeuil+lp at free.fr-20080924134348-s1tz1xjuxppe2caw
    parent: pqm at pqm.ubuntu.com-20080924081540-ecfvp6xq4x9gs81n
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: 248427-log-c
    timestamp: Wed 2008-09-24 15:43:48 +0200
    message:
      Fix bug #248427 by adding a --change option to log.
      
      * bzrlib/tests/blackbox/test_log.py:
      (TestLog.test_log_change_revno,
      TestLog.test_log_change_single_revno,
      TestLog.test_log_change_incompatible_with_revision):
      Add tests specific to log --change behaviour.
      
      * bzrlib/builtins.py:
      (cmd_log): Add a 'change' option with a behaviour tailored to log.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
=== modified file 'NEWS'
--- a/NEWS	2008-09-25 01:21:44 +0000
+++ b/NEWS	2008-09-25 07:55:16 +0000
@@ -57,6 +57,9 @@
       repository now preserves the repository format.
       (Andrew Bennetts, #269214)
 
+    * ``bzr log`` now accepts a ``--change`` option.
+      (Vincent Ladeuil, #248427)
+
     * ``bzr missing`` now accepts an ``--include-merges`` option.
       (Vincent Ladeuil, #233817)
 

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2008-09-24 06:52:03 +0000
+++ b/bzrlib/builtins.py	2008-09-24 13:43:48 +0000
@@ -1689,6 +1689,11 @@
                    help='Show files changed in each revision.'),
             'show-ids',
             'revision',
+            Option('change',
+                   type=bzrlib.option._parse_revision_str,
+                   short_name='c',
+                   help='Show just the specified revision.'
+                   ' See also "help revisionspec".'),
             'log-format',
             Option('message',
                    short_name='m',
@@ -1709,12 +1714,22 @@
             show_ids=False,
             forward=False,
             revision=None,
+            change=None,
             log_format=None,
             message=None,
             limit=None):
         from bzrlib.log import show_log
         direction = (forward and 'forward') or 'reverse'
-        
+
+        if change is not None:
+            if len(change) > 1:
+                raise errors.RangeInChangeOption()
+            if revision is not None:
+                raise errors.BzrCommandError(
+                    '--revision and --change are mutually exclusive')
+            else:
+                revision = change
+
         # log everything
         file_id = None
         if location:

=== modified file 'bzrlib/tests/blackbox/test_log.py'
--- a/bzrlib/tests/blackbox/test_log.py	2008-09-01 00:56:53 +0000
+++ b/bzrlib/tests/blackbox/test_log.py	2008-09-24 13:43:48 +0000
@@ -138,7 +138,25 @@
         self.assertTrue('revno: 2\n' not in log)
         self.assertTrue('branch nick: branch2\n' in log)
         self.assertTrue('branch nick: branch1\n' not in log)
-        
+
+    def test_log_change_revno(self):
+        self._prepare()
+        expected_log = self.run_bzr("log -r 1")[0]
+        log = self.run_bzr("log -c 1")[0]
+        self.assertEqualDiff(expected_log, log)
+
+    def test_log_change_single_revno(self):
+        self._prepare()
+        self.run_bzr_error('bzr: ERROR: Option --change does not'
+                           ' accept revision ranges',
+                           ['log', '--change', '2..3'])
+
+    def test_log_change_incompatible_with_revision(self):
+        self._prepare()
+        self.run_bzr_error('bzr: ERROR: --revision and --change'
+                           ' are mutually exclusive',
+                           ['log', '--change', '2', '--revision', '3'])
+
     def test_log_nonexistent_file(self):
         # files that don't exist in either the basis tree or working tree
         # should give an error




More information about the bazaar-commits mailing list