Rev 5979: (jelmer) Deprecate Repository.iter_reverse_revision_history(). (Jelmer in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Jun 16 17:39:43 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5979 [merge]
revision-id: pqm at pqm.ubuntu.com-20110616173940-cwkewi54lnqest66
parent: pqm at pqm.ubuntu.com-20110616141511-np6z47o7473dgjsp
parent: jelmer at samba.org-20110616160633-o7gytmtrm37jr89p
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2011-06-16 17:39:40 +0000
message:
(jelmer) Deprecate Repository.iter_reverse_revision_history(). (Jelmer
Vernooij)
modified:
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/reconcile.py reweave_inventory.py-20051108164726-1e5e0934febac06e
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/per_repository/test_iter_reverse_revision_history.py test_iter_reverse_re-20070217015036-spu7j5ggch7pbpyd-1
bzrlib/tests/test_foreign.py test_foreign.py-20081125004048-ywb901edgp9lluxo-1
bzrlib/uncommit.py uncommit.py-20050626215513-5ec509fa425b305c
doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py 2011-05-19 14:45:40 +0000
+++ b/bzrlib/log.py 2011-06-16 12:50:32 +0000
@@ -678,16 +678,19 @@
"""
br_revno, br_rev_id = branch.last_revision_info()
repo = branch.repository
+ graph = repo.get_graph()
if start_rev_id is None and end_rev_id is None:
cur_revno = br_revno
- for revision_id in repo.iter_reverse_revision_history(br_rev_id):
+ for revision_id in graph.iter_lefthand_ancestry(br_rev_id,
+ (_mod_revision.NULL_REVISION,)):
yield revision_id, str(cur_revno), 0
cur_revno -= 1
else:
if end_rev_id is None:
end_rev_id = br_rev_id
found_start = start_rev_id is None
- for revision_id in repo.iter_reverse_revision_history(end_rev_id):
+ for revision_id in graph.iter_lefthand_ancestry(end_rev_id,
+ (_mod_revision.NULL_REVISION,)):
revno_str = _compute_revno_str(branch, revision_id)
if not found_start and revision_id == start_rev_id:
if not exclude_common_ancestry:
@@ -1086,8 +1089,9 @@
cur_revno = branch_revno
rev_nos = {}
mainline_revs = []
- for revision_id in branch.repository.iter_reverse_revision_history(
- branch_last_revision):
+ graph = branch.repository.get_graph()
+ for revision_id in graph.iter_lefthand_ancestry(
+ branch_last_revision, (_mod_revision.NULL_REVISION,)):
if cur_revno < start_revno:
# We have gone far enough, but we always add 1 more revision
rev_nos[revision_id] = cur_revno
@@ -1945,8 +1949,9 @@
old_revisions = set()
new_history = []
new_revisions = set()
- new_iter = repository.iter_reverse_revision_history(new_revision_id)
- old_iter = repository.iter_reverse_revision_history(old_revision_id)
+ graph = repository.get_graph()
+ new_iter = graph.iter_lefthand_ancestry(new_revision_id)
+ old_iter = graph.iter_lefthand_ancestry(old_revision_id)
stop_revision = None
do_old = True
do_new = True
=== modified file 'bzrlib/reconcile.py'
--- a/bzrlib/reconcile.py 2011-05-18 16:42:48 +0000
+++ b/bzrlib/reconcile.py 2011-06-16 16:06:33 +0000
@@ -29,6 +29,7 @@
from bzrlib import (
cleanup,
errors,
+ revision as _mod_revision,
ui,
)
from bzrlib.trace import mutter
@@ -144,12 +145,12 @@
self._reconcile_revision_history()
def _reconcile_revision_history(self):
- repo = self.branch.repository
last_revno, last_revision_id = self.branch.last_revision_info()
real_history = []
+ graph = self.branch.repository.get_graph()
try:
- for revid in repo.iter_reverse_revision_history(
- last_revision_id):
+ for revid in graph.iter_lefthand_ancestry(
+ last_revision_id, (_mod_revision.NULL_REVISION,)):
real_history.append(revid)
except errors.RevisionNotPresent:
pass # Hit a ghost left hand parent
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2011-06-14 10:07:16 +0000
+++ b/bzrlib/remote.py 2011-06-16 17:39:40 +0000
@@ -1974,6 +1974,7 @@
def supports_rich_root(self):
return self._format.rich_root_data
+ @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4, 0)))
def iter_reverse_revision_history(self, revision_id):
self._ensure_real()
return self._real_repository.iter_reverse_revision_history(revision_id)
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2011-05-18 10:24:05 +0000
+++ b/bzrlib/repository.py 2011-06-16 12:50:32 +0000
@@ -1002,6 +1002,7 @@
raise AssertionError('_iter_for_revno returned too much history')
return (True, partial_history[-1])
+ @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4, 0)))
def iter_reverse_revision_history(self, revision_id):
"""Iterate backwards through revision ids in the lefthand history
@@ -1833,9 +1834,11 @@
it is encountered, history extension will stop.
"""
start_revision = partial_history_cache[-1]
- iterator = repo.iter_reverse_revision_history(start_revision)
+ graph = repo.get_graph()
+ iterator = graph.iter_lefthand_ancestry(start_revision,
+ (_mod_revision.NULL_REVISION,))
try:
- #skip the last revision in the list
+ # skip the last revision in the list
iterator.next()
while True:
if (stop_index is not None and
=== modified file 'bzrlib/tests/per_repository/test_iter_reverse_revision_history.py'
--- a/bzrlib/tests/per_repository/test_iter_reverse_revision_history.py 2011-04-09 21:00:33 +0000
+++ b/bzrlib/tests/per_repository/test_iter_reverse_revision_history.py 2011-06-16 12:50:32 +0000
@@ -20,6 +20,7 @@
errors,
tests,
)
+from bzrlib.symbol_versioning import deprecated_in
from bzrlib.tests.per_repository import TestCaseWithRepository
@@ -91,7 +92,8 @@
repo = tree.branch.repository
repo.lock_read()
self.addCleanup(repo.unlock)
- rev_history = repo.iter_reverse_revision_history('rev4')
+ rev_history = self.applyDeprecated(deprecated_in((2, 4, 0)),
+ repo.iter_reverse_revision_history, 'rev4')
self.assertEqual('rev4', rev_history.next())
self.assertEqual('rev3', rev_history.next())
self.assertEqual('rev2', rev_history.next())
@@ -102,7 +104,8 @@
"""Assert the return values of iter_reverse_revision_history."""
repo.lock_read()
try:
- actual = list(repo.iter_reverse_revision_history(revision_id))
+ actual = list(self.applyDeprecated(deprecated_in((2, 4, 0)),
+ repo.iter_reverse_revision_history, revision_id))
finally:
repo.unlock()
self.assertEqual(expected, actual)
@@ -155,7 +158,8 @@
tree.commit('2', rev_id='rev2')
finally:
tree.unlock()
- iter = tree.branch.repository.iter_reverse_revision_history('rev2')
+ iter = self.applyDeprecated(deprecated_in((2, 4, 0)),
+ tree.branch.repository.iter_reverse_revision_history, 'rev2')
tree.branch.repository.lock_read()
try:
self.assertEquals('rev2', iter.next())
=== modified file 'bzrlib/tests/test_foreign.py'
--- a/bzrlib/tests/test_foreign.py 2011-05-17 10:29:43 +0000
+++ b/bzrlib/tests/test_foreign.py 2011-06-16 12:50:32 +0000
@@ -163,12 +163,13 @@
result.old_revno, result.old_revid = self.target.last_revision_info()
self.source.lock_read()
try:
+ graph = self.source.repository.get_graph()
# This just handles simple cases, but that's good enough for tests
my_history = self.target.revision_history()
if stop_revision is None:
stop_revision = self.source.last_revision()
- their_history = list(
- self.source.repository.iter_reverse_revision_history(stop_revision))
+ their_history = list(graph.iter_lefthand_ancestry(stop_revision,
+ (revision.NULL_REVISION,)))
their_history.reverse()
if their_history[:min(len(my_history), len(their_history))] != my_history:
raise errors.DivergedBranches(self.target, self.source)
@@ -181,7 +182,7 @@
return (tree.get_file(file_id), None)
tree.get_file_with_stat = get_file_with_stat
new_revid = self.target.mapping.revision_id_foreign_to_bzr(
- (str(rev.timestamp), str(rev.timezone),
+ (str(rev.timestamp), str(rev.timezone),
str(self.target.revno())))
parent_revno, parent_revid= self.target.last_revision_info()
if parent_revid == revision.NULL_REVISION:
=== modified file 'bzrlib/uncommit.py'
--- a/bzrlib/uncommit.py 2010-04-30 11:03:59 +0000
+++ b/bzrlib/uncommit.py 2011-06-16 12:50:32 +0000
@@ -66,12 +66,10 @@
revno = old_revno
new_revno = revno - 1
- revid_iterator = branch.repository.iter_reverse_revision_history(
- old_tip)
cur_revno = old_revno
new_revision_id = old_tip
graph = branch.repository.get_graph()
- for rev_id in revid_iterator:
+ for rev_id in graph.iter_lefthand_ancestry(old_tip):
if cur_revno == new_revno:
new_revision_id = rev_id
break
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt 2011-06-16 11:45:29 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2011-06-16 17:39:40 +0000
@@ -127,6 +127,10 @@
* Remove `file_status` function.
(Martin Pool)
+* ``Repository.iter_reverse_revision_history`` is now deprecated.
+ Use ``Graph.iter_lefthand_ancestry`` instead.
+ (Jelmer Vernooij, #739481)
+
Internals
*********
More information about the bazaar-commits
mailing list