Rev 5692: (jelmer) Support branches with ghosts in their mainline and tags on in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Mar 2 18:59:05 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5692 [merge]
revision-id: pqm at pqm.ubuntu.com-20110302185902-f0qc7uyy82j785q3
parent: pqm at pqm.ubuntu.com-20110228211427-bwkkhj6817rkk9ym
parent: jelmer at samba.org-20110226153949-o0fk909b30g7z570
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-03-02 18:59:02 +0000
message:
(jelmer) Support branches with ghosts in their mainline and tags on
revisions not in the branch ancestry in "bzr tags". (Jelmer Vernooij)
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_tags.py test_tags.py-20070116132048-5h4qak2cm22jlb9e-1
bzrlib/tests/per_branch/test_revision_id_to_revno.py test_revision_id_to_-20070417200738-lo776wkqikhe5goo-1
doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2011-02-25 00:15:23 +0000
+++ b/bzrlib/branch.py 2011-02-26 15:35:01 +0000
@@ -3097,7 +3097,10 @@
try:
index = self._partial_revision_history_cache.index(revision_id)
except ValueError:
- self._extend_partial_history(stop_revision=revision_id)
+ try:
+ self._extend_partial_history(stop_revision=revision_id)
+ except errors.RevisionNotPresent, e:
+ raise errors.GhostRevisionsHaveNoRevno(revision_id, e.revision_id)
index = len(self._partial_revision_history_cache) - 1
if self._partial_revision_history_cache[index] != revision_id:
raise errors.NoSuchRevision(self, revision_id)
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2011-02-18 12:00:14 +0000
+++ b/bzrlib/builtins.py 2011-02-26 15:39:49 +0000
@@ -5566,7 +5566,7 @@
revno = branch.revision_id_to_dotted_revno(revid)
if isinstance(revno, tuple):
revno = '.'.join(map(str, revno))
- except errors.NoSuchRevision:
+ except (errors.NoSuchRevision, errors.GhostRevisionsHaveNoRevno):
# Bad tag data/merges can lead to tagged revisions
# which are not in this branch. Fail gracefully ...
revno = '?'
=== modified file 'bzrlib/tests/blackbox/test_tags.py'
--- a/bzrlib/tests/blackbox/test_tags.py 2011-02-07 04:14:29 +0000
+++ b/bzrlib/tests/blackbox/test_tags.py 2011-02-26 15:39:49 +0000
@@ -360,3 +360,21 @@
self.assertEqual('', out)
self.assertEqual('', err)
+ def test_tags_with_mainline_ghosts(self):
+ tree = self.make_branch_and_tree('tree1')
+ tree.set_parent_ids(["spooky"], allow_leftmost_as_ghost=True)
+ tree.add('')
+ tree.commit('msg1', rev_id='rev1')
+ tree.commit('msg2', rev_id='rev2')
+ tree.branch.tags.set_tag('unknown', 'out-of-mainline')
+ tree.branch.tags.set_tag('ghost', 'spooky')
+ tree.branch.tags.set_tag('tag1', 'rev1')
+ tree.branch.tags.set_tag('tag2', 'rev2')
+
+ out, err = self.run_bzr('tags -d tree1', encoding='utf-8')
+ self.assertEqual(out,
+ 'ghost ?\n'
+ 'tag1 1\n'
+ 'tag2 2\n'
+ 'unknown ?\n')
+ self.assertEqual('', err)
=== modified file 'bzrlib/tests/per_branch/test_revision_id_to_revno.py'
--- a/bzrlib/tests/per_branch/test_revision_id_to_revno.py 2009-07-10 05:49:34 +0000
+++ b/bzrlib/tests/per_branch/test_revision_id_to_revno.py 2011-02-26 15:35:01 +0000
@@ -39,3 +39,17 @@
self.assertRaises(errors.NoSuchRevision,
the_branch.revision_id_to_revno, 'rev-1.1.1')
+ def test_mainline_ghost(self):
+ tree = self.make_branch_and_tree('tree1')
+ tree.set_parent_ids(["spooky"], allow_leftmost_as_ghost=True)
+ tree.add('')
+ tree.commit('msg1', rev_id='rev1')
+ tree.commit('msg2', rev_id='rev2')
+ # Some older branch formats store the full known revision history
+ # and thus can't distinguish between not being able to find a revno because of
+ # a ghost and the revision not being on the mainline. As such,
+ # allow both NoSuchRevision and GhostRevisionsHaveNoRevno here.
+ self.assertRaises((errors.NoSuchRevision, errors.GhostRevisionsHaveNoRevno),
+ tree.branch.revision_id_to_revno, "unknown")
+ self.assertEquals(1, tree.branch.revision_id_to_revno("rev1"))
+ self.assertEquals(2, tree.branch.revision_id_to_revno("rev2"))
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt 2011-02-25 02:01:51 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2011-02-26 15:39:49 +0000
@@ -86,6 +86,10 @@
* ``bzr serve`` no longer crashes when a server_started hook is installed and
IPv6 support is available on the system. (Jelmer Vernooij, #293697)
+* ``bzr tags`` will no longer choke on branches with ghost revisions in
+ their mainline and tags on revisions not in the branch ancestry.
+ (Jelmer Vernooij, #397556)
+
* ``bzr whoami`` will now display an error if both a new identity and
``--email`` were specified. (Jelmer Vernooij, #680449)
More information about the bazaar-commits
mailing list