Esempio n. 1
0
    def update(self, oauth_token):
        logging.debug("Updating issue %i" % self.number)
        # Record basic information about this pull request
        issue_response = raw_github_request(PULLS_BASE + '/%i' % self.number,
                                            oauth_token=oauth_token, etag=self.etag)
        if issue_response is None:
            logging.debug("Issue %i hasn't changed since last visit; skipping" % self.number)
            return
        self.pr_json = json.loads(issue_response.content)
        self.etag = issue_response.headers["ETag"]
        updated_at = \
            parse_datetime(self.pr_json['updated_at']).astimezone(tz.tzutc()).replace(tzinfo=None)
        self.user = self.pr_json['user']['login']
        self.updated_at = updated_at
        self.state = self.pr_json['state']

        # TODO: will miss comments if we exceed the pagination limit:
        comments_response = raw_github_request(ISSUES_BASE + '/%i/comments' % self.number,
                                               oauth_token=oauth_token, etag=self.comments_etag)
        if comments_response is not None:
            self.comments_json = json.loads(comments_response.content)
            self.comments_etag = comments_response.headers["ETag"]

        files_response = raw_github_request(PULLS_BASE + "/%i/files" % self.number,
                                            oauth_token=oauth_token, etag=self.files_etag)
        if files_response is not None:
            self.files_json = json.loads(files_response.content)
            self.files_etag = files_response.headers["ETag"]

        self.cached_last_jenkins_outcome = None
        self.last_jenkins_outcome  # force recomputation of Jenkins outcome
        self.cached_commenters = self._compute_commenters()

        # Write our modifications back to the database
        self.put()
Esempio n. 2
0
    def update(self, oauth_token):
        logging.debug("Updating issue %i" % self.number)
        # Record basic information about this pull request
        issue_response = raw_github_request(PULLS_BASE + '/%i' % self.number,
                                            oauth_token=oauth_token,
                                            etag=self.etag)
        if issue_response is None:
            logging.debug(
                "Issue %i hasn't changed since last visit; skipping" %
                self.number)
            return
        self.pr_json = json.loads(issue_response.content)
        self.etag = issue_response.headers["ETag"]
        updated_at = \
            parse_datetime(self.pr_json['updated_at']).astimezone(tz.tzutc()).replace(tzinfo=None)
        self.user = self.pr_json['user']['login']
        self.updated_at = updated_at
        self.state = self.pr_json['state']

        # TODO: will miss comments if we exceed the pagination limit:
        comments_response = raw_github_request(ISSUES_BASE +
                                               '/%i/comments' % self.number,
                                               oauth_token=oauth_token,
                                               etag=self.comments_etag)
        if comments_response is not None:
            self.comments_json = json.loads(comments_response.content)
            self.comments_etag = comments_response.headers["ETag"]

        files_response = raw_github_request(PULLS_BASE +
                                            "/%i/files" % self.number,
                                            oauth_token=oauth_token,
                                            etag=self.files_etag)
        if files_response is not None:
            self.files_json = json.loads(files_response.content)
            self.files_etag = files_response.headers["ETag"]

        self.cached_last_jenkins_outcome = self._compute_last_jenkins_outcome()
        self.cached_commenters = self._compute_commenters()

        # Write our modifications back to the database
        self.put()
Esempio n. 3
0
    def update(self, oauth_token):
        logging.debug("Updating pull request %i" % self.number)
        # Record basic information about this pull request
        issue_response = raw_github_request(PULLS_BASE + '/%i' % self.number,
                                            oauth_token=oauth_token,
                                            etag=self.etag)
        if issue_response is None:
            logging.debug("PR %i hasn't changed since last visit; skipping" %
                          self.number)
            return
        self.pr_json = json.loads(issue_response.content)
        self.etag = issue_response.headers["ETag"]
        updated_at = \
            parse_datetime(self.pr_json['updated_at']).astimezone(tz.tzutc()).replace(tzinfo=None)
        self.user = self.pr_json['user']['login']
        self.updated_at = updated_at
        self.state = self.pr_json['state']

        comments_response = paginated_github_request(
            ISSUES_BASE + '/%i/comments' % self.number,
            oauth_token=oauth_token,
            etag=self.comments_etag)
        if comments_response is not None:
            self.comments_json, self.comments_etag = comments_response

        pr_comments_response = paginated_github_request(
            PULLS_BASE + '/%i/comments' % self.number,
            oauth_token=oauth_token,
            etag=self.pr_comments_etag)
        if pr_comments_response is not None:
            self.pr_comments_json, self.pr_comments_etag = pr_comments_response

        files_response = paginated_github_request(PULLS_BASE +
                                                  "/%i/files" % self.number,
                                                  oauth_token=oauth_token,
                                                  etag=self.files_etag)
        if files_response is not None:
            self.files_json, self.files_etag = files_response

        self.cached_last_jenkins_outcome = None
        self.last_jenkins_outcome  # force recomputation of Jenkins outcome
        self.cached_commenters = self._compute_commenters()

        for issue_number in self.parsed_title['jiras']:
            try:
                link_issue_to_pr("SPARK-%s" % issue_number, self)
            except:
                logging.exception(
                    "Exception when linking to JIRA issue SPARK-%s" %
                    issue_number)

        self.put()  # Write our modifications back to the database
Esempio n. 4
0
    def update(self, oauth_token):
        logging.debug("Updating pull request %i" % self.number)
        # Record basic information about this pull request
        issue_response = raw_github_request(PULLS_BASE + '/%i' % self.number,
                                            oauth_token=oauth_token, etag=self.etag)
        if issue_response is None:
            logging.debug("PR %i hasn't changed since last visit; skipping" % self.number)
            return
        self.pr_json = json.loads(issue_response.content)
        self.etag = issue_response.headers["ETag"]
        updated_at = \
            parse_datetime(self.pr_json['updated_at']).astimezone(tz.tzutc()).replace(tzinfo=None)
        self.user = self.pr_json['user']['login']
        self.updated_at = updated_at
        self.state = self.pr_json['state']

        comments_response = paginated_github_request(ISSUES_BASE + '/%i/comments' % self.number,
                                                     oauth_token=oauth_token,
                                                     etag=self.comments_etag)
        if comments_response is not None:
            self.comments_json, self.comments_etag = comments_response

        pr_comments_response = paginated_github_request(PULLS_BASE + '/%i/comments' % self.number,
                                                        oauth_token=oauth_token,
                                                        etag=self.pr_comments_etag)
        if pr_comments_response is not None:
            self.pr_comments_json, self.pr_comments_etag = pr_comments_response

        files_response = paginated_github_request(PULLS_BASE + "/%i/files" % self.number,
                                                  oauth_token=oauth_token, etag=self.files_etag)
        if files_response is not None:
            self.files_json, self.files_etag = files_response

        self.cached_last_jenkins_outcome = None
        self.last_jenkins_outcome  # force recomputation of Jenkins outcome
        self.cached_commenters = self._compute_commenters()

        for issue_number in self.parsed_title['jiras']:
            try:
                link_issue_to_pr("SPARK-%s" % issue_number, self)
            except:
                logging.exception("Exception when linking to JIRA issue SPARK-%s" % issue_number)
            try:
                start_issue_progress("SPARK-%s" % issue_number)
            except:
                logging.exception(
                    "Exception when starting progress on JIRA issue SPARK-%s" % issue_number)

        self.put()  # Write our modifications back to the database