def get_pushlogs(self):
        """
        Returns pushlog json objects (python dicts) sorted by date.
        """
        # the first changeset is not taken into account in the result.
        # let's add it directly with this request
        chset_url = '%s/json-pushes?changeset=%s' % (self.get_repo_url(),
                                                     self.start_rev)
        response = retry_get(chset_url)
        response.raise_for_status()
        chsets = response.json()

        # now fetch all remaining changesets
        response = retry_get(self.pushlog_url())
        response.raise_for_status()
        chsets.update(response.json())
        # sort pushlogs by date
        return sorted(chsets.itervalues(), key=lambda push: push['date'])
Example #2
0
    def get_pushlogs(self):
        """
        Returns pushlog json objects (python dicts) sorted by date.
        """
        # the first changeset is not taken into account in the result.
        # let's add it directly with this request
        chset_url = '%s/json-pushes?changeset=%s' % (
            self.get_repo_url(),
            self.start_rev)
        response = retry_get(chset_url)
        response.raise_for_status()
        chsets = response.json()

        # now fetch all remaining changesets
        response = retry_get(self.pushlog_url())
        response.raise_for_status()
        chsets.update(response.json())
        # sort pushlogs by date
        return sorted(chsets.itervalues(),
                      key=lambda push: push['date'])
    def find_build_info_txt(self, url):
        """
        Retrieve information from a build information txt file.

        Returns a dict with keys repository and changeset if information
        is found.
        """
        data = {}
        response = retry_get(url)
        for line in response.text.splitlines():
            if '/rev/' in line:
                repository, changeset = line.split('/rev/')
                data['repository'] = repository
                data['changeset'] = changeset
                break
        if not data:
            # the txt file could be in an old format:
            # DATE CHANGESET
            # we can try to extract that to get the changeset at least.
            matched = re.match('^\d+ (\w+)$', response.text.strip())
            if matched:
                data['changeset'] = matched.group(1)
        return data
Example #4
0
    def find_build_info_txt(self, url):
        """
        Retrieve information from a build information txt file.

        Returns a dict with keys repository and changeset if information
        is found.
        """
        data = {}
        response = retry_get(url)
        for line in response.text.splitlines():
            if '/rev/' in line:
                repository, changeset = line.split('/rev/')
                data['repository'] = repository
                data['changeset'] = changeset
                break
        if not data:
            # the txt file could be in an old format:
            # DATE CHANGESET
            # we can try to extract that to get the changeset at least.
            matched = re.match('^\d+ (\w+)$', response.text.strip())
            if matched:
                data['changeset'] = matched.group(1)
        return data