Rev 5808: (Jelmer) Deprecate Branch.set_revision_history(). (Jelmer Vernooij) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Apr 20 21:01:44 UTC 2011


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

------------------------------------------------------------
revno: 5808 [merge]
revision-id: pqm at pqm.ubuntu.com-20110420210140-1akzbrzuwftl390r
parent: pqm at pqm.ubuntu.com-20110420020605-0l0fdx2alnsbv5c9
parent: jelmer at samba.org-20110420193200-4eiq8i7ko36hzvuv
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-04-20 21:01:40 +0000
message:
  (Jelmer) Deprecate Branch.set_revision_history(). (Jelmer Vernooij)
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/smart/branch.py         branch.py-20061124031907-mzh3pla28r83r97f-1
  bzrlib/tests/per_branch/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
  bzrlib/tests/per_branch/test_check.py test_check.py-20080429151303-1sbfclxhddpz0tnj-1
  bzrlib/tests/per_branch/test_get_revision_id_to_revno_map.py test_get_revision_id-20070417211641-6kcoj1c704gqqopn-1
  bzrlib/tests/per_branch/test_hooks.py test_hooks.py-20070129154855-blhpwxmvjs07waei-1
  bzrlib/tests/per_branch/test_reconcile.py test_reconcile.py-20080429161555-qlmccuyeyt6pvho7-1
  bzrlib/tests/per_branch/test_revision_history.py test_revision_histor-20070326062311-v7co92liyuchb80w-1
  bzrlib/tests/per_controldir/test_controldir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
  bzrlib/tests/per_workingtree/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
  bzrlib/tests/test_branch.py    test_branch.py-20060116013032-97819aa07b8ab3b5
  bzrlib/tests/test_bundle.py    test.py-20050630184834-092aa401ab9f039c
  bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
  bzrlib/tests/test_smart.py     test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
  bzrlib/tests/test_upgrade.py   test_upgrade.py-20051004040251-555fe1d2bae1bc71
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2011-04-19 13:56:32 +0000
+++ b/bzrlib/branch.py	2011-04-20 19:32:00 +0000
@@ -2511,9 +2511,13 @@
             'revision-history', '\n'.join(history),
             mode=self.bzrdir._get_file_mode())
 
-    @needs_write_lock
+    @deprecated_method(deprecated_in((2, 4, 0)))
     def set_revision_history(self, rev_history):
         """See Branch.set_revision_history."""
+        self._set_revision_history(rev_history)
+
+    @needs_write_lock
+    def _set_revision_history(self, rev_history):
         if 'evil' in debug.debug_flags:
             mutter_callsite(3, "set_revision_history scales with history.")
         check_not_reserved_id = _mod_revision.check_not_reserved_id
@@ -2563,7 +2567,7 @@
             except ValueError:
                 rev = self.repository.get_revision(revision_id)
                 new_history = rev.get_history(self.repository)[1:]
-        destination.set_revision_history(new_history)
+        destination._set_revision_history(new_history)
 
     @needs_write_lock
     def set_last_revision_info(self, revno, revision_id):
@@ -2585,7 +2589,7 @@
         history = self._lefthand_history(revision_id)
         if len(history) != revno:
             raise AssertionError('%d != %d' % (len(history), revno))
-        self.set_revision_history(history)
+        self._set_revision_history(history)
 
     def _gen_revision_history(self):
         history = self._transport.get_bytes('revision-history').split('\n')
@@ -2605,7 +2609,7 @@
         :param other_branch: The other branch that DivergedBranches should
             raise with respect to.
         """
-        self.set_revision_history(self._lefthand_history(revision_id,
+        self._set_revision_history(self._lefthand_history(revision_id,
             last_rev, other_branch))
 
     def basis_tree(self):

=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2011-04-19 13:56:32 +0000
+++ b/bzrlib/remote.py	2011-04-19 22:18:17 +0000
@@ -2919,8 +2919,14 @@
             raise errors.UnexpectedSmartServerResponse(response)
         self._run_post_change_branch_tip_hooks(old_revno, old_revid)
 
+    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4, 0)))
     @needs_write_lock
     def set_revision_history(self, rev_history):
+        """See Branch.set_revision_history."""
+        self._set_revision_history(rev_history)
+
+    @needs_write_lock
+    def _set_revision_history(self, rev_history):
         # Send just the tip revision of the history; the server will generate
         # the full history from that.  If the revision doesn't exist in this
         # branch, NoSuchRevision will be raised.
@@ -3039,7 +3045,7 @@
             except errors.UnknownSmartMethod:
                 medium._remember_remote_is_before((1, 6))
         self._clear_cached_state_of_remote_branch_only()
-        self.set_revision_history(self._lefthand_history(revision_id,
+        self._set_revision_history(self._lefthand_history(revision_id,
             last_rev=last_rev,other_branch=other_branch))
 
     def set_push_location(self, location):

=== modified file 'bzrlib/smart/branch.py'
--- a/bzrlib/smart/branch.py	2011-02-25 04:44:53 +0000
+++ b/bzrlib/smart/branch.py	2011-04-19 16:02:28 +0000
@@ -232,12 +232,12 @@
 
     def do_tip_change_with_locked_branch(self, branch, new_last_revision_id):
         if new_last_revision_id == 'null:':
-            branch.set_revision_history([])
+            branch._set_revision_history([])
         else:
             if not branch.repository.has_revision(new_last_revision_id):
                 return FailedSmartServerResponse(
                     ('NoSuchRevision', new_last_revision_id))
-            branch.set_revision_history(branch._lefthand_history(
+            branch._set_revision_history(branch._lefthand_history(
                 new_last_revision_id, None, None))
         return SuccessfulSmartServerResponse(('ok',))
 

=== modified file 'bzrlib/tests/per_branch/test_branch.py'
--- a/bzrlib/tests/per_branch/test_branch.py	2011-04-14 07:53:38 +0000
+++ b/bzrlib/tests/per_branch/test_branch.py	2011-04-19 14:42:38 +0000
@@ -29,6 +29,7 @@
     remote,
     repository,
     revision,
+    symbol_versioning,
     tests,
     )
 from bzrlib.tests import (
@@ -74,7 +75,7 @@
 
         br = self.get_branch()
         br.fetch(wt.branch)
-        br.set_revision_history(['rev1', 'rev2', 'rev3'])
+        br.generate_revision_history('rev3')
         rh = br.revision_history()
         self.assertEqual(['rev1', 'rev2', 'rev3'], rh)
         for revision_id in rh:
@@ -459,9 +460,11 @@
         tree = self.make_branch_and_tree('a')
         tree.commit('a commit', rev_id='rev1')
         br = tree.branch
-        br.set_revision_history(["rev1"])
+        self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
+            br.set_revision_history, ["rev1"])
         self.assertEquals(br.revision_history(), ["rev1"])
-        br.set_revision_history([])
+        self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
+            br.set_revision_history, [])
         self.assertEquals(br.revision_history(), [])
 
     def test_heads_to_fetch(self):

=== modified file 'bzrlib/tests/per_branch/test_check.py'
--- a/bzrlib/tests/per_branch/test_check.py	2009-08-04 04:36:34 +0000
+++ b/bzrlib/tests/per_branch/test_check.py	2011-04-19 14:17:24 +0000
@@ -19,6 +19,7 @@
 from StringIO import StringIO
 
 from bzrlib import errors, tests, ui
+from bzrlib.symbol_versioning import deprecated_in
 from bzrlib.tests.per_branch import TestCaseWithBranch
 
 
@@ -44,7 +45,8 @@
         r5 = tree.commit('five')
         # Now, try to set an invalid history
         try:
-            tree.branch.set_revision_history([r1, r2b, r5])
+            self.applyDeprecated(deprecated_in((2, 4, 0)),
+                tree.branch.set_revision_history, [r1, r2b, r5])
             if tree.branch.last_revision_info() != (3, r5):
                 # RemoteBranch silently corrects an impossible revision
                 # history given to set_revision_history.  It can be tricked

=== modified file 'bzrlib/tests/per_branch/test_get_revision_id_to_revno_map.py'
--- a/bzrlib/tests/per_branch/test_get_revision_id_to_revno_map.py	2009-07-10 05:49:34 +0000
+++ b/bzrlib/tests/per_branch/test_get_revision_id_to_revno_map.py	2011-04-19 14:17:24 +0000
@@ -16,11 +16,7 @@
 
 """Tests for Branch.get_revision_id_to_revno_map()"""
 
-from bzrlib import (
-    errors,
-    revision,
-    )
-
+from bzrlib.symbol_versioning import deprecated_in
 from bzrlib.tests.per_branch import TestCaseWithBranch
 
 
@@ -93,7 +89,8 @@
             self.assertEqual({'rev-1':(1,), 'rev-2':(2,), 'rev-3':(3,),
                               'rev-1.1.1':(1,1,1)
                              }, branch.get_revision_id_to_revno_map())
-            branch.set_revision_history(['rev-1', 'rev-2'])
+            self.applyDeprecated(deprecated_in((2, 4, 0)),
+                branch.set_revision_history, ['rev-1', 'rev-2'])
             self.assertEqual({'rev-1':(1,), 'rev-2':(2,)},
                              branch.get_revision_id_to_revno_map())
             self.assertEqual({'rev-1':(1,), 'rev-2':(2,)},

=== modified file 'bzrlib/tests/per_branch/test_hooks.py'
--- a/bzrlib/tests/per_branch/test_hooks.py	2010-02-23 07:43:11 +0000
+++ b/bzrlib/tests/per_branch/test_hooks.py	2011-04-19 14:17:24 +0000
@@ -23,6 +23,7 @@
     revision,
     tests,
     )
+from bzrlib.symbol_versioning import deprecated_in
 from bzrlib.tests import test_server
 
 class ChangeBranchTipTestCase(tests.TestCaseWithMemoryTransport):
@@ -87,7 +88,8 @@
         branch = self.make_branch('source')
         _mod_branch.Branch.hooks.install_named_hook(
             'set_rh', self.capture_set_rh_hook, None)
-        branch.set_revision_history([])
+        self.applyDeprecated(deprecated_in((2, 4, 0)),
+            branch.set_revision_history, [])
         expected_params = ('set_rh', branch, [], True)
         self.assertHookCalls(expected_params, branch)
 
@@ -103,7 +105,8 @@
             'set_rh', self.capture_set_rh_hook, None)
         # some branches require that their history be set to a revision in the
         # repository
-        branch.set_revision_history(['f\xc2\xb5'])
+        self.applyDeprecated(deprecated_in((2, 4, 0)),
+            branch.set_revision_history, ['f\xc2\xb5'])
         expected_params =('set_rh', branch, ['f\xc2\xb5'], True)
         self.assertHookCalls(expected_params, branch)
 
@@ -111,7 +114,8 @@
         branch = self.make_branch('source')
         _mod_branch.Branch.hooks.install_named_hook(
             'set_rh', self.capture_set_rh_hook, None)
-        branch.set_revision_history([])
+        self.applyDeprecated(deprecated_in((2, 4, 0)),
+            branch.set_revision_history, [])
         expected_params = ('set_rh', branch, [], True)
         self.assertHookCalls(expected_params, branch)
 
@@ -121,7 +125,8 @@
             'set_rh', self.capture_set_rh_hook, None)
         _mod_branch.Branch.hooks.install_named_hook(
             'set_rh', self.capture_set_rh_hook, None)
-        branch.set_revision_history([])
+        self.applyDeprecated(deprecated_in((2, 4, 0)),
+            branch.set_revision_history, [])
         expected_calls = [('set_rh', branch, [], True),
             ('set_rh', branch, [], True),
             ]
@@ -386,7 +391,8 @@
 
     def test_set_revision_history(self):
         branch = self.make_branch('')
-        branch.set_revision_history([])
+        self.applyDeprecated(deprecated_in((2, 4, 0)),
+            branch.set_revision_history, [])
         self.assertPreAndPostHooksWereInvoked(branch, True)
 
     def test_set_last_revision_info(self):

=== modified file 'bzrlib/tests/per_branch/test_reconcile.py'
--- a/bzrlib/tests/per_branch/test_reconcile.py	2009-07-10 05:49:34 +0000
+++ b/bzrlib/tests/per_branch/test_reconcile.py	2011-04-19 14:17:24 +0000
@@ -17,6 +17,7 @@
 """Tests for branch implementations - test reconcile() functionality"""
 
 from bzrlib import errors, reconcile
+from bzrlib.symbol_versioning import deprecated_in
 from bzrlib.tests.per_branch import TestCaseWithBranch
 
 
@@ -42,7 +43,8 @@
         r5 = tree.commit('five')
         # Now, try to set an invalid history
         try:
-            tree.branch.set_revision_history([r1, r2b, r5])
+            self.applyDeprecated(deprecated_in((2, 4, 0)),
+                tree.branch.set_revision_history, [r1, r2b, r5])
             if tree.branch.last_revision_info() != (3, r5):
                 # RemoteBranch silently corrects an impossible revision
                 # history given to set_revision_history.  It can be tricked

=== modified file 'bzrlib/tests/per_branch/test_revision_history.py'
--- a/bzrlib/tests/per_branch/test_revision_history.py	2011-04-19 13:56:32 +0000
+++ b/bzrlib/tests/per_branch/test_revision_history.py	2011-04-19 22:30:08 +0000
@@ -21,6 +21,7 @@
     errors,
     revision as _mod_revision,
     )
+from bzrlib.symbol_versioning import deprecated_in
 from bzrlib.tests import per_branch
 
 
@@ -112,7 +113,8 @@
         # Lock the branch, set the revision history, then repeatedly call
         # revision_history.
         branch.lock_write()
-        branch.set_revision_history([])
+        self.applyDeprecated(deprecated_in((2, 4, 0)),
+            branch.set_revision_history, [])
         try:
             branch.revision_history()
             self.assertEqual([], calls)
@@ -124,7 +126,8 @@
         cause the revision history to be cached.
         """
         branch, calls = self.get_instrumented_branch()
-        branch.set_revision_history([])
+        self.applyDeprecated(deprecated_in((2, 4, 0)),
+            branch.set_revision_history, [])
         branch.revision_history()
         self.assertEqual(['_gen_revision_history'], calls)
 

=== modified file 'bzrlib/tests/per_controldir/test_controldir.py'
--- a/bzrlib/tests/per_controldir/test_controldir.py	2011-04-15 07:01:22 +0000
+++ b/bzrlib/tests/per_controldir/test_controldir.py	2011-04-19 14:19:50 +0000
@@ -194,7 +194,8 @@
         self.build_tree(['foo'], transport=tree.bzrdir.root_transport)
         tree.add('foo')
         tree.commit('revision 1', rev_id='1')
-        tree.bzrdir.open_branch().set_revision_history([])
+        tree.bzrdir.open_branch().generate_revision_history(
+            bzrlib.revision.NULL_REVISION)
         tree.set_parent_trees([])
         tree.commit('revision 2', rev_id='2')
         # Copy the content (i.e. revisions) from the 'commit_tree' branch's
@@ -222,7 +223,8 @@
         self.build_tree(['commit_tree/foo'])
         tree.add('foo')
         tree.commit('revision 1', rev_id='1')
-        tree.branch.bzrdir.open_branch().set_revision_history([])
+        tree.branch.bzrdir.open_branch().generate_revision_history(
+            bzrlib.revision.NULL_REVISION)
         tree.set_parent_trees([])
         tree.commit('revision 2', rev_id='2')
         tree.branch.repository.copy_content_into(shared_repo)
@@ -249,7 +251,8 @@
         self.build_tree(['commit_tree/foo'])
         tree.add('foo')
         tree.commit('revision 1', rev_id='1')
-        tree.branch.bzrdir.open_branch().set_revision_history([])
+        tree.branch.bzrdir.open_branch().generate_revision_history(
+            bzrlib.revision.NULL_REVISION)
         tree.set_parent_trees([])
         tree.commit('revision 2', rev_id='2')
         source = self.make_repository('source')
@@ -447,7 +450,8 @@
         self.build_tree(['commit_tree/foo'])
         tree.add('foo')
         tree.commit('revision 1', rev_id='1')
-        tree.bzrdir.open_branch().set_revision_history([])
+        tree.bzrdir.open_branch().generate_revision_history(
+            bzrlib.revision.NULL_REVISION)
         tree.set_parent_trees([])
         tree.commit('revision 2', rev_id='2')
         source = self.make_repository('source')
@@ -470,7 +474,8 @@
         self.build_tree(['commit_tree/foo'])
         tree.add('foo')
         tree.commit('revision 1', rev_id='1')
-        tree.bzrdir.open_branch().set_revision_history([])
+        tree.bzrdir.open_branch().generate_revision_history(
+            bzrlib.revision.NULL_REVISION)
         tree.set_parent_trees([])
         tree.commit('revision 2', rev_id='2')
         tree.branch.repository.copy_content_into(shared_repo)
@@ -490,7 +495,8 @@
         self.build_tree(['commit_tree/foo'])
         tree.add('foo')
         tree.commit('revision 1', rev_id='1')
-        tree.bzrdir.open_branch().set_revision_history([])
+        tree.bzrdir.open_branch().generate_revision_history(
+            bzrlib.revision.NULL_REVISION)
         tree.set_parent_trees([])
         tree.commit('revision 2', rev_id='2')
         tree.branch.repository.copy_content_into(shared_repo)
@@ -517,7 +523,8 @@
         self.build_tree(['commit_tree/foo'])
         tree.add('foo')
         tree.commit('revision 1', rev_id='1')
-        tree.bzrdir.open_branch().set_revision_history([])
+        tree.bzrdir.open_branch().generate_revision_history(
+            bzrlib.revision.NULL_REVISION)
         tree.set_parent_trees([])
         tree.commit('revision 2', rev_id='2')
         source = self.make_repository('source')
@@ -540,7 +547,8 @@
         self.build_tree(['commit_tree/foo'])
         tree.add('foo')
         tree.commit('revision 1', rev_id='1')
-        tree.bzrdir.open_branch().set_revision_history([])
+        br = tree.bzrdir.open_branch()
+        br.set_last_revision_info(0, bzrlib.revision.NULL_REVISION)
         tree.set_parent_trees([])
         tree.commit('revision 2', rev_id='2')
         source = self.make_repository('source')

=== modified file 'bzrlib/tests/per_workingtree/test_workingtree.py'
--- a/bzrlib/tests/per_workingtree/test_workingtree.py	2011-04-15 07:01:22 +0000
+++ b/bzrlib/tests/per_workingtree/test_workingtree.py	2011-04-20 16:40:53 +0000
@@ -327,7 +327,7 @@
         # because some formats mutate the branch to set it on the tree
         # we need to alter the branch to let this pass.
         try:
-            wt.branch.set_revision_history(['A', 'B'])
+            wt.branch._set_revision_history(['A', 'B'])
         except errors.NoSuchRevision, e:
             self.assertEqual('B', e.revision)
             raise TestSkipped("Branch format does not permit arbitrary"

=== modified file 'bzrlib/tests/test_branch.py'
--- a/bzrlib/tests/test_branch.py	2011-04-15 07:01:22 +0000
+++ b/bzrlib/tests/test_branch.py	2011-04-19 14:19:50 +0000
@@ -349,10 +349,13 @@
         branch = builder.get_branch()
         branch.lock_write()
         self.addCleanup(branch.unlock)
-        branch.set_revision_history(['foo', 'bar'])
-        branch.set_revision_history(['foo'])
+        self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
+            branch.set_revision_history, ['foo', 'bar'])
+        self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
+                branch.set_revision_history, ['foo'])
         self.assertRaises(errors.NotLefthandHistory,
-                          branch.set_revision_history, ['bar'])
+            self.applyDeprecated, symbol_versioning.deprecated_in((2, 4, 0)),
+            branch.set_revision_history, ['bar'])
 
     def do_checkout_test(self, lightweight=False):
         tree = self.make_branch_and_tree('source',

=== modified file 'bzrlib/tests/test_bundle.py'
--- a/bzrlib/tests/test_bundle.py	2011-04-19 10:59:05 +0000
+++ b/bzrlib/tests/test_bundle.py	2011-04-19 14:19:50 +0000
@@ -28,6 +28,7 @@
     merge,
     osutils,
     revision as _mod_revision,
+    symbol_versioning,
     tests,
     treebuilder,
     )
@@ -506,7 +507,8 @@
                 old.unlock()
         if not _mod_revision.is_null(rev_id):
             rh = self.b1.revision_history()
-            tree.branch.set_revision_history(rh[:rh.index(rev_id)+1])
+            self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
+                tree.branch.set_revision_history, rh[:rh.index(rev_id)+1])
             tree.update()
             delta = tree.changes_from(self.b1.repository.revision_tree(rev_id))
             self.assertFalse(delta.has_changed(),

=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py	2011-04-05 17:37:53 +0000
+++ b/bzrlib/tests/test_remote.py	2011-04-19 23:15:49 +0000
@@ -1377,7 +1377,7 @@
 class TestBranchSetLastRevision(RemoteBranchTestCase):
 
     def test_set_empty(self):
-        # set_revision_history([]) is translated to calling
+        # _set_last_revision_info('null:') is translated to calling
         # Branch.set_last_revision(path, '') on the wire.
         transport = MemoryTransport()
         transport.mkdir('branch')
@@ -1405,13 +1405,13 @@
         # unnecessarily invokes _ensure_real upon a call to lock_write.
         branch._ensure_real = lambda: None
         branch.lock_write()
-        result = branch.set_revision_history([])
+        result = branch._set_last_revision(NULL_REVISION)
         branch.unlock()
         self.assertEqual(None, result)
         self.assertFinished(client)
 
     def test_set_nonempty(self):
-        # set_revision_history([rev-id1, ..., rev-idN]) is translated to calling
+        # set_last_revision_info(N, rev-idN) is translated to calling
         # Branch.set_last_revision(path, rev-idN) on the wire.
         transport = MemoryTransport()
         transport.mkdir('branch')
@@ -1443,7 +1443,7 @@
         branch._ensure_real = lambda: None
         # Lock the branch, reset the record of remote calls.
         branch.lock_write()
-        result = branch.set_revision_history(['rev-id1', 'rev-id2'])
+        result = branch._set_last_revision('rev-id2')
         branch.unlock()
         self.assertEqual(None, result)
         self.assertFinished(client)
@@ -1479,7 +1479,7 @@
         branch = self.make_remote_branch(transport, client)
         branch.lock_write()
         self.assertRaises(
-            errors.NoSuchRevision, branch.set_revision_history, ['rev-id'])
+            errors.NoSuchRevision, branch._set_last_revision, 'rev-id')
         branch.unlock()
         self.assertFinished(client)
 
@@ -1516,9 +1516,10 @@
         branch._ensure_real = lambda: None
         branch.lock_write()
         # The 'TipChangeRejected' error response triggered by calling
-        # set_revision_history causes a TipChangeRejected exception.
+        # set_last_revision_info causes a TipChangeRejected exception.
         err = self.assertRaises(
-            errors.TipChangeRejected, branch.set_revision_history, ['rev-id'])
+            errors.TipChangeRejected,
+            branch._set_last_revision, 'rev-id')
         # The UTF-8 message from the response has been decoded into a unicode
         # object.
         self.assertIsInstance(err.msg, unicode)

=== modified file 'bzrlib/tests/test_smart.py'
--- a/bzrlib/tests/test_smart.py	2011-02-07 02:39:15 +0000
+++ b/bzrlib/tests/test_smart.py	2011-04-19 14:17:24 +0000
@@ -932,7 +932,7 @@
         # its repository.
         self.make_tree_with_two_commits()
         rev_id_utf8 = u'\xc8'.encode('utf-8')
-        self.tree.branch.set_revision_history([])
+        self.tree.branch.set_last_revision_info(0, 'null:')
         self.assertEqual(
             (0, 'null:'), self.tree.branch.last_revision_info())
         # We can update the branch to a revision that is present in the

=== modified file 'bzrlib/tests/test_upgrade.py'
--- a/bzrlib/tests/test_upgrade.py	2011-04-15 07:01:22 +0000
+++ b/bzrlib/tests/test_upgrade.py	2011-04-19 22:44:49 +0000
@@ -25,7 +25,6 @@
 from bzrlib import (
     branch,
     bzrdir,
-    repository,
     tests,
     upgrade,
     workingtree,
@@ -42,7 +41,7 @@
 
     def test_convert_branch5_branch6(self):
         b = self.make_branch('branch', format='knit')
-        b.set_revision_history(['AB', 'CD'])
+        b._set_revision_history(['CD'])
         b.set_parent('file:///EF')
         b.set_bound_location('file:///GH')
         b.set_push_location('file:///IJ')

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2011-04-17 18:24:56 +0000
+++ b/bzrlib/workingtree.py	2011-04-20 16:40:53 +0000
@@ -1264,13 +1264,13 @@
         when their last revision is set.
         """
         if _mod_revision.is_null(new_revision):
-            self.branch.set_revision_history([])
+            self.branch.set_last_revision_info(0, new_revision)
             return False
         try:
             self.branch.generate_revision_history(new_revision)
         except errors.NoSuchRevision:
             # not present in the repo - dont try to set it deeper than the tip
-            self.branch.set_revision_history([new_revision])
+            self.branch._set_revision_history([new_revision])
         return True
 
     @needs_tree_write_lock

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-04-19 14:12:43 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-04-19 14:19:50 +0000
@@ -352,6 +352,9 @@
   (``bzrlib.branch.format_registry``) rather than using the class
   methods on ``BranchFormat``. (Jelmer Vernooij, #714729)
 
+* ``Branch.set_revision_history`` is now deprecated.
+  (Jelmer Vernooij)
+
 * ``BranchFormat.supports_leaving_lock()`` and
   ``RepositoryFormat.supports_leaving_lock`` flags have been added.
   (Jelmer Vernooij)




More information about the bazaar-commits mailing list