Rev 84: I think the time wasted is based on the get_config() call, lets check. in http://bzr.arbash-meinel.com/plugins/history_db

John Arbash Meinel john at arbash-meinel.com
Mon Apr 12 20:41:26 BST 2010


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

------------------------------------------------------------
revno: 84
revision-id: john at arbash-meinel.com-20100412194119-zs7mdpx7dvsax3ou
parent: john at arbash-meinel.com-20100412193909-gwt5vz2oznrutsvl
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: history_db
timestamp: Mon 2010-04-12 14:41:19 -0500
message:
  I think the time wasted is based on the get_config() call, lets check.
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2010-04-12 19:39:09 +0000
+++ b/__init__.py	2010-04-12 19:41:19 +0000
@@ -393,17 +393,20 @@
     """Run when the tip of a branch changes revision_id."""
     t0 = time.clock()
     import pprint
+    # TODO: This requires a round-trip to the remote server to find out whether
+    #       or not something is configured (even if we have it set it
+    #       locations.conf), we should be able to do better...
     history_db_path = _get_history_db_path(params.branch)
+    t1 = time.clock()
     if history_db_path is None:
         trace.mutter('Note updating history-db, "history_db_path"'
                      ' not configured')
         return
     importer = _mod_history_db.Importer(history_db_path, params.branch,
-                                        tip_revision=params.new_revid,
+                                        tip_revision_id=params.new_revid,
                                         incremental=True)
-    t1 = time.clock()
+    t2 = time.clock()
     importer.do_import()
-    t2 = time.clock()
     importer.build_mainline_cache()
     t3 = time.clock()
     trace.note('history_db post-change-hook took %.3fs'

=== modified file 'history_db.py'
--- a/history_db.py	2010-04-12 19:39:09 +0000
+++ b/history_db.py	2010-04-12 19:41:19 +0000
@@ -81,7 +81,7 @@
 class Importer(object):
     """Import data from bzr into the history_db."""
 
-    def __init__(self, db_path, a_branch, tip_revision=None,
+    def __init__(self, db_path, a_branch, tip_revision_id=None,
                  incremental=False, validate=False):
         db_conn = dbapi2.connect(db_path)
         self._incremental = incremental
@@ -90,10 +90,10 @@
         self._ensure_schema()
         self._cursor = self._db_conn.cursor()
         self._branch = a_branch
-        if tip_revision is None:
+        if tip_revision_id is None:
             self._branch_tip_rev_id = a_branch.last_revision()
         else:
-            self._branch_tip_rev_id = tip_revision
+            self._branch_tip_rev_id = tip_revision_id
         self._branch_tip_key = (self._branch_tip_rev_id,)
         self._graph = None
         if not self._incremental:



More information about the bazaar-commits mailing list