Rev 97: Fix a bug in dotted => revision_id. in http://bzr.arbash-meinel.com/plugins/history_db

John Arbash Meinel john at arbash-meinel.com
Wed Apr 14 19:39:31 BST 2010


At http://bzr.arbash-meinel.com/plugins/history_db

------------------------------------------------------------
revno: 97
revision-id: john at arbash-meinel.com-20100414183912-0izjujw5k9glmxri
parent: john at arbash-meinel.com-20100414183732-83yarj5nw51ciko2
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: history_db
timestamp: Wed 2010-04-14 13:39:12 -0500
message:
  Fix a bug in dotted => revision_id.
  
  We were failing to terminate the loop once all revno_strs had been found.
  So we always walked the full ancestry. Both because we were discarding
  the wrong object, and because we weren't checking that there were
  no more objects to search for.
  
  For emacs, this makes a lookup for the most recent rev take 1ms, instead of 500ms.
-------------- next part --------------
=== modified file 'history_db.py'
--- a/history_db.py	2010-04-14 17:47:31 +0000
+++ b/history_db.py	2010-04-14 18:39:12 +0000
@@ -1358,7 +1358,7 @@
         #       To indicate that the branch has not been imported yet
         revno_strs = set(['.'.join(map(str, revno)) for revno in revnos])
         revno_map = {}
-        while tip_db_id is not None:
+        while tip_db_id is not None and revno_strs:
             self._stats['num_steps'] += 1
             range_res = self._cursor.execute(
                 "SELECT pkey, tail"
@@ -1388,7 +1388,7 @@
             tip_db_id = next_db_id
             for revision_id, revno_str in revision_res:
                 dotted = tuple(map(int, revno_str.split('.')))
-                revno_strs.discard(dotted)
+                revno_strs.discard(revno_str)
                 revno_map[dotted] = revision_id
         self._stats['query_time'] += (time.time() - t)
         return revno_map
@@ -1623,7 +1623,7 @@
                     "  FROM dotted_revno, revision"
                     " WHERE tip_revision = ?"
                     "   AND db_id = merged_revision",
-                    [tip_db_id]).fetchall()
+                    (tip_db_id,)).fetchall()
                 next_db_id = self._get_lh_parent_db_id(tip_db_id)
             else:
                 pkey, next_db_id = range_res



More information about the bazaar-commits mailing list