Rev 10: add command for just updating the cache. in file:///data/jelmer/bzr-global-log/trunk/
Jelmer Vernooij
jelmer at samba.org
Tue Nov 20 18:22:46 GMT 2007
At file:///data/jelmer/bzr-global-log/trunk/
------------------------------------------------------------
revno: 10
revision-id:jelmer at samba.org-20071120180607-842ytilr7u2dnq61
parent: jelmer at samba.org-20071120175826-hyfpisxns5w595kh
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2007-11-20 19:06:07 +0100
message:
add command for just updating the cache.
modified:
__init__.py __init__.py-20071029004222-avdgq0mc7n1q6q8f-1
cache.py db.py-20071105012118-v51dlgcjf12dagnc-1
=== modified file '__init__.py'
--- a/__init__.py 2007-11-20 17:58:26 +0000
+++ b/__init__.py 2007-11-20 18:06:07 +0000
@@ -139,6 +139,36 @@
lf.log_revision(rev)
+class cmd_global_update_cache(Command):
+ """Update the cache used for the global-* commands."""
+
+ takes_args = ["location*"]
+
+ def run(self, location_list):
+ from bzrlib.plugins.global_log.cache import RevisionCachingRepository
+ if location_list is None:
+ location_list = ["."]
+
+ repository = RevisionCachingRepository(get_cache_db_path())
+
+ revids, repos = gather_revids(location_list)
+
+ for repo in repos:
+ repository.add_repository(repo)
+
+ revs = set()
+ pb = ui.ui_factory.nested_progress_bar()
+ repository.lock_read()
+ try:
+ count = 0
+ for rev in repository.get_revisions(revids):
+ pb.update("fetching revision info", count, len(revids))
+ count += 1
+ finally:
+ pb.finished()
+ repository.unlock()
+
+
register_command(cmd_global_log)
register_command(cmd_global_stats)
-
+register_command(cmd_global_update_cache)
=== modified file 'cache.py'
--- a/cache.py 2007-11-05 04:24:58 +0000
+++ b/cache.py 2007-11-20 18:06:07 +0000
@@ -83,7 +83,7 @@
for name, value in rev.properties.items():
self.db.execute("INSERT INTO revision_property (revid, name, value) VALUES (?, ?, ?)", (rev.revision_id, name, value))
for p in rev.parent_ids:
- self.db.execute("INSERT INTO revision_parent (child_revid, parent_revid) VALUES (?, ?)", (rev.revision_id, p))
+ self.db.execute("REPLACE INTO revision_parent (child_revid, parent_revid) VALUES (?, ?)", (rev.revision_id, p))
self.db.commit()
def get_revision(self, revid):
More information about the bazaar-commits
mailing list