[Python-checkins] r85284 - tracker/instances/python-dev/scripts/addpatchsets

martin.v.loewis python-checkins at python.org
Wed Oct 6 13:39:44 CEST 2010


Author: martin.v.loewis
Date: Wed Oct  6 13:39:44 2010
New Revision: 85284

Log:
Restrict output if not verbose.
Ignore detached patches.


Modified:
   tracker/instances/python-dev/scripts/addpatchsets

Modified: tracker/instances/python-dev/scripts/addpatchsets
==============================================================================
--- tracker/instances/python-dev/scripts/addpatchsets	(original)
+++ tracker/instances/python-dev/scripts/addpatchsets	Wed Oct  6 13:39:44 2010
@@ -1,5 +1,5 @@
 #!/usr/bin/python
-import sys, os, urllib2
+import sys, os, urllib2, logging
 basedir = os.path.dirname(os.path.dirname(__file__))
 sys.path.append(basedir+"/rietveld")
 os.environ["DJANGO_SETTINGS_MODULE"]="settings"
@@ -9,6 +9,8 @@
 verbose = False
 if len(sys.argv)==2 and sys.argv[1]=='-v':
     verbose=True
+else:
+    logging.disable(logging.ERROR)
 
 from codereview.models import (Repository, Branch, Patch, 
                                PatchSet, Issue, Content)
@@ -93,9 +95,16 @@
           order_by('id')):
     c.execute("select nodeid from issue_files where linkid=%s", (f.id,))
     nodeid = c.fetchone()[0]
+    nodeid = c.fetchone()
+    if not nodeid:
+        if verbose:
+            print "File",nodeid,"is detached"
+        continue
+    nodeid = nodeid[0]
     roundup = RoundupIssue.objects.get(id=nodeid)
     if roundup._status == closed:
-        print "issue",nodeid,"is closed"
+        if verbose:
+            print "issue",nodeid,"is closed"
         continue
     issue = Issue.objects.filter(id=nodeid)
     if not issue:


More information about the Python-checkins mailing list