Rev 5285: (vila) ``bzr log --exclude-common-ancestry`` works for linear in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Jun 10 18:13:31 BST 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5285 [merge]
revision-id: pqm at pqm.ubuntu.com-20100610171327-tmvcodt4s6m9snsr
parent: pqm at pqm.ubuntu.com-20100607023804-g0tttwnphcv00q2o
parent: v.ladeuil+lp at free.fr-20100610155606-fqsvh1m9t9dqcwfi
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2010-06-10 18:13:27 +0100
message:
(vila) ``bzr log --exclude-common-ancestry`` works for linear
ancestries
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
=== modified file 'NEWS'
--- a/NEWS 2010-06-07 02:38:04 +0000
+++ b/NEWS 2010-06-10 15:56:06 +0000
@@ -28,6 +28,10 @@
leading to faster init for directories with existing content.
(Martin [gz], Parth Malwankar, #501307)
+* ``bzr log --exclude-common-ancestry`` is now taken into account for
+ linear ancetries.
+ (Vincent Ladeuil, #575631)
+
* Final fix for 'no help for command' issue. We now show a clean message
when a command has no help, document how to set help more clearly, and
test that all commands available to the test suite have help.
=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py 2010-05-11 08:44:59 +0000
+++ b/bzrlib/log.py 2010-06-08 09:50:27 +0000
@@ -522,7 +522,7 @@
elif not generate_merge_revisions:
# If we only want to see linear revisions, we can iterate ...
iter_revs = _generate_flat_revisions(branch, start_rev_id, end_rev_id,
- direction)
+ direction, exclude_common_ancestry)
if direction == 'forward':
iter_revs = reversed(iter_revs)
else:
@@ -544,8 +544,11 @@
return [(rev_id, revno_str, 0)]
-def _generate_flat_revisions(branch, start_rev_id, end_rev_id, direction):
- result = _linear_view_revisions(branch, start_rev_id, end_rev_id)
+def _generate_flat_revisions(branch, start_rev_id, end_rev_id, direction,
+ exclude_common_ancestry=False):
+ result = _linear_view_revisions(
+ branch, start_rev_id, end_rev_id,
+ exclude_common_ancestry=exclude_common_ancestry)
# If a start limit was given and it's not obviously an
# ancestor of the end limit, check it before outputting anything
if direction == 'forward' or (start_rev_id
@@ -572,7 +575,7 @@
if delayed_graph_generation:
try:
for rev_id, revno, depth in _linear_view_revisions(
- branch, start_rev_id, end_rev_id):
+ branch, start_rev_id, end_rev_id, exclude_common_ancestry):
if _has_merges(branch, rev_id):
# The end_rev_id can be nested down somewhere. We need an
# explicit ancestry check. There is an ambiguity here as we
@@ -643,14 +646,17 @@
return True
-def _linear_view_revisions(branch, start_rev_id, end_rev_id):
+def _linear_view_revisions(branch, start_rev_id, end_rev_id,
+ exclude_common_ancestry=False):
"""Calculate a sequence of revisions to view, newest to oldest.
:param start_rev_id: the lower revision-id
:param end_rev_id: the upper revision-id
+ :param exclude_common_ancestry: Whether the start_rev_id should be part of
+ the iterated revisions.
:return: An iterator of (revision_id, dotted_revno, merge_depth) tuples.
:raises _StartNotLinearAncestor: if a start_rev_id is specified but
- is not found walking the left-hand history
+ is not found walking the left-hand history
"""
br_revno, br_rev_id = branch.last_revision_info()
repo = branch.repository
@@ -667,7 +673,8 @@
revno = branch.revision_id_to_dotted_revno(revision_id)
revno_str = '.'.join(str(n) for n in revno)
if not found_start and revision_id == start_rev_id:
- yield revision_id, revno_str, 0
+ if not exclude_common_ancestry:
+ yield revision_id, revno_str, 0
found_start = True
break
else:
=== modified file 'bzrlib/tests/blackbox/test_log.py'
--- a/bzrlib/tests/blackbox/test_log.py 2010-04-14 12:30:17 +0000
+++ b/bzrlib/tests/blackbox/test_log.py 2010-06-08 08:24:39 +0000
@@ -159,6 +159,14 @@
self.assertLogRevnos(['-c1'], ['1'])
+class TestLogExcludeCommonAncestry(TestLogWithLogCatcher):
+
+ def test_exclude_common_ancestry_simple_revnos(self):
+ self.make_linear_branch()
+ self.assertLogRevnos(['-r1..3', '--exclude-common-ancestry'],
+ ['3', '2'])
+
+
class TestLogMergedLinearAncestry(TestLogWithLogCatcher):
def setUp(self):
@@ -167,6 +175,18 @@
# stop calling run_bzr, there is no point) --vila 100118.
builder = branchbuilder.BranchBuilder(self.get_transport())
builder.start_series()
+ # 1
+ # | \
+ # 2 1.1.1
+ # | / |
+ # 3 1.1.2
+ # | |
+ # | 1.1.3
+ # | / |
+ # 4 1.1.4
+ # | /
+ # 5
+
# mainline
builder.build_snapshot('1', None, [
('add', ('', 'root-id', 'directory', ''))])
=== modified file 'bzrlib/tests/test_log.py'
--- a/bzrlib/tests/test_log.py 2010-05-05 08:18:32 +0000
+++ b/bzrlib/tests/test_log.py 2010-06-08 09:50:27 +0000
@@ -1724,13 +1724,13 @@
return br
def assertLogRevnos(self, expected_revnos, b, start, end,
- exclude_common_ancestry):
+ exclude_common_ancestry, generate_merge_revisions=True):
# FIXME: the layering in log makes it hard to test intermediate levels,
# I wish adding filters with their parameters were easier...
# -- vila 20100413
iter_revs = log._calc_view_revisions(
b, start, end, direction='reverse',
- generate_merge_revisions=True,
+ generate_merge_revisions=generate_merge_revisions,
exclude_common_ancestry=exclude_common_ancestry)
self.assertEqual(expected_revnos,
[revid for revid, revno, depth in iter_revs])
@@ -1738,11 +1738,19 @@
def test_merge_sorted_exclude_ancestry(self):
b = self.make_branch_with_alternate_ancestries()
self.assertLogRevnos(['3', '1.1.2', '1.2.1', '1.1.1', '2', '1'],
- b, '1', '3', False)
+ b, '1', '3', exclude_common_ancestry=False)
# '2' is part of the '3' ancestry but not part of '1.1.1' ancestry so
# it should be mentioned even if merge_sort order will make it appear
# after 1.1.1
self.assertLogRevnos(['3', '1.1.2', '1.2.1', '2'],
- b, '1.1.1', '3', True)
+ b, '1.1.1', '3', exclude_common_ancestry=True)
+ def test_merge_sorted_simple_revnos_exclude_ancestry(self):
+ b = self.make_branch_with_alternate_ancestries()
+ self.assertLogRevnos(['3', '2'],
+ b, '1', '3', exclude_common_ancestry=True,
+ generate_merge_revisions=False)
+ self.assertLogRevnos(['3', '1.1.2', '1.2.1', '1.1.1', '2'],
+ b, '1', '3', exclude_common_ancestry=True,
+ generate_merge_revisions=True)
More information about the bazaar-commits
mailing list