def do_check (self, issues):
     if not issues:
         return
     patches = []
     tests_results_dir = config.get (
         "server", "tests_results_install_dir")
     for issue_id in issues:
         info ("Trying issue %i" % issue_id)
         try:
             codereview_issue = self.get_codereview_issue_from_issue_tracker (issue_id)
             change_reference = codereview_issue.get_patch ()
         except Exception, e:
             warn ("something went wrong; omitting patch for issue %i" % issue_id)
             codereview_issue = None
         if codereview_issue:
             info ("Found patch: %s" % ",".join (str (x) for x in (
                         issue_id, change_reference, codereview_issue.title)))
             if (cache.has_section (str (issue_id))
                 and cache.has_option (
                     str (issue_id), codereview_issue.patch_id)
                 and (tests_results_dir
                      or cache.get (
                         str (issue_id),
                         codereview_issue.patch_id).lower () == "testing")):
                 info (("Last patch for issue %i already tested or under testing\n" +
                        "by another Patchy instance, skipping.") % issue_id)
                 continue
             if not cache.has_section (str (issue_id)):
                 cache.add_section (str (issue_id))
             cache.set (str (issue_id), codereview_issue.patch_id, "testing")
             cache.save ()
             patches.append (codereview_issue)
    def get_credentials (self):
        # TODO: can we use the coderview cookie for this?
        #filename = os.path.expanduser("~/.codereview_upload_cookies")
        filename = os.path.expanduser("~/.lilypond-project-hosting-login")
        try:
            login_data = open (filename).readlines ()
            self.username = login_data[0]
            self.password = login_data[1]
        except:
            import getpass
            warn ("""could not find stored credentials
  %(filename)s
Please enter loging details manually
""" % locals ())
            print "Username (google account name):"
            self.username = raw_input ().strip ()
            self.password = getpass.getpass ()