Rev 3435: Add tests for Branch.missing_revisions and deprecate it. in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/missing
John Arbash Meinel
john at arbash-meinel.com
Wed May 21 16:38:20 BST 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/missing
------------------------------------------------------------
revno: 3435
revision-id: john at arbash-meinel.com-20080521153808-o88yedzgqi1l3oim
parent: john at arbash-meinel.com-20080520181835-kw4sd2fzblnw23mj
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: missing
timestamp: Wed 2008-05-21 10:38:08 -0500
message:
Add tests for Branch.missing_revisions and deprecate it.
The api uses a 'stop_revision' but it is supposed to be a revno, not a
revision_id. The code itself is very crufty and slow (and doesn't take
a read_lock). But rather than fix it, just nuke the function.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/tests/test_branch.py test_branch.py-20060116013032-97819aa07b8ab3b5
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2008-05-20 18:18:35 +0000
+++ b/NEWS 2008-05-21 15:38:08 +0000
@@ -31,6 +31,11 @@
INTERNALS:
+ * ``Branch.missing_revisions`` has been deprecated. Similar functionality
+ can be obtained using ``bzrlib.missing.find_unmerged``. The api was
+ fairly broken, and the function was unused, so we are getting rid of it.
+ (John Arbash Meinel)
+
API BREAKS:
* ``bzr missing --mine-only`` will return status code 0 if you have no new
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2008-05-08 04:33:38 +0000
+++ b/bzrlib/branch.py 2008-05-21 15:38:08 +0000
@@ -41,6 +41,7 @@
from bzrlib.decorators import needs_read_lock, needs_write_lock
from bzrlib.hooks import Hooks
+from bzrlib.symbol_versioning import deprecated_in, deprecated_method
from bzrlib.trace import mutter, mutter_callsite, note, is_quiet
@@ -420,6 +421,7 @@
else:
return (0, _mod_revision.NULL_REVISION)
+ @deprecated_method(deprecated_in((1, 6, 0)))
def missing_revisions(self, other, stop_revision=None):
"""Return a list of new revisions that would perfectly fit.
=== modified file 'bzrlib/tests/test_branch.py'
--- a/bzrlib/tests/test_branch.py 2008-04-09 03:09:58 +0000
+++ b/bzrlib/tests/test_branch.py 2008-05-21 15:38:08 +0000
@@ -50,9 +50,11 @@
UnsupportedFormatError,
)
+from bzrlib.symbol_versioning import deprecated_in
from bzrlib.tests import TestCase, TestCaseWithTransport
from bzrlib.transport import get_transport
+
class TestDefaultFormat(TestCase):
def test_default_format(self):
@@ -128,6 +130,38 @@
# TODO RBC 20051029 test getting a push location from a branch in a
# recursive section - that is, it appends the branch name.
+ def test_missing_revisions(self):
+ t1 = self.make_branch_and_tree('b1', format='knit')
+ rev1 = t1.commit('one')
+ t2 = t1.bzrdir.sprout('b2').open_workingtree()
+ rev2 = t1.commit('two')
+ rev3 = t1.commit('three')
+
+ self.assertEqual([rev2, rev3],
+ self.applyDeprecated(deprecated_in((1, 6, 0)),
+ t2.branch.missing_revisions, t1.branch))
+
+ self.assertEqual([],
+ self.applyDeprecated(deprecated_in((1, 6, 0)),
+ t2.branch.missing_revisions, t1.branch, stop_revision=1))
+ self.assertEqual([rev2],
+ self.applyDeprecated(deprecated_in((1, 6, 0)),
+ t2.branch.missing_revisions, t1.branch, stop_revision=2))
+ self.assertEqual([rev2, rev3],
+ self.applyDeprecated(deprecated_in((1, 6, 0)),
+ t2.branch.missing_revisions, t1.branch, stop_revision=3))
+
+ self.assertRaises(errors.NoSuchRevision,
+ self.applyDeprecated, deprecated_in((1, 6, 0)),
+ t2.branch.missing_revisions, t1.branch, stop_revision=4)
+
+ rev4 = t2.commit('four')
+ self.assertRaises(errors.DivergedBranches,
+ self.applyDeprecated, deprecated_in((1, 6, 0)),
+ t2.branch.missing_revisions, t1.branch)
+
+
+
class SampleBranchFormat(BranchFormat):
"""A sample format
@@ -294,6 +328,7 @@
self.assertEqual(warnings[0], 'Value "new" is masked by "old" from '
'locations.conf')
+
class TestBranchReference(TestCaseWithTransport):
"""Tests for the branch reference facility."""
More information about the bazaar-commits
mailing list