Rev 5099: (vila) Don't crash on bzr log -n0 -r ...A.B.C in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Mar 19 08:45:42 GMT 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5099 [merge]
revision-id: pqm at pqm.ubuntu.com-20100319084540-odnankeqqjlnjfjh
parent: pqm at pqm.ubuntu.com-20100319030327-b972l4hg4azzeaqf
parent: v.ladeuil+lp at free.fr-20100319080629-cmo8525p7xsvmay5
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-03-19 08:45:40 +0000
message:
(vila) Don't crash on bzr log -n0 -r ...A.B.C
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
=== modified file 'NEWS'
--- a/NEWS 2010-03-17 23:57:16 +0000
+++ b/NEWS 2010-03-19 08:06:29 +0000
@@ -92,6 +92,10 @@
deliberately when no help topics match from any help index.
(Robert Collins, #396261)
+* ``bzr log -n0 -r..A.B.C`` should not crash but just consider the None
+ revspec as representing the first revision of the branch.
+ (Vincent Ladeuil, #519862)
+
* ``bzr remove-tree`` can now remove multiple working trees.
(Jared Hance, Andrew Bennetts, #253137)
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2010-03-17 03:39:58 +0000
+++ b/bzrlib/builtins.py 2010-03-19 08:06:29 +0000
@@ -2438,7 +2438,11 @@
raise errors.BzrCommandError(
"bzr %s doesn't accept two revisions in different"
" branches." % command_name)
- rev1 = start_spec.in_history(branch)
+ if start_spec.spec is None:
+ # Avoid loading all the history.
+ rev1 = RevisionInfo(branch, None, None)
+ else:
+ rev1 = start_spec.in_history(branch)
# Avoid loading all of history when we know a missing
# end of range means the last revision ...
if end_spec.spec is None:
=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py 2010-02-23 07:43:11 +0000
+++ b/bzrlib/log.py 2010-03-19 07:54:29 +0000
@@ -553,10 +553,13 @@
# may not raise _StartNotLinearAncestor for a revision that
# is an ancestor but not a *linear* one. But since we have
# loaded the graph to do the check (or calculate a dotted
- # revno), we may as well accept to show the log...
- # -- vila 100201
+ # revno), we may as well accept to show the log... We need
+ # the check only if start_rev_id is not None as all
+ # revisions have _mod_revision.NULL_REVISION as an ancestor
+ # -- vila 20100319
graph = branch.repository.get_graph()
- if not graph.is_ancestor(start_rev_id, end_rev_id):
+ if (start_rev_id is not None
+ and not graph.is_ancestor(start_rev_id, end_rev_id)):
raise _StartNotLinearAncestor()
end_rev_id = rev_id
break
@@ -1424,7 +1427,8 @@
"""
# Revision comes directly from a foreign repository
if isinstance(rev, foreign.ForeignRevision):
- return self._format_properties(rev.mapping.vcs.show_foreign_revid(rev.foreign_revid))
+ return self._format_properties(
+ rev.mapping.vcs.show_foreign_revid(rev.foreign_revid))
# Imported foreign revision revision ids always contain :
if not ":" in rev.revision_id:
@@ -2006,7 +2010,7 @@
bug_rows = [line.split(' ', 1) for line in bug_lines]
fixed_bug_urls = [row[0] for row in bug_rows if
len(row) > 1 and row[1] == 'fixed']
-
+
if fixed_bug_urls:
return {'fixes bug(s)': ' '.join(fixed_bug_urls)}
return {}
=== modified file 'bzrlib/tests/blackbox/test_log.py'
--- a/bzrlib/tests/blackbox/test_log.py 2010-02-23 07:43:11 +0000
+++ b/bzrlib/tests/blackbox/test_log.py 2010-03-18 08:52:22 +0000
@@ -205,6 +205,14 @@
class Test_GenerateAllRevisions(TestLogWithLogCatcher):
+ def setUp(self):
+ super(Test_GenerateAllRevisions, self).setUp()
+ builder = self.make_branch_with_many_merges()
+ b = builder.get_branch()
+ b.lock_read()
+ self.addCleanup(b.unlock)
+ self.branch = b
+
def make_branch_with_many_merges(self, path='.', format=None):
builder = branchbuilder.BranchBuilder(self.get_transport())
builder.start_series()
@@ -226,25 +234,22 @@
return builder
def test_not_an_ancestor(self):
- builder = self.make_branch_with_many_merges()
- b = builder.get_branch()
- b.lock_read()
- self.addCleanup(b.unlock)
self.assertRaises(errors.BzrCommandError,
log._generate_all_revisions,
- b, '1.1.1', '2.1.3', 'reverse',
+ self.branch, '1.1.1', '2.1.3', 'reverse',
delayed_graph_generation=True)
def test_wrong_order(self):
- builder = self.make_branch_with_many_merges()
- b = builder.get_branch()
- b.lock_read()
- self.addCleanup(b.unlock)
self.assertRaises(errors.BzrCommandError,
log._generate_all_revisions,
- b, '5', '2.1.3', 'reverse',
+ self.branch, '5', '2.1.3', 'reverse',
delayed_graph_generation=True)
+ def test_no_start_rev_id_with_end_rev_id_being_a_merge(self):
+ revs = log._generate_all_revisions(
+ self.branch, None, '2.1.3',
+ 'reverse', delayed_graph_generation=True)
+
class TestLogRevSpecsWithPaths(TestLogWithLogCatcher):
More information about the bazaar-commits
mailing list