Rev 3061: (John Arbash Meinel) deprecate bzrlib.revision.is_ancestor, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Nov 30 22:56:39 GMT 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3061
revision-id:pqm at pqm.ubuntu.com-20071130225629-sovkf7a4lksj1z4g
parent: pqm at pqm.ubuntu.com-20071130182102-i0t564k01anm7uk2
parent: john at arbash-meinel.com-20071130221705-2hd3uhtht0gay0jq
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2007-11-30 22:56:29 +0000
message:
  (John Arbash Meinel) deprecate bzrlib.revision.is_ancestor,
  	and special case Graph.is_ancestor for NULL_REVISION
modified:
  bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
  bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
  bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
  bzrlib/revision.py             revision.py-20050309040759-e77802c08f3999d5
  bzrlib/tests/test_ancestry.py  test_ancestry.py-20050913023709-69768e94848312c6
  bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
  bzrlib/tests/test_revision.py  testrevision.py-20050804210559-46f5e1eb67b01289
    ------------------------------------------------------------
    revno: 3052.1.7
    revision-id:john at arbash-meinel.com-20071130221705-2hd3uhtht0gay0jq
    parent: john at arbash-meinel.com-20071130155902-03cqo1ynbg2x7x5a
    parent: pqm at pqm.ubuntu.com-20071130182102-i0t564k01anm7uk2
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: is_ancestor_fix
    timestamp: Fri 2007-11-30 16:17:05 -0600
    message:
      [merge] bzr.dev 3060
    added:
      doc/en/tutorials/              docentutorials-20071127235845-bm2lu60bvau1ptmh-1
      doc/en/user-guide/annotating_changes.txt annotating_changes.t-20071122141511-0knao2lklsdsvb1q-1
      doc/en/user-guide/bazaar_workflows.txt bazaar_workflows.txt-20071114035000-q36a9h57ps06uvnl-1
      doc/en/user-guide/best_practice_intro.txt best_practice_intro.-20071123154453-dk2mjhrg1vpjm5w2-1
      doc/en/user-guide/branching_a_project.txt branching_a_project.-20071122141511-0knao2lklsdsvb1q-2
      doc/en/user-guide/browsing_history.txt browsing_history.txt-20071121073725-0corxykv5irjal00-2
      doc/en/user-guide/central_intro.txt central_intro.txt-20071123055134-k5x4ekduci2lbn36-1
      doc/en/user-guide/configuring_bazaar.txt configuring_bazaar.t-20071128000722-ncxiua259xwbdbg7-1
      doc/en/user-guide/controlling_registration.txt controlling_registra-20071121073725-0corxykv5irjal00-3
      doc/en/user-guide/core_concepts.txt core_concepts.txt-20071114035000-q36a9h57ps06uvnl-2
      doc/en/user-guide/distributed_intro.txt distributed_intro.tx-20071123154453-dk2mjhrg1vpjm5w2-2
      doc/en/user-guide/entering_commands.txt using_bazaar.txt-20071114035000-q36a9h57ps06uvnl-6
      doc/en/user-guide/getting_help.txt getting_help.txt-20071128000722-ncxiua259xwbdbg7-2
      doc/en/user-guide/images/      images-20071114035000-q36a9h57ps06uvnl-3
      doc/en/user-guide/images/workflows_centralized.png workflows_centralize-20071114035000-q36a9h57ps06uvnl-8
      doc/en/user-guide/images/workflows_centralized.svg workflows_centralize-20071130043324-bhms0cgyphhq1b2x-1
      doc/en/user-guide/images/workflows_gatekeeper.png workflows_gatekeeper-20071114035000-q36a9h57ps06uvnl-9
      doc/en/user-guide/images/workflows_gatekeeper.svg workflows_gatekeeper-20071130043324-bhms0cgyphhq1b2x-2
      doc/en/user-guide/images/workflows_localcommit.png workflows_localcommi-20071114035000-q36a9h57ps06uvnl-10
      doc/en/user-guide/images/workflows_localcommit.svg workflows_localcommi-20071130043324-bhms0cgyphhq1b2x-3
      doc/en/user-guide/images/workflows_peer.png workflows_peer.png-20071114035000-q36a9h57ps06uvnl-11
      doc/en/user-guide/images/workflows_peer.svg workflows_peer.svg-20071130043324-bhms0cgyphhq1b2x-4
      doc/en/user-guide/images/workflows_pqm.png workflows_pqm.png-20071114035000-q36a9h57ps06uvnl-12
      doc/en/user-guide/images/workflows_pqm.svg workflows_pqm.svg-20071130043324-bhms0cgyphhq1b2x-5
      doc/en/user-guide/images/workflows_shared.png workflows_shared.png-20071114035000-q36a9h57ps06uvnl-13
      doc/en/user-guide/images/workflows_shared.svg workflows_shared.svg-20071130043324-bhms0cgyphhq1b2x-6
      doc/en/user-guide/images/workflows_single.png workflows_single.png-20071114035000-q36a9h57ps06uvnl-14
      doc/en/user-guide/images/workflows_single.svg workflows_single.svg-20071130043324-bhms0cgyphhq1b2x-7
      doc/en/user-guide/installing_bazaar.txt installing_bazaar.tx-20071114035000-q36a9h57ps06uvnl-4
      doc/en/user-guide/introducing_bazaar.txt introducing_bazaar.t-20071114035000-q36a9h57ps06uvnl-5
      doc/en/user-guide/merging_changes.txt merging_changes.txt-20071122141511-0knao2lklsdsvb1q-3
      doc/en/user-guide/organizing_branches.txt organizing_branches.-20071123154453-dk2mjhrg1vpjm5w2-3
      doc/en/user-guide/partner_intro.txt partner_workflow.txt-20071122141511-0knao2lklsdsvb1q-4
      doc/en/user-guide/publishing_a_branch.txt publishing_a_branch.-20071123055134-k5x4ekduci2lbn36-2
      doc/en/user-guide/recording_changes.txt recording_changes.tx-20071121073725-0corxykv5irjal00-4
      doc/en/user-guide/releasing_a_project.txt releasing_a_project.-20071121073725-0corxykv5irjal00-5
      doc/en/user-guide/resolving_conflicts.txt resolving_conflicts.-20071122141511-0knao2lklsdsvb1q-5
      doc/en/user-guide/reusing_a_checkout.txt reusing_a_checkout.t-20071123055134-k5x4ekduci2lbn36-3
      doc/en/user-guide/reviewing_changes.txt reviewing_changes.tx-20071121073725-0corxykv5irjal00-6
      doc/en/user-guide/sending_changes.txt sending_changes.txt-20071123154453-dk2mjhrg1vpjm5w2-4
      doc/en/user-guide/solo_intro.txt solo_workflow.txt-20071121073725-0corxykv5irjal00-7
      doc/en/user-guide/starting_a_project.txt starting_a_project.t-20071121073725-0corxykv5irjal00-8
      doc/en/user-guide/undoing_mistakes.txt undoing_mistakes.txt-20071121092300-8fyacngt1w98e5mp-1
      doc/en/user-guide/using_checkouts.txt using_checkouts.txt-20071123055134-k5x4ekduci2lbn36-4
      doc/en/user-guide/using_gatekeepers.txt using_gatekeepers.tx-20071123154453-dk2mjhrg1vpjm5w2-5
      doc/en/user-guide/working_offline_central.txt working_offline_cent-20071123055134-k5x4ekduci2lbn36-5
      doc/en/user-guide/writing_a_plugin.txt writing_a_plugin.txt-20071114035000-q36a9h57ps06uvnl-7
      index.txt                      index.txt-20071121073725-0corxykv5irjal00-1
    renamed:
      doc/en/user-guide/centralized_workflow.txt => doc/en/tutorials/centralized_workflow.txt centralized_workflow-20060830194948-kspf52565xvgrlil-1
      doc/en/user-guide/tutorial.txt => doc/en/tutorials/tutorial.txt tutorial.txt-20050804190939-9dcbba2ef053bc84
    modified:
      Makefile                       Makefile-20050805140406-d96e3498bb61c5bb
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/debug.py                debug.py-20061102062349-vdhrw9qdpck8cl35-1
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/HTTPTestUtil.py   HTTPTestUtil.py-20050914180604-247d3aafb7a43343
      bzrlib/tests/HttpServer.py     httpserver.py-20061012142527-m1yxdj1xazsf8d7s-1
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
      bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
      bzrlib/tests/test_switch.py    test_switch.py-20071116011000-v5lnw7d2wkng9eux-2
      bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
      bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
      bzrlib/transport/http/_urllib.py _urlgrabber.py-20060113083826-0bbf7d992fbf090c
      bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
      bzrlib/transport/http/response.py _response.py-20060613154423-a2ci7hd4iw5c7fnt-1
      doc/en/user-guide/authentication_conf.txt authentication_conf.-20071104135035-glfv0ri355tyg1nf-1
      doc/en/user-guide/bug_trackers.txt bug_trackers.txt-20070713223459-khxdlcudraii95uv-1
      doc/en/user-guide/configuration.txt configuration.txt-20060314161707-868350809502af01
      doc/en/user-guide/conflicts.txt conflicts.txt-20070723221841-ns3jvwxdb4okn6fk-1
      doc/en/user-guide/hooks.txt    hooks.txt-20070829200551-7nr6e5a1io6x78uf-1
      doc/en/user-guide/http_smart_server.txt fastcgi.txt-20061005091552-rz8pva0olkxv0sd8-3
      doc/en/user-guide/index.txt    index.txt-20060622101119-tgwtdci8z769bjb9-2
      doc/en/user-guide/plugins.txt  plugins.txt-20060314145616-525099a747f3ffdd
      doc/en/user-guide/server.txt   server.txt-20060913044801-h939fvbwzz39gf7g-1
      doc/en/user-guide/setting_up_email.txt setting_up_email.txt-20060314161707-fd242c8944346173
      doc/en/user-guide/shared_repository_layouts.txt shared_repository_la-20070502152030-bagewuqs18ns24o7-1
      doc/en/user-guide/specifying_revisions.txt specifying_revisions.txt-20060314161707-19deb139101bea33
      doc/en/user-guide/using_aliases.txt using_aliases.txt-20060314161707-c21d27fa2939e039
      doc/en/user-guide/version_info.txt version_info.txt-20060921215543-gju6o5xdic8w25np-1
      doc/index.txt                  index.txt-20070813101924-07gd9i9d2jt124bf-1
      tools/win32/bzr.iss.cog        bzr.iss.cog-20060622100836-b3yup582rt3y0nvm-5
      doc/en/tutorials/tutorial.txt  tutorial.txt-20050804190939-9dcbba2ef053bc84
    ------------------------------------------------------------
    revno: 3052.1.6
    revision-id:john at arbash-meinel.com-20071130155902-03cqo1ynbg2x7x5a
    parent: john at arbash-meinel.com-20071130154827-dh5a4gr3d0gfk1m0
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: is_ancestor_fix
    timestamp: Fri 2007-11-30 09:59:02 -0600
    message:
      Change the lock check to raise ObjectNotLocked.
    modified:
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
    ------------------------------------------------------------
    revno: 3052.1.5
    revision-id:john at arbash-meinel.com-20071130154827-dh5a4gr3d0gfk1m0
    parent: john at arbash-meinel.com-20071130152015-7zu3hejdrx5j2reo
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: is_ancestor_fix
    timestamp: Fri 2007-11-30 09:48:27 -0600
    message:
      Fix up the is_ancestor checks in test_revision.py
    modified:
      bzrlib/tests/test_revision.py  testrevision.py-20050804210559-46f5e1eb67b01289
    ------------------------------------------------------------
    revno: 3052.1.4
    revision-id:john at arbash-meinel.com-20071130152015-7zu3hejdrx5j2reo
    parent: john at arbash-meinel.com-20071130145230-njpq31mmf39l2zow
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: is_ancestor_fix
    timestamp: Fri 2007-11-30 09:20:15 -0600
    message:
      Special case when the candidate_descendant is also the NULL_REVISION
    modified:
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
    ------------------------------------------------------------
    revno: 3052.1.3
    revision-id:john at arbash-meinel.com-20071130145230-njpq31mmf39l2zow
    parent: john at arbash-meinel.com-20071130141824-p3e0r9p6gf5xth5n
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: is_ancestor_fix
    timestamp: Fri 2007-11-30 08:52:30 -0600
    message:
      deprecate revision.is_ancestor, update the callers and the tests.
    modified:
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
      bzrlib/revision.py             revision.py-20050309040759-e77802c08f3999d5
      bzrlib/tests/test_ancestry.py  test_ancestry.py-20050913023709-69768e94848312c6
    ------------------------------------------------------------
    revno: 3052.1.2
    revision-id:john at arbash-meinel.com-20071130141824-p3e0r9p6gf5xth5n
    parent: john at arbash-meinel.com-20071130033433-0j25tjs5jv2yyn40
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: is_ancestor_fix
    timestamp: Fri 2007-11-30 08:18:24 -0600
    message:
      Pack repositories need to be explicitly locked for graph().is_ancestor to work.
    modified:
      bzrlib/tests/test_ancestry.py  test_ancestry.py-20050913023709-69768e94848312c6
=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py	2007-11-28 00:59:30 +0000
+++ b/bzrlib/graph.py	2007-11-30 15:20:15 +0000
@@ -16,6 +16,7 @@
 
 from bzrlib import (
     errors,
+    revision,
     tsort,
     )
 from bzrlib.deprecated_graph import (node_distances, select_farthest)
@@ -347,6 +348,13 @@
         smallest number of parent looksup to determine the ancestral
         relationship between N revisions.
         """
+        if revision.is_null(candidate_ancestor):
+            return True
+        if revision.is_null(candidate_descendant):
+            # if candidate_descendant is NULL_REVISION, then only
+            # candidate_ancestor == NULL_REVISION is an ancestor, but we've
+            # already handled that case.
+            return False
         return set([candidate_descendant]) == self.heads(
             [candidate_ancestor, candidate_descendant])
 

=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2007-10-26 19:18:48 +0000
+++ b/bzrlib/merge.py	2007-11-30 14:52:30 +0000
@@ -44,7 +44,7 @@
 from bzrlib.merge3 import Merge3
 from bzrlib.osutils import rename, pathjoin
 from progress import DummyProgress, ProgressPhase
-from bzrlib.revision import (is_ancestor, NULL_REVISION, ensure_null)
+from bzrlib.revision import (NULL_REVISION, ensure_null)
 from bzrlib.textfile import check_text_lines
 from bzrlib.trace import mutter, warning, note
 from bzrlib.transform import (TreeTransform, resolve_conflicts, cook_conflicts,
@@ -296,12 +296,11 @@
         self.base_branch = branch
         self._maybe_fetch(branch, self.this_branch, revision_id)
         self.base_tree = self.revision_tree(revision_id)
-        self.base_is_ancestor = is_ancestor(self.this_basis,
-                                            self.base_rev_id,
-                                            self.this_branch)
-        self.base_is_other_ancestor = is_ancestor(self.other_basis,
-                                                  self.base_rev_id,
-                                                  self.this_branch)
+        graph = self.this_branch.repository.get_graph()
+        self.base_is_ancestor = graph.is_ancestor(self.base_rev_id,
+                                                  self.this_basis)
+        self.base_is_other_ancestor = graph.is_ancestor(self.base_rev_id,
+                                                        self.other_basis)
 
     def _maybe_fetch(self, source, target, revision_id):
         if not source.repository.has_same_location(target.repository):
@@ -340,12 +339,11 @@
                 self.base_rev_id = _mod_revision.ensure_null(
                     base_branch.get_rev_id(base_revision[1]))
             self._maybe_fetch(base_branch, self.this_branch, self.base_rev_id)
-            self.base_is_ancestor = is_ancestor(self.this_basis, 
-                                                self.base_rev_id,
-                                                self.this_branch)
-            self.base_is_other_ancestor = is_ancestor(self.other_basis,
-                                                      self.base_rev_id,
-                                                      self.this_branch)
+            graph = self.this_branch.repository.get_graph()
+            self.base_is_ancestor = graph.is_ancestor(self.base_rev_id,
+                                                      self.this_basis)
+            self.base_is_other_ancestor = graph.is_ancestor(self.base_rev_id,
+                                                            self.other_basis)
 
     def do_merge(self):
         kwargs = {'working_tree':self.this_tree, 'this_tree': self.this_tree,

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2007-11-28 21:55:07 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2007-11-30 15:59:02 +0000
@@ -1033,7 +1033,8 @@
     def ensure_loaded(self):
         # NB: if you see an assertion error here, its probably access against
         # an unlocked repo. Naughty.
-        assert self.repo.is_locked()
+        if not self.repo.is_locked():
+            raise errors.ObjectNotLocked(self.repo)
         if self._names is None:
             self._names = {}
             self._packs_at_load = set()
@@ -1569,7 +1570,8 @@
         :returns: an iterator yielding tuples of (revison-id, parents-in-index,
             parents-in-revision).
         """
-        assert self.is_locked()
+        if not self.is_locked():
+            raise errors.ObjectNotLocked(self)
         pb = ui.ui_factory.nested_progress_bar()
         result = []
         try:

=== modified file 'bzrlib/revision.py'
--- a/bzrlib/revision.py	2007-11-30 03:34:33 +0000
+++ b/bzrlib/revision.py	2007-11-30 14:52:30 +0000
@@ -125,6 +125,7 @@
         return self.properties.get('author', self.committer)
 
 
+ at deprecated_function(symbol_versioning.zero_ninetythree)
 def is_ancestor(revision_id, candidate_id, branch):
     """Return true if candidate_id is an ancestor of revision_id.
 
@@ -133,9 +134,10 @@
     
     revisions_source is an object supporting a get_revision operation that
     behaves like Branch's.
+
+    This function is deprecated, it is better for callers to directly use
+    Graph.is_ancestor() (just watch out that the parameter order is switched)
     """
-    if is_null(candidate_id):
-        return True
     return branch.repository.get_graph().is_ancestor(candidate_id, revision_id)
 
 

=== modified file 'bzrlib/tests/test_ancestry.py'
--- a/bzrlib/tests/test_ancestry.py	2007-11-30 06:07:17 +0000
+++ b/bzrlib/tests/test_ancestry.py	2007-11-30 22:17:05 +0000
@@ -23,6 +23,7 @@
 from bzrlib.branch import Branch
 from bzrlib.branchbuilder import BranchBuilder
 from bzrlib.revision import is_ancestor
+from bzrlib.symbol_versioning import zero_ninetythree
 
 
 class TestAncestry(TestCaseWithMemoryTransport):
@@ -44,17 +45,21 @@
 
     def test_none_is_ancestor_empty_branch(self):
         branch = self.make_branch('.')
-        self.assertTrue(is_ancestor('null:', 'null:', branch))
+        self.assertTrue(self.applyDeprecated(zero_ninetythree,
+                        is_ancestor, 'null:', 'null:', branch))
 
     def test_none_is_ancestor_non_empty_branch(self):
         builder = BranchBuilder(self.get_transport())
         rev_id = builder.build_commit()
         branch = builder.get_branch()
         branch.lock_read()
-        self.assertTrue(is_ancestor('null:', 'null:', branch))
-        self.assertTrue(is_ancestor(rev_id, 'null:',  branch))
-        self.assertFalse(is_ancestor('null:', rev_id, branch))
-        branch.unlock()
+        self.addCleanup(branch.unlock)
+        self.assertTrue(self.applyDeprecated(zero_ninetythree,
+                        is_ancestor, 'null:', 'null:', branch))
+        self.assertTrue(self.applyDeprecated(zero_ninetythree,
+                        is_ancestor, rev_id, 'null:',  branch))
+        self.assertFalse(self.applyDeprecated(zero_ninetythree,
+                         is_ancestor, 'null:', rev_id, branch))
 
 
 # TODO: check that ancestry is updated to include indirectly merged revisions

=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py	2007-11-27 20:35:02 +0000
+++ b/bzrlib/tests/test_repository.py	2007-11-30 15:59:02 +0000
@@ -1195,7 +1195,13 @@
         repo = self.make_repository('.', format=format)
         packs = repo._pack_collection
         self.assertEqual([0], packs.pack_distribution(0))
-        
+
+    def test_ensure_loaded_unlocked(self):
+        format = self.get_format()
+        repo = self.make_repository('.', format=format)
+        self.assertRaises(errors.ObjectNotLocked,
+                          repo._pack_collection.ensure_loaded)
+
     def test_pack_distribution_one_to_nine(self):
         format = self.get_format()
         repo = self.make_repository('.', format=format)

=== modified file 'bzrlib/tests/test_revision.py'
--- a/bzrlib/tests/test_revision.py	2007-08-28 06:43:19 +0000
+++ b/bzrlib/tests/test_revision.py	2007-11-30 15:48:27 +0000
@@ -28,6 +28,7 @@
                              common_ancestor,
                              is_ancestor, MultipleRevisionSources,
                              NULL_REVISION)
+from bzrlib.symbol_versioning import zero_ninetythree
 from bzrlib.tests import TestCase, TestCaseWithTransport
 from bzrlib.trace import mutter
 from bzrlib.workingtree import WorkingTree
@@ -132,16 +133,28 @@
         revisions_2 = br2.revision_history()
         sources = br1
 
-        self.assert_(is_ancestor(revisions[0], revisions[0], br1))
-        self.assert_(is_ancestor(revisions[1], revisions[0], sources))
-        self.assert_(not is_ancestor(revisions[0], revisions[1], sources))
-        self.assert_(is_ancestor(revisions_2[3], revisions[0], sources))
+        br1.lock_read()
+        self.addCleanup(br1.unlock)
+        br2.lock_read()
+        self.addCleanup(br2.unlock)
+
+        self.assertTrue(self.applyDeprecated(zero_ninetythree,
+                        is_ancestor, revisions[0], revisions[0], br1))
+        self.assertTrue(self.applyDeprecated(zero_ninetythree,
+                        is_ancestor, revisions[1], revisions[0], sources))
+        self.assertFalse(self.applyDeprecated(zero_ninetythree,
+                         is_ancestor, revisions[0], revisions[1], sources))
+        self.assertTrue(self.applyDeprecated(zero_ninetythree,
+                        is_ancestor, revisions_2[3], revisions[0], sources))
         # disabled mbp 20050914, doesn't seem to happen anymore
         ## self.assertRaises(NoSuchRevision, is_ancestor, revisions_2[3],
         ##                  revisions[0], br1)        
-        self.assert_(is_ancestor(revisions[3], revisions_2[4], sources))
-        self.assert_(is_ancestor(revisions[3], revisions_2[4], br1))
-        self.assert_(is_ancestor(revisions[3], revisions_2[3], sources))
+        self.assertTrue(self.applyDeprecated(zero_ninetythree,
+                        is_ancestor, revisions[3], revisions_2[4], sources))
+        self.assertTrue(self.applyDeprecated(zero_ninetythree,
+                        is_ancestor, revisions[3], revisions_2[4], br1))
+        self.assertTrue(self.applyDeprecated(zero_ninetythree,
+                        is_ancestor, revisions[3], revisions_2[3], sources))
         ## self.assert_(not is_ancestor(revisions[3], revisions_2[3], br1))
 
 




More information about the bazaar-commits mailing list