Rev 94: Populate and use the _partial_revision_id_to_revno_cache. in http://bzr.arbash-meinel.com/plugins/history_db
John Arbash Meinel
john at arbash-meinel.com
Tue Apr 13 22:55:23 BST 2010
At http://bzr.arbash-meinel.com/plugins/history_db
------------------------------------------------------------
revno: 94
revision-id: john at arbash-meinel.com-20100413215509-obwehecjmdfwnywr
parent: john at arbash-meinel.com-20100413205719-p511jof7os221cqn
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: history_db
timestamp: Tue 2010-04-13 16:55:09 -0500
message:
Populate and use the _partial_revision_id_to_revno_cache.
This has effect for loggerhead, which seems to like to map back and forth at random.
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py 2010-04-13 17:27:26 +0000
+++ b/__init__.py 2010-04-13 21:55:09 +0000
@@ -432,7 +432,10 @@
def _history_db_revision_id_to_dotted_revno(self, revision_id):
"""See Branch._do_revision_id_to_dotted_revno"""
- # TODO: Fill it self._partial_revision_id_to_revno_cache and use it
+ revno = self._partial_revision_id_to_revno_cache.get(revision_id, None)
+ if revno is not None:
+ trace.note('history_db rev_id=>dotted cached')
+ return revno
t0 = time.clock()
query = _get_querier(self)
if query is None:
@@ -444,6 +447,7 @@
t2 = time.clock()
trace.note('history_db rev=>dotted took %.3fs, %.3fs to init,'
' %.3fs to query' % (t2-t0, t1-t0, t2-t1))
+ self._partial_revision_id_to_revno_cache.update(revision_id_map)
if revision_id not in revision_id_map:
trace.mutter('history_db failed to find a mapping for {%s},'
@@ -454,7 +458,6 @@
def _history_db_dotted_revno_to_revision_id(self, revno):
"""See Branch._do_dotted_revno_to_revision_id."""
- # TODO: Fill it self._partial_revision_id_to_revno_cache and use it
# revno should be a dotted revno, aka either 1-part or 3-part tuple
t0 = time.clock()
query = _get_querier(self)
@@ -467,6 +470,8 @@
t2 = time.clock()
trace.note('history_db dotted=>rev took %.3fs, %.3fs to init,'
' %.3fs to query' % (t2-t0, t1-t0, t2-t1))
+ self._partial_revision_id_to_revno_cache.update(
+ [(r_id, r_no) for r_no, r_id in revno_map.iteritems()])
if revno not in revno_map:
trace.mutter('history_db failed to find a mapping for %s,'
More information about the bazaar-commits
mailing list