[Python-checkins] r85230 - in tracker/instances/python-dev: detectors/rietveldreactor.py scripts/addpatchsets scripts/initrietveld

martin.v.loewis python-checkins at python.org
Tue Oct 5 15:32:06 CEST 2010


Author: martin.v.loewis
Date: Tue Oct 5 15:32:06 2010
New Revision: 85230
Log:
Create issue only when first patch is added.
Modified:
 tracker/instances/python-dev/detectors/rietveldreactor.py
 tracker/instances/python-dev/scripts/addpatchsets
 tracker/instances/python-dev/scripts/initrietveld
Modified: tracker/instances/python-dev/detectors/rietveldreactor.py
==============================================================================
--- tracker/instances/python-dev/detectors/rietveldreactor.py	(original)
+++ tracker/instances/python-dev/detectors/rietveldreactor.py	Tue Oct 5 15:32:06 2010
@@ -15,17 +15,7 @@
 "values(%s, %s, %s, '!', '', '', false, true, false, now(), now())",
 (nodeid, username, email))
 
-def create_rietveld_issue(db, cl, nodeid, oldvalues):
- subject = cl.get(nodeid, 'title')
- c = db.cursor
- # find owner id: same in django as in rietveld
- owner_id = cl.get(nodeid, 'creator')
- c.execute("insert into codereview_issue(id, subject, owner_id, reviewers, cc, created, modified, closed, private, n_comments) "
- "values(%s, %s, %s, %s, %s, now(), now(), false, false, 0)",
- (nodeid, subject, owner_id, empty_list, empty_list))
-
 def init(db):
 db.user.react('create', create_django_user)
 # XXX react to email changes, roles
- db.issue.react('create', create_rietveld_issue)
- # XXX reacto to subject, closed changes
+ # XXX react to subject, closed changes on issues
Modified: tracker/instances/python-dev/scripts/addpatchsets
==============================================================================
--- tracker/instances/python-dev/scripts/addpatchsets	(original)
+++ tracker/instances/python-dev/scripts/addpatchsets	Tue Oct 5 15:32:06 2010
@@ -63,7 +63,14 @@
 if roundup._status == closed:
 print "issue",nodeid,"is closed"
 continue
- issue = Issue.objects.get(id=nodeid)
+ issue = Issue.objects.filter(id=nodeid)
+ if not issue:
+ c.execute("select _title, _creator from _issue where id=%s", (nodeid,))
+ title, creator = c.fetchone()
+ issue = Issue(id=nodeid, subject=title, owner_id=creator)
+ issue.put()
+ else:
+ issue = issue[0]
 filename = os.path.join(basedir, "db", "files", "file",
 str(nodeid/1000), "file"+str(nodeid))
 if not os.path.exists(filename):
@@ -81,7 +88,6 @@
 issue.put()
 f._patchset = str(patchset.id)
 f.save()
- #import pdb;pdb.set_trace()
 patches = engine.ParsePatchSet(patchset)
 if patches:
 patches = fetch_patches(patches)
Modified: tracker/instances/python-dev/scripts/initrietveld
==============================================================================
--- tracker/instances/python-dev/scripts/initrietveld	(original)
+++ tracker/instances/python-dev/scripts/initrietveld	Tue Oct 5 15:32:06 2010
@@ -23,10 +23,3 @@
 continue
 rietveldreactor.create_django_user(db, db.user, userid, None)
 db.commit()
-
-for issue in db.issue.list():
- c.execute("select count(*) from codereview_issue where id=%s", (issue,))
- if c.fetchone()[0] == 1:
- continue
- rietveldreactor.create_rietveld_issue(db, db.issue, issue, None)
- db.commit()


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /