Merge lp:~jelmer/bzr/deprecate-set-revision-history into lp:bzr

Proposed by Jelmer Vernooij
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 5808
Proposed branch: lp:~jelmer/bzr/deprecate-set-revision-history
Merge into: lp:bzr
Diff against target: 560 lines (+89/-50)
18 files modified
bzrlib/branch.py (+8/-4)
bzrlib/remote.py (+7/-1)
bzrlib/smart/branch.py (+2/-2)
bzrlib/tests/per_branch/test_branch.py (+6/-3)
bzrlib/tests/per_branch/test_check.py (+3/-1)
bzrlib/tests/per_branch/test_get_revision_id_to_revno_map.py (+3/-6)
bzrlib/tests/per_branch/test_hooks.py (+11/-5)
bzrlib/tests/per_branch/test_reconcile.py (+3/-1)
bzrlib/tests/per_branch/test_revision_history.py (+5/-2)
bzrlib/tests/per_controldir/test_controldir.py (+16/-8)
bzrlib/tests/per_workingtree/test_workingtree.py (+1/-1)
bzrlib/tests/test_branch.py (+6/-3)
bzrlib/tests/test_bundle.py (+3/-1)
bzrlib/tests/test_remote.py (+8/-7)
bzrlib/tests/test_smart.py (+1/-1)
bzrlib/tests/test_upgrade.py (+1/-2)
bzrlib/workingtree.py (+2/-2)
doc/en/release-notes/bzr-2.4.txt (+3/-0)
To merge this branch: bzr merge lp:~jelmer/bzr/deprecate-set-revision-history
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+58326@code.launchpad.net

Commit message

Deprecate Branch.set_revision_history.

Description of the change

Deprecate Branch.set_revision_history.

The underlying code in set_last_revision_info() still works with full revision histories; the next step is to change this.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/19/2011 05:23 PM, Jelmer Vernooij wrote:
> Jelmer Vernooij has proposed merging lp:~jelmer/bzr/deprecate-set-revision-history into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
>
> For more details, see:
> https://code.launchpad.net/~jelmer/bzr/deprecate-set-revision-history/+merge/58326
>
> Deprecate Branch.set_revision_history.
>
> The underlying code in set_last_revision_info() still works with full revision
> histories; the next step is to change this.

 merge: approve

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2tr6kACgkQJdeBCYSNAANOqACfbZSTo0f04GGntW4WdfjJdj1r
ffIAoLVHgf5n2r5RV6zAX010hs+JBSbP
=S8Kf
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

sent to pqm by email

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/branch.py'
2--- bzrlib/branch.py 2011-04-19 13:56:32 +0000
3+++ bzrlib/branch.py 2011-04-20 19:44:37 +0000
4@@ -2511,9 +2511,13 @@
5 'revision-history', '\n'.join(history),
6 mode=self.bzrdir._get_file_mode())
7
8- @needs_write_lock
9+ @deprecated_method(deprecated_in((2, 4, 0)))
10 def set_revision_history(self, rev_history):
11 """See Branch.set_revision_history."""
12+ self._set_revision_history(rev_history)
13+
14+ @needs_write_lock
15+ def _set_revision_history(self, rev_history):
16 if 'evil' in debug.debug_flags:
17 mutter_callsite(3, "set_revision_history scales with history.")
18 check_not_reserved_id = _mod_revision.check_not_reserved_id
19@@ -2563,7 +2567,7 @@
20 except ValueError:
21 rev = self.repository.get_revision(revision_id)
22 new_history = rev.get_history(self.repository)[1:]
23- destination.set_revision_history(new_history)
24+ destination._set_revision_history(new_history)
25
26 @needs_write_lock
27 def set_last_revision_info(self, revno, revision_id):
28@@ -2585,7 +2589,7 @@
29 history = self._lefthand_history(revision_id)
30 if len(history) != revno:
31 raise AssertionError('%d != %d' % (len(history), revno))
32- self.set_revision_history(history)
33+ self._set_revision_history(history)
34
35 def _gen_revision_history(self):
36 history = self._transport.get_bytes('revision-history').split('\n')
37@@ -2605,7 +2609,7 @@
38 :param other_branch: The other branch that DivergedBranches should
39 raise with respect to.
40 """
41- self.set_revision_history(self._lefthand_history(revision_id,
42+ self._set_revision_history(self._lefthand_history(revision_id,
43 last_rev, other_branch))
44
45 def basis_tree(self):
46
47=== modified file 'bzrlib/remote.py'
48--- bzrlib/remote.py 2011-04-19 13:56:32 +0000
49+++ bzrlib/remote.py 2011-04-20 19:44:37 +0000
50@@ -2919,8 +2919,14 @@
51 raise errors.UnexpectedSmartServerResponse(response)
52 self._run_post_change_branch_tip_hooks(old_revno, old_revid)
53
54+ @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4, 0)))
55 @needs_write_lock
56 def set_revision_history(self, rev_history):
57+ """See Branch.set_revision_history."""
58+ self._set_revision_history(rev_history)
59+
60+ @needs_write_lock
61+ def _set_revision_history(self, rev_history):
62 # Send just the tip revision of the history; the server will generate
63 # the full history from that. If the revision doesn't exist in this
64 # branch, NoSuchRevision will be raised.
65@@ -3039,7 +3045,7 @@
66 except errors.UnknownSmartMethod:
67 medium._remember_remote_is_before((1, 6))
68 self._clear_cached_state_of_remote_branch_only()
69- self.set_revision_history(self._lefthand_history(revision_id,
70+ self._set_revision_history(self._lefthand_history(revision_id,
71 last_rev=last_rev,other_branch=other_branch))
72
73 def set_push_location(self, location):
74
75=== modified file 'bzrlib/smart/branch.py'
76--- bzrlib/smart/branch.py 2011-02-25 04:44:53 +0000
77+++ bzrlib/smart/branch.py 2011-04-20 19:44:37 +0000
78@@ -232,12 +232,12 @@
79
80 def do_tip_change_with_locked_branch(self, branch, new_last_revision_id):
81 if new_last_revision_id == 'null:':
82- branch.set_revision_history([])
83+ branch._set_revision_history([])
84 else:
85 if not branch.repository.has_revision(new_last_revision_id):
86 return FailedSmartServerResponse(
87 ('NoSuchRevision', new_last_revision_id))
88- branch.set_revision_history(branch._lefthand_history(
89+ branch._set_revision_history(branch._lefthand_history(
90 new_last_revision_id, None, None))
91 return SuccessfulSmartServerResponse(('ok',))
92
93
94=== modified file 'bzrlib/tests/per_branch/test_branch.py'
95--- bzrlib/tests/per_branch/test_branch.py 2011-04-14 07:53:38 +0000
96+++ bzrlib/tests/per_branch/test_branch.py 2011-04-20 19:44:37 +0000
97@@ -29,6 +29,7 @@
98 remote,
99 repository,
100 revision,
101+ symbol_versioning,
102 tests,
103 )
104 from bzrlib.tests import (
105@@ -74,7 +75,7 @@
106
107 br = self.get_branch()
108 br.fetch(wt.branch)
109- br.set_revision_history(['rev1', 'rev2', 'rev3'])
110+ br.generate_revision_history('rev3')
111 rh = br.revision_history()
112 self.assertEqual(['rev1', 'rev2', 'rev3'], rh)
113 for revision_id in rh:
114@@ -459,9 +460,11 @@
115 tree = self.make_branch_and_tree('a')
116 tree.commit('a commit', rev_id='rev1')
117 br = tree.branch
118- br.set_revision_history(["rev1"])
119+ self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
120+ br.set_revision_history, ["rev1"])
121 self.assertEquals(br.revision_history(), ["rev1"])
122- br.set_revision_history([])
123+ self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
124+ br.set_revision_history, [])
125 self.assertEquals(br.revision_history(), [])
126
127 def test_heads_to_fetch(self):
128
129=== modified file 'bzrlib/tests/per_branch/test_check.py'
130--- bzrlib/tests/per_branch/test_check.py 2009-08-04 04:36:34 +0000
131+++ bzrlib/tests/per_branch/test_check.py 2011-04-20 19:44:37 +0000
132@@ -19,6 +19,7 @@
133 from StringIO import StringIO
134
135 from bzrlib import errors, tests, ui
136+from bzrlib.symbol_versioning import deprecated_in
137 from bzrlib.tests.per_branch import TestCaseWithBranch
138
139
140@@ -44,7 +45,8 @@
141 r5 = tree.commit('five')
142 # Now, try to set an invalid history
143 try:
144- tree.branch.set_revision_history([r1, r2b, r5])
145+ self.applyDeprecated(deprecated_in((2, 4, 0)),
146+ tree.branch.set_revision_history, [r1, r2b, r5])
147 if tree.branch.last_revision_info() != (3, r5):
148 # RemoteBranch silently corrects an impossible revision
149 # history given to set_revision_history. It can be tricked
150
151=== modified file 'bzrlib/tests/per_branch/test_get_revision_id_to_revno_map.py'
152--- bzrlib/tests/per_branch/test_get_revision_id_to_revno_map.py 2009-07-10 05:49:34 +0000
153+++ bzrlib/tests/per_branch/test_get_revision_id_to_revno_map.py 2011-04-20 19:44:37 +0000
154@@ -16,11 +16,7 @@
155
156 """Tests for Branch.get_revision_id_to_revno_map()"""
157
158-from bzrlib import (
159- errors,
160- revision,
161- )
162-
163+from bzrlib.symbol_versioning import deprecated_in
164 from bzrlib.tests.per_branch import TestCaseWithBranch
165
166
167@@ -93,7 +89,8 @@
168 self.assertEqual({'rev-1':(1,), 'rev-2':(2,), 'rev-3':(3,),
169 'rev-1.1.1':(1,1,1)
170 }, branch.get_revision_id_to_revno_map())
171- branch.set_revision_history(['rev-1', 'rev-2'])
172+ self.applyDeprecated(deprecated_in((2, 4, 0)),
173+ branch.set_revision_history, ['rev-1', 'rev-2'])
174 self.assertEqual({'rev-1':(1,), 'rev-2':(2,)},
175 branch.get_revision_id_to_revno_map())
176 self.assertEqual({'rev-1':(1,), 'rev-2':(2,)},
177
178=== modified file 'bzrlib/tests/per_branch/test_hooks.py'
179--- bzrlib/tests/per_branch/test_hooks.py 2010-02-23 07:43:11 +0000
180+++ bzrlib/tests/per_branch/test_hooks.py 2011-04-20 19:44:37 +0000
181@@ -23,6 +23,7 @@
182 revision,
183 tests,
184 )
185+from bzrlib.symbol_versioning import deprecated_in
186 from bzrlib.tests import test_server
187
188 class ChangeBranchTipTestCase(tests.TestCaseWithMemoryTransport):
189@@ -87,7 +88,8 @@
190 branch = self.make_branch('source')
191 _mod_branch.Branch.hooks.install_named_hook(
192 'set_rh', self.capture_set_rh_hook, None)
193- branch.set_revision_history([])
194+ self.applyDeprecated(deprecated_in((2, 4, 0)),
195+ branch.set_revision_history, [])
196 expected_params = ('set_rh', branch, [], True)
197 self.assertHookCalls(expected_params, branch)
198
199@@ -103,7 +105,8 @@
200 'set_rh', self.capture_set_rh_hook, None)
201 # some branches require that their history be set to a revision in the
202 # repository
203- branch.set_revision_history(['f\xc2\xb5'])
204+ self.applyDeprecated(deprecated_in((2, 4, 0)),
205+ branch.set_revision_history, ['f\xc2\xb5'])
206 expected_params =('set_rh', branch, ['f\xc2\xb5'], True)
207 self.assertHookCalls(expected_params, branch)
208
209@@ -111,7 +114,8 @@
210 branch = self.make_branch('source')
211 _mod_branch.Branch.hooks.install_named_hook(
212 'set_rh', self.capture_set_rh_hook, None)
213- branch.set_revision_history([])
214+ self.applyDeprecated(deprecated_in((2, 4, 0)),
215+ branch.set_revision_history, [])
216 expected_params = ('set_rh', branch, [], True)
217 self.assertHookCalls(expected_params, branch)
218
219@@ -121,7 +125,8 @@
220 'set_rh', self.capture_set_rh_hook, None)
221 _mod_branch.Branch.hooks.install_named_hook(
222 'set_rh', self.capture_set_rh_hook, None)
223- branch.set_revision_history([])
224+ self.applyDeprecated(deprecated_in((2, 4, 0)),
225+ branch.set_revision_history, [])
226 expected_calls = [('set_rh', branch, [], True),
227 ('set_rh', branch, [], True),
228 ]
229@@ -386,7 +391,8 @@
230
231 def test_set_revision_history(self):
232 branch = self.make_branch('')
233- branch.set_revision_history([])
234+ self.applyDeprecated(deprecated_in((2, 4, 0)),
235+ branch.set_revision_history, [])
236 self.assertPreAndPostHooksWereInvoked(branch, True)
237
238 def test_set_last_revision_info(self):
239
240=== modified file 'bzrlib/tests/per_branch/test_reconcile.py'
241--- bzrlib/tests/per_branch/test_reconcile.py 2009-07-10 05:49:34 +0000
242+++ bzrlib/tests/per_branch/test_reconcile.py 2011-04-20 19:44:37 +0000
243@@ -17,6 +17,7 @@
244 """Tests for branch implementations - test reconcile() functionality"""
245
246 from bzrlib import errors, reconcile
247+from bzrlib.symbol_versioning import deprecated_in
248 from bzrlib.tests.per_branch import TestCaseWithBranch
249
250
251@@ -42,7 +43,8 @@
252 r5 = tree.commit('five')
253 # Now, try to set an invalid history
254 try:
255- tree.branch.set_revision_history([r1, r2b, r5])
256+ self.applyDeprecated(deprecated_in((2, 4, 0)),
257+ tree.branch.set_revision_history, [r1, r2b, r5])
258 if tree.branch.last_revision_info() != (3, r5):
259 # RemoteBranch silently corrects an impossible revision
260 # history given to set_revision_history. It can be tricked
261
262=== modified file 'bzrlib/tests/per_branch/test_revision_history.py'
263--- bzrlib/tests/per_branch/test_revision_history.py 2011-04-19 13:56:32 +0000
264+++ bzrlib/tests/per_branch/test_revision_history.py 2011-04-20 19:44:37 +0000
265@@ -21,6 +21,7 @@
266 errors,
267 revision as _mod_revision,
268 )
269+from bzrlib.symbol_versioning import deprecated_in
270 from bzrlib.tests import per_branch
271
272
273@@ -112,7 +113,8 @@
274 # Lock the branch, set the revision history, then repeatedly call
275 # revision_history.
276 branch.lock_write()
277- branch.set_revision_history([])
278+ self.applyDeprecated(deprecated_in((2, 4, 0)),
279+ branch.set_revision_history, [])
280 try:
281 branch.revision_history()
282 self.assertEqual([], calls)
283@@ -124,7 +126,8 @@
284 cause the revision history to be cached.
285 """
286 branch, calls = self.get_instrumented_branch()
287- branch.set_revision_history([])
288+ self.applyDeprecated(deprecated_in((2, 4, 0)),
289+ branch.set_revision_history, [])
290 branch.revision_history()
291 self.assertEqual(['_gen_revision_history'], calls)
292
293
294=== modified file 'bzrlib/tests/per_controldir/test_controldir.py'
295--- bzrlib/tests/per_controldir/test_controldir.py 2011-04-15 07:01:22 +0000
296+++ bzrlib/tests/per_controldir/test_controldir.py 2011-04-20 19:44:37 +0000
297@@ -194,7 +194,8 @@
298 self.build_tree(['foo'], transport=tree.bzrdir.root_transport)
299 tree.add('foo')
300 tree.commit('revision 1', rev_id='1')
301- tree.bzrdir.open_branch().set_revision_history([])
302+ tree.bzrdir.open_branch().generate_revision_history(
303+ bzrlib.revision.NULL_REVISION)
304 tree.set_parent_trees([])
305 tree.commit('revision 2', rev_id='2')
306 # Copy the content (i.e. revisions) from the 'commit_tree' branch's
307@@ -222,7 +223,8 @@
308 self.build_tree(['commit_tree/foo'])
309 tree.add('foo')
310 tree.commit('revision 1', rev_id='1')
311- tree.branch.bzrdir.open_branch().set_revision_history([])
312+ tree.branch.bzrdir.open_branch().generate_revision_history(
313+ bzrlib.revision.NULL_REVISION)
314 tree.set_parent_trees([])
315 tree.commit('revision 2', rev_id='2')
316 tree.branch.repository.copy_content_into(shared_repo)
317@@ -249,7 +251,8 @@
318 self.build_tree(['commit_tree/foo'])
319 tree.add('foo')
320 tree.commit('revision 1', rev_id='1')
321- tree.branch.bzrdir.open_branch().set_revision_history([])
322+ tree.branch.bzrdir.open_branch().generate_revision_history(
323+ bzrlib.revision.NULL_REVISION)
324 tree.set_parent_trees([])
325 tree.commit('revision 2', rev_id='2')
326 source = self.make_repository('source')
327@@ -447,7 +450,8 @@
328 self.build_tree(['commit_tree/foo'])
329 tree.add('foo')
330 tree.commit('revision 1', rev_id='1')
331- tree.bzrdir.open_branch().set_revision_history([])
332+ tree.bzrdir.open_branch().generate_revision_history(
333+ bzrlib.revision.NULL_REVISION)
334 tree.set_parent_trees([])
335 tree.commit('revision 2', rev_id='2')
336 source = self.make_repository('source')
337@@ -470,7 +474,8 @@
338 self.build_tree(['commit_tree/foo'])
339 tree.add('foo')
340 tree.commit('revision 1', rev_id='1')
341- tree.bzrdir.open_branch().set_revision_history([])
342+ tree.bzrdir.open_branch().generate_revision_history(
343+ bzrlib.revision.NULL_REVISION)
344 tree.set_parent_trees([])
345 tree.commit('revision 2', rev_id='2')
346 tree.branch.repository.copy_content_into(shared_repo)
347@@ -490,7 +495,8 @@
348 self.build_tree(['commit_tree/foo'])
349 tree.add('foo')
350 tree.commit('revision 1', rev_id='1')
351- tree.bzrdir.open_branch().set_revision_history([])
352+ tree.bzrdir.open_branch().generate_revision_history(
353+ bzrlib.revision.NULL_REVISION)
354 tree.set_parent_trees([])
355 tree.commit('revision 2', rev_id='2')
356 tree.branch.repository.copy_content_into(shared_repo)
357@@ -517,7 +523,8 @@
358 self.build_tree(['commit_tree/foo'])
359 tree.add('foo')
360 tree.commit('revision 1', rev_id='1')
361- tree.bzrdir.open_branch().set_revision_history([])
362+ tree.bzrdir.open_branch().generate_revision_history(
363+ bzrlib.revision.NULL_REVISION)
364 tree.set_parent_trees([])
365 tree.commit('revision 2', rev_id='2')
366 source = self.make_repository('source')
367@@ -540,7 +547,8 @@
368 self.build_tree(['commit_tree/foo'])
369 tree.add('foo')
370 tree.commit('revision 1', rev_id='1')
371- tree.bzrdir.open_branch().set_revision_history([])
372+ br = tree.bzrdir.open_branch()
373+ br.set_last_revision_info(0, bzrlib.revision.NULL_REVISION)
374 tree.set_parent_trees([])
375 tree.commit('revision 2', rev_id='2')
376 source = self.make_repository('source')
377
378=== modified file 'bzrlib/tests/per_workingtree/test_workingtree.py'
379--- bzrlib/tests/per_workingtree/test_workingtree.py 2011-04-15 07:01:22 +0000
380+++ bzrlib/tests/per_workingtree/test_workingtree.py 2011-04-20 19:44:37 +0000
381@@ -327,7 +327,7 @@
382 # because some formats mutate the branch to set it on the tree
383 # we need to alter the branch to let this pass.
384 try:
385- wt.branch.set_revision_history(['A', 'B'])
386+ wt.branch._set_revision_history(['A', 'B'])
387 except errors.NoSuchRevision, e:
388 self.assertEqual('B', e.revision)
389 raise TestSkipped("Branch format does not permit arbitrary"
390
391=== modified file 'bzrlib/tests/test_branch.py'
392--- bzrlib/tests/test_branch.py 2011-04-15 07:01:22 +0000
393+++ bzrlib/tests/test_branch.py 2011-04-20 19:44:37 +0000
394@@ -349,10 +349,13 @@
395 branch = builder.get_branch()
396 branch.lock_write()
397 self.addCleanup(branch.unlock)
398- branch.set_revision_history(['foo', 'bar'])
399- branch.set_revision_history(['foo'])
400+ self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
401+ branch.set_revision_history, ['foo', 'bar'])
402+ self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
403+ branch.set_revision_history, ['foo'])
404 self.assertRaises(errors.NotLefthandHistory,
405- branch.set_revision_history, ['bar'])
406+ self.applyDeprecated, symbol_versioning.deprecated_in((2, 4, 0)),
407+ branch.set_revision_history, ['bar'])
408
409 def do_checkout_test(self, lightweight=False):
410 tree = self.make_branch_and_tree('source',
411
412=== modified file 'bzrlib/tests/test_bundle.py'
413--- bzrlib/tests/test_bundle.py 2011-04-19 10:59:05 +0000
414+++ bzrlib/tests/test_bundle.py 2011-04-20 19:44:37 +0000
415@@ -28,6 +28,7 @@
416 merge,
417 osutils,
418 revision as _mod_revision,
419+ symbol_versioning,
420 tests,
421 treebuilder,
422 )
423@@ -506,7 +507,8 @@
424 old.unlock()
425 if not _mod_revision.is_null(rev_id):
426 rh = self.b1.revision_history()
427- tree.branch.set_revision_history(rh[:rh.index(rev_id)+1])
428+ self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
429+ tree.branch.set_revision_history, rh[:rh.index(rev_id)+1])
430 tree.update()
431 delta = tree.changes_from(self.b1.repository.revision_tree(rev_id))
432 self.assertFalse(delta.has_changed(),
433
434=== modified file 'bzrlib/tests/test_remote.py'
435--- bzrlib/tests/test_remote.py 2011-04-05 17:37:53 +0000
436+++ bzrlib/tests/test_remote.py 2011-04-20 19:44:37 +0000
437@@ -1377,7 +1377,7 @@
438 class TestBranchSetLastRevision(RemoteBranchTestCase):
439
440 def test_set_empty(self):
441- # set_revision_history([]) is translated to calling
442+ # _set_last_revision_info('null:') is translated to calling
443 # Branch.set_last_revision(path, '') on the wire.
444 transport = MemoryTransport()
445 transport.mkdir('branch')
446@@ -1405,13 +1405,13 @@
447 # unnecessarily invokes _ensure_real upon a call to lock_write.
448 branch._ensure_real = lambda: None
449 branch.lock_write()
450- result = branch.set_revision_history([])
451+ result = branch._set_last_revision(NULL_REVISION)
452 branch.unlock()
453 self.assertEqual(None, result)
454 self.assertFinished(client)
455
456 def test_set_nonempty(self):
457- # set_revision_history([rev-id1, ..., rev-idN]) is translated to calling
458+ # set_last_revision_info(N, rev-idN) is translated to calling
459 # Branch.set_last_revision(path, rev-idN) on the wire.
460 transport = MemoryTransport()
461 transport.mkdir('branch')
462@@ -1443,7 +1443,7 @@
463 branch._ensure_real = lambda: None
464 # Lock the branch, reset the record of remote calls.
465 branch.lock_write()
466- result = branch.set_revision_history(['rev-id1', 'rev-id2'])
467+ result = branch._set_last_revision('rev-id2')
468 branch.unlock()
469 self.assertEqual(None, result)
470 self.assertFinished(client)
471@@ -1479,7 +1479,7 @@
472 branch = self.make_remote_branch(transport, client)
473 branch.lock_write()
474 self.assertRaises(
475- errors.NoSuchRevision, branch.set_revision_history, ['rev-id'])
476+ errors.NoSuchRevision, branch._set_last_revision, 'rev-id')
477 branch.unlock()
478 self.assertFinished(client)
479
480@@ -1516,9 +1516,10 @@
481 branch._ensure_real = lambda: None
482 branch.lock_write()
483 # The 'TipChangeRejected' error response triggered by calling
484- # set_revision_history causes a TipChangeRejected exception.
485+ # set_last_revision_info causes a TipChangeRejected exception.
486 err = self.assertRaises(
487- errors.TipChangeRejected, branch.set_revision_history, ['rev-id'])
488+ errors.TipChangeRejected,
489+ branch._set_last_revision, 'rev-id')
490 # The UTF-8 message from the response has been decoded into a unicode
491 # object.
492 self.assertIsInstance(err.msg, unicode)
493
494=== modified file 'bzrlib/tests/test_smart.py'
495--- bzrlib/tests/test_smart.py 2011-02-07 02:39:15 +0000
496+++ bzrlib/tests/test_smart.py 2011-04-20 19:44:37 +0000
497@@ -932,7 +932,7 @@
498 # its repository.
499 self.make_tree_with_two_commits()
500 rev_id_utf8 = u'\xc8'.encode('utf-8')
501- self.tree.branch.set_revision_history([])
502+ self.tree.branch.set_last_revision_info(0, 'null:')
503 self.assertEqual(
504 (0, 'null:'), self.tree.branch.last_revision_info())
505 # We can update the branch to a revision that is present in the
506
507=== modified file 'bzrlib/tests/test_upgrade.py'
508--- bzrlib/tests/test_upgrade.py 2011-04-15 07:01:22 +0000
509+++ bzrlib/tests/test_upgrade.py 2011-04-20 19:44:37 +0000
510@@ -25,7 +25,6 @@
511 from bzrlib import (
512 branch,
513 bzrdir,
514- repository,
515 tests,
516 upgrade,
517 workingtree,
518@@ -42,7 +41,7 @@
519
520 def test_convert_branch5_branch6(self):
521 b = self.make_branch('branch', format='knit')
522- b.set_revision_history(['AB', 'CD'])
523+ b._set_revision_history(['CD'])
524 b.set_parent('file:///EF')
525 b.set_bound_location('file:///GH')
526 b.set_push_location('file:///IJ')
527
528=== modified file 'bzrlib/workingtree.py'
529--- bzrlib/workingtree.py 2011-04-17 18:24:56 +0000
530+++ bzrlib/workingtree.py 2011-04-20 19:44:37 +0000
531@@ -1264,13 +1264,13 @@
532 when their last revision is set.
533 """
534 if _mod_revision.is_null(new_revision):
535- self.branch.set_revision_history([])
536+ self.branch.set_last_revision_info(0, new_revision)
537 return False
538 try:
539 self.branch.generate_revision_history(new_revision)
540 except errors.NoSuchRevision:
541 # not present in the repo - dont try to set it deeper than the tip
542- self.branch.set_revision_history([new_revision])
543+ self.branch._set_revision_history([new_revision])
544 return True
545
546 @needs_tree_write_lock
547
548=== modified file 'doc/en/release-notes/bzr-2.4.txt'
549--- doc/en/release-notes/bzr-2.4.txt 2011-04-19 14:12:43 +0000
550+++ doc/en/release-notes/bzr-2.4.txt 2011-04-20 19:44:37 +0000
551@@ -352,6 +352,9 @@
552 (``bzrlib.branch.format_registry``) rather than using the class
553 methods on ``BranchFormat``. (Jelmer Vernooij, #714729)
554
555+* ``Branch.set_revision_history`` is now deprecated.
556+ (Jelmer Vernooij)
557+
558 * ``BranchFormat.supports_leaving_lock()`` and
559 ``RepositoryFormat.supports_leaving_lock`` flags have been added.
560 (Jelmer Vernooij)