Rev 83: For whatever reason branch.last_revision() may be a round-trip to the in http://bzr.arbash-meinel.com/plugins/history_db

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


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

------------------------------------------------------------
revno: 83
revision-id: john at arbash-meinel.com-20100412193909-gwt5vz2oznrutsvl
parent: john at arbash-meinel.com-20100412193557-pyrg3hst8cl5wz1k
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: history_db
timestamp: Mon 2010-04-12 14:39:09 -0500
message:
  For whatever reason branch.last_revision() may be a round-trip to the
  remote side. However, we don't need that for the post-tip-changed-hook because
  we already know the new last-revision. So pass it in, instead.
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2010-04-12 19:35:57 +0000
+++ b/__init__.py	2010-04-12 19:39:09 +0000
@@ -399,6 +399,7 @@
                      ' not configured')
         return
     importer = _mod_history_db.Importer(history_db_path, params.branch,
+                                        tip_revision=params.new_revid,
                                         incremental=True)
     t1 = time.clock()
     importer.do_import()

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



More information about the bazaar-commits mailing list