Vlad Skvortsov
2008-01-25 01:46:07 UTC
Author: oleg
Date: 2007-11-24 09:03:55 -0800 (Sat, 24 Nov 2007)
New Revision: 2389
src/trunk/DITrack/DB/WC.py
implemented caching of firm issues
Modified: src/trunk/DITrack/DB/WC.py
===================================================================
--- src/trunk/DITrack/DB/WC.py 2007-11-24 08:49:28 UTC (rev 2388)
+++ src/trunk/DITrack/DB/WC.py 2007-11-24 17:03:55 UTC (rev 2389)
@@ -36,6 +36,7 @@
# DITrack modules
import DITrack.SVN
+import DITrack.DB.Cache
import DITrack.DB.Issue
# Comment file name regular expression.
@@ -142,6 +143,7 @@
self.next_num_path = os.path.join(path, "meta", "next-id")
self.svn = DITrack.SVN.Client(svn_path)
self.meta = DITrack.DB.Common.open_shelving(path, META_FILE)
+ self.cache = DITrack.DB.Cache.Cache(path)
"""
@@ -249,7 +251,8 @@
op.fill_txn(txn)
- # XXX: if failed to commit, revert local changes.
+ # XXX: if failed to commit, revert local changes and don't clean cache.
+ self.cache.clear()
Why do we need to clean the cache here? Since we've introducedDate: 2007-11-24 09:03:55 -0800 (Sat, 24 Nov 2007)
New Revision: 2389
src/trunk/DITrack/DB/WC.py
implemented caching of firm issues
Modified: src/trunk/DITrack/DB/WC.py
===================================================================
--- src/trunk/DITrack/DB/WC.py 2007-11-24 08:49:28 UTC (rev 2388)
+++ src/trunk/DITrack/DB/WC.py 2007-11-24 17:03:55 UTC (rev 2389)
@@ -36,6 +36,7 @@
# DITrack modules
import DITrack.SVN
+import DITrack.DB.Cache
import DITrack.DB.Issue
# Comment file name regular expression.
@@ -142,6 +143,7 @@
self.next_num_path = os.path.join(path, "meta", "next-id")
self.svn = DITrack.SVN.Client(svn_path)
self.meta = DITrack.DB.Common.open_shelving(path, META_FILE)
+ self.cache = DITrack.DB.Cache.Cache(path)
"""
@@ -249,7 +251,8 @@
op.fill_txn(txn)
- # XXX: if failed to commit, revert local changes.
+ # XXX: if failed to commit, revert local changes and don't clean cache.
+ self.cache.clear()
autodetection of updated issues, I don't think it's longer needed.
txn.commit(logmsg)
@@ -258,6 +261,9 @@
working copy.
"""
+ return self.cache.get()
+
issue_re = re.compile("^i(\\d+)$")
lst = []
@@ -274,6 +280,8 @@
issue = DITrack.DB.Issue.Issue.load(path)
res.append((id, issue))
+ self.cache.set(res)
+
return res
@@ -432,6 +440,8 @@
us = self.svn.update(self.path)
+ self.cache.clear()
Same here I guess. Seems like we can get rid of the clear() method@@ -258,6 +261,9 @@
working copy.
"""
+ return self.cache.get()
+
issue_re = re.compile("^i(\\d+)$")
lst = []
@@ -274,6 +280,8 @@
issue = DITrack.DB.Issue.Issue.load(path)
res.append((id, issue))
+ self.cache.set(res)
+
return res
@@ -432,6 +440,8 @@
us = self.svn.update(self.path)
+ self.cache.clear()
altogether?
--
Vlad Skvortsov, vss-***@public.gmane.org, http://vss.73rus.com
Vlad Skvortsov, vss-***@public.gmane.org, http://vss.73rus.com