Vlad Skvortsov
2008-02-14 19:12:45 UTC
Author: oleg
Date: 2007-12-07 11:49:11 -0800 (Fri, 07 Dec 2007)
New Revision: 2407
src/trunk/DITrack/DB/Issue.py
src/trunk/DITrack/DB/WC.py
added checking of new comment or issue
Modified: src/trunk/DITrack/DB/Issue.py
===================================================================
--- src/trunk/DITrack/DB/Issue.py 2007-12-06 18:26:14 UTC (rev 2406)
+++ src/trunk/DITrack/DB/Issue.py 2007-12-07 19:49:11 UTC (rev 2407)
@@ -397,7 +397,16 @@
return map(lambda k: "%s: %s%s" % (k, self.info[k],
terminator), keys)
Comments?Date: 2007-12-07 11:49:11 -0800 (Fri, 07 Dec 2007)
New Revision: 2407
src/trunk/DITrack/DB/Issue.py
src/trunk/DITrack/DB/WC.py
added checking of new comment or issue
Modified: src/trunk/DITrack/DB/Issue.py
===================================================================
--- src/trunk/DITrack/DB/Issue.py 2007-12-06 18:26:14 UTC (rev 2406)
+++ src/trunk/DITrack/DB/Issue.py 2007-12-07 19:49:11 UTC (rev 2407)
@@ -397,7 +397,16 @@
return map(lambda k: "%s: %s%s" % (k, self.info[k],
terminator), keys)
I would suggest renaming this function into is_last_firm_comment() which
would accept a firm comment number and tell if that's the latest one.
+ n = int(self.firm_names[len(self.firm_names)-1])
...[-1]?+ fname = os.path.join(path, "comment%d" % (n + 1))
+
+ return True
Why not os.path.exists()? If we are checking if the name is really a+
+ return True
file, it makes sense to throw an exception if the entry exists but is
not in fact a file.
+
+ return False
+
"""
Load an issue from path PATH (should point to a directory).
Modified: src/trunk/DITrack/DB/WC.py
===================================================================
--- src/trunk/DITrack/DB/WC.py 2007-12-06 18:26:14 UTC (rev 2406)
+++ src/trunk/DITrack/DB/WC.py 2007-12-07 19:49:11 UTC (rev 2407)
@@ -261,25 +261,42 @@
working copy.
"""
Looking at the following block of code makes me thinking: should we+ return False
+
"""
Load an issue from path PATH (should point to a directory).
Modified: src/trunk/DITrack/DB/WC.py
===================================================================
--- src/trunk/DITrack/DB/WC.py 2007-12-06 18:26:14 UTC (rev 2406)
+++ src/trunk/DITrack/DB/WC.py 2007-12-07 19:49:11 UTC (rev 2407)
@@ -261,25 +261,42 @@
working copy.
"""
place all caching logic under Issue.load()? With the current approach we
have to be very careful to keep the cache coherent (e.g. whenever the
issue is loaded, we have to update the cache).
...or, maybe add a method to the WC class, say, load_issue() that would
transparently incorporate caching, and implement issues() in terms of that?
These are just thoughts, I'm not really positive we need them at this
point (may be an 'XXX' in the code just to remember?). What do you think?
+ res = []
- return self.cache.get()
- issue_re = re.compile("^i(\\d+)$")
+ issues = self.cache.get()
Cache.__len__() does len(self.get()) and here we make another redundant- return self.cache.get()
- issue_re = re.compile("^i(\\d+)$")
+ issues = self.cache.get()
call to get(). Why not just do get() and see if anything is returned?
+ path = os.path.join(self.data_path, "i%s" % id)
+ issue = DITrack.DB.Issue.Issue.load(path)
+ res.append((id, issue))
- lst = []
- m = issue_re.match(fn)
- lst.append(int(m.group(1)))
+ id += 1
+ path = os.path.join(self.data_path, "i%s" % id)
+ issue = DITrack.DB.Issue.Issue.load(path)
+ res.append((id, issue))
+ break
- lst.sort()
- res = []
- path = os.path.join(self.data_path, "i%s" % id)
- issue = DITrack.DB.Issue.Issue.load(path)
- res.append((id, issue))
+ issue_re = re.compile("^i(\\d+)$")
+ lst = []
+ m = issue_re.match(fn)
+ lst.append(int(m.group(1)))
+
+ lst.sort()
+
+ path = os.path.join(self.data_path, "i%s" % id)
+ issue = DITrack.DB.Issue.Issue.load(path)
+ res.append((id, issue))
+
self.cache.set(res)
return res
_______________________________________________
Commit mailing list
http://lists.ditrack.org/mailman/listinfo/commit
+ issue = DITrack.DB.Issue.Issue.load(path)
+ res.append((id, issue))
- lst = []
- m = issue_re.match(fn)
- lst.append(int(m.group(1)))
+ id += 1
+ path = os.path.join(self.data_path, "i%s" % id)
+ issue = DITrack.DB.Issue.Issue.load(path)
+ res.append((id, issue))
+ break
- lst.sort()
- res = []
- path = os.path.join(self.data_path, "i%s" % id)
- issue = DITrack.DB.Issue.Issue.load(path)
- res.append((id, issue))
+ issue_re = re.compile("^i(\\d+)$")
+ lst = []
+ m = issue_re.match(fn)
+ lst.append(int(m.group(1)))
+
+ lst.sort()
+
+ path = os.path.join(self.data_path, "i%s" % id)
+ issue = DITrack.DB.Issue.Issue.load(path)
+ res.append((id, issue))
+
self.cache.set(res)
return res
_______________________________________________
Commit mailing list
http://lists.ditrack.org/mailman/listinfo/commit
--
Vlad Skvortsov, vss-***@public.gmane.org, http://vss.73rus.com
Vlad Skvortsov, vss-***@public.gmane.org, http://vss.73rus.com