Rev 4960: Start reproducing the problems reported in the bug. in file:///home/vila/src/bzr/bugs/476293-log-respect-direction/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Fri Jan 15 18:38:08 GMT 2010
At file:///home/vila/src/bzr/bugs/476293-log-respect-direction/
------------------------------------------------------------
revno: 4960
revision-id: v.ladeuil+lp at free.fr-20100115183808-carnw3q3wm3zi0nf
parent: v.ladeuil+lp at free.fr-20100115181544-1fleq6k2rqjt31j9
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: respect-direction
timestamp: Fri 2010-01-15 19:38:08 +0100
message:
Start reproducing the problems reported in the bug.
* bzrlib/tests/test_log.py:
(LogCatcher): Avoid all known filtering by default.
(LogCatcher.__init__): Respect the signature or we lose part of
the command-line parameters (--levels at least).
* bzrlib/tests/blackbox/test_log.py:
(TestBug474807): Reproduce graph and problems reported in bug.
* bzrlib/log.py:
(calculate_view_revisions): Really deprecate ! We lost one year
here :-/
(_rebase_merge_depth): Deprecate too since it's only used by a
deprecated function.
-------------- next part --------------
=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py 2010-01-15 18:14:51 +0000
+++ b/bzrlib/log.py 2010-01-15 18:38:08 +0000
@@ -88,6 +88,10 @@
re_compile_checked,
terminal_width,
)
+from bzrlib.symbol_versioning import (
+ deprecated_function,
+ deprecated_in,
+ )
def find_touching_revisions(branch, file_id):
@@ -675,6 +679,7 @@
yield rev_id, '.'.join(map(str, revno)), merge_depth
+ at deprecated_function(deprecated_in((2, 1, 0)))
def calculate_view_revisions(branch, start_revision, end_revision, direction,
specific_fileid, generate_merge_revisions):
"""Calculate the revisions to view.
@@ -682,9 +687,6 @@
:return: An iterator of (revision_id, dotted_revno, merge_depth) tuples OR
a list of the same tuples.
"""
- # This method is no longer called by the main code path.
- # It is retained for API compatibility and may be deprecated
- # soon. IGC 20090116
start_rev_id, end_rev_id = _get_revision_limits(branch, start_revision,
end_revision)
view_revisions = list(_calc_view_revisions(branch, start_rev_id, end_rev_id,
@@ -696,6 +698,7 @@
return _rebase_merge_depth(view_revisions)
+ at deprecated_function(deprecated_in((2, 1, 0)))
def _rebase_merge_depth(view_revisions):
"""Adjust depths upwards so the top level is 0."""
# If either the first or last revision have a merge_depth of 0, we're done
@@ -1299,8 +1302,8 @@
preferred_levels = 0
def __init__(self, to_file, show_ids=False, show_timezone='original',
- delta_format=None, levels=None, show_advice=False,
- to_exact_file=None):
+ delta_format=None, levels=None, show_advice=False,
+ to_exact_file=None):
"""Create a LogFormatter.
:param to_file: the file to output to
=== modified file 'bzrlib/tests/blackbox/test_log.py'
--- a/bzrlib/tests/blackbox/test_log.py 2010-01-15 13:21:15 +0000
+++ b/bzrlib/tests/blackbox/test_log.py 2010-01-15 18:38:08 +0000
@@ -25,7 +25,10 @@
osutils,
tests,
)
-from bzrlib.tests import test_log
+from bzrlib.tests import (
+ script,
+ test_log,
+ )
class TestLog(tests.TestCaseWithTransport):
@@ -96,13 +99,12 @@
def setUp(self):
super(TestLogWithLogCatcher, self).setUp()
- # Install a default log formatter that captures the revisions but
- # produces no output
- self.log_catcher = test_log.LogCatcher()
+ # Capture log formatter creations
class MyLogFormatter(test_log.LogCatcher):
def __new__(klass, *args, **kwargs):
- # Always return our own log formatter acting as a singleton
+ self.log_catcher = test_log.LogCatcher(*args, **kwargs)
+ # Always return our own log formatter
return self.log_catcher
orig = log.log_formatter_registry.get_default
@@ -178,6 +180,59 @@
self.make_linear_branch()
self.assertLogRevnos(['-l', '2'], ['3', '2'])
+class TestBug474807(TestLogWithLogCatcher):
+
+ def setUp(self):
+ super(TestBug474807, self).setUp()
+ self.script_runner = script.ScriptRunner()
+ self.script_runner.run_script(self, '''$ bzr init m # mainline
+$ cd m
+$ echo A > foo
+$ bzr add .
+$ bzr commit -mA
+$ bzr branch . ../r # right, to be merged
+$ echo B > foo
+$ bzr commit -mB
+$ cd ../r
+$ echo C > bar
+$ bzr add .
+$ bzr commit -mC
+$ cd ../m
+$ bzr merge ../r
+$ bzr commit -mD
+$ cd ../r
+$ echo E > bar
+$ bzr commit -mE
+$ echo F > bar
+$ bzr commit -mF
+$ cd ../m
+$ bzr merge ../r
+$ bzr commit -mG
+$ cd ../r
+$ bzr merge ../m
+$ bzr commit -mH --unchanged
+$ cd ../m
+$ bzr merge ../r
+$ bzr commit -mI --unchanged
+# We end up in m (mainline)
+''')
+
+ def test_n0(self):
+ self.assertLogRevnos(['-n0', '-r1.1.1..1.1.4'],
+ ['1.1.4', '4', '1.1.3', '1.1.2', '3', '1.1.1'])
+
+ def test_n0_forward(self):
+ self.assertLogRevnos(['-n0', '-r1.1.1..1.1.4', '--forward'],
+ ['3', '1.1.1', '4', '1.1.2', '1.1.3', '1.1.4'])
+
+ def test_n1(self):
+ self.assertLogRevnos(['-n1', '-r1.1.1..1.1.4'],
+ ['1.1.4', '1.1.3', '1.1.2', '1.1.1'])
+
+ def test_n1_forward(self):
+ self.assertLogRevnos(['-n1', '-r1.1.1..1.1.4', '--forward'],
+ ['1.1.1', '1.1.2', '1.1.3', '1.1.4'])
+
class TestLogRevSpecsWithPaths(TestLogWithLogCatcher):
=== modified file 'bzrlib/tests/test_log.py'
--- a/bzrlib/tests/test_log.py 2010-01-15 18:14:51 +0000
+++ b/bzrlib/tests/test_log.py 2010-01-15 18:38:08 +0000
@@ -129,10 +129,13 @@
being dependent on the formatting.
"""
+ supports_merge_revisions = True
supports_delta = True
+ preferred_levels = 0
- def __init__(self):
- super(LogCatcher, self).__init__(to_file=None)
+ def __init__(self, *args, **kwargs):
+ kwargs.update(dict(to_file=None))
+ super(LogCatcher, self).__init__(*args, **kwargs)
self.revisions = []
def log_revision(self, revision):
More information about the bazaar-commits
mailing list