Anonymous avatar Anonymous committed e9b8e6c

Restrict output if not verbose.
Ignore detached patches.

Comments (0)

Files changed (1)

scripts/addpatchsets

 #!/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"
 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)
           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:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.