当前位置: 首页>>代码示例>>Python>>正文


Python Commit.parent方法代码示例

本文整理汇总了Python中reviewboard.scmtools.core.Commit.parent方法的典型用法代码示例。如果您正苦于以下问题:Python Commit.parent方法的具体用法?Python Commit.parent怎么用?Python Commit.parent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在reviewboard.scmtools.core.Commit的用法示例。


在下文中一共展示了Commit.parent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_commits

# 需要导入模块: from reviewboard.scmtools.core import Commit [as 别名]
# 或者: from reviewboard.scmtools.core.Commit import parent [as 别名]
    def get_commits(self, repository, branch=None, start=None):
        url = self._build_repository_api_url(repository,
                                             'changesets/?limit=20')

        start = start or branch

        if start:
            url += '&start=%s' % start

        results = []

        # The API returns them in order from oldest to newest.
        for changeset in reversed(self._api_get(url)['changesets']):
            commit = Commit(
                author_name=changeset['author'],
                id=changeset['raw_node'],
                date=self._parse_timestamp(changeset['utctimestamp']),
                message=changeset['message'],
                base_commit_id=changeset['raw_node'])

            if changeset['parents']:
                commit.parent = changeset['parents'][0]

            results.append(commit)

        return results
开发者ID:Hackthings,项目名称:reviewboard,代码行数:28,代码来源:bitbucket.py

示例2: get_commits

# 需要导入模块: from reviewboard.scmtools.core import Commit [as 别名]
# 或者: from reviewboard.scmtools.core.Commit import parent [as 别名]
    def get_commits(self, repository, start=None):
        results = []

        resource = "commits"
        url = self._build_api_url(self._get_repo_api_url(repository), resource)

        if start:
            url += "&sha=%s" % start

        try:
            rsp = self._api_get(url)
        except Exception as e:
            logging.warning("Failed to fetch commits from %s: %s", url, e)
            return results

        for item in rsp:
            commit = Commit(
                item["commit"]["author"]["name"],
                item["sha"],
                item["commit"]["committer"]["date"],
                item["commit"]["message"],
            )
            if item["parents"]:
                commit.parent = item["parents"][0]["sha"]

            results.append(commit)

        return results
开发者ID:prodigeni,项目名称:reviewboard,代码行数:30,代码来源:github.py

示例3: get_commits

# 需要导入模块: from reviewboard.scmtools.core import Commit [as 别名]
# 或者: from reviewboard.scmtools.core.Commit import parent [as 别名]
    def get_commits(self, repository, start=None):
        results = []

        resource = 'commits'
        url = self._build_api_url(self._get_repo_api_url(repository), resource)

        if start:
            url += '&sha=%s' % start

        try:
            rsp = self._api_get(url)
        except Exception as e:
            logging.warning('Failed to fetch commits from %s: %s',
                            url, e)
            return results

        for item in rsp:
            commit = Commit(
                item['commit']['author']['name'],
                item['sha'],
                item['commit']['committer']['date'],
                item['commit']['message'])
            if item['parents']:
                commit.parent = item['parents'][0]['sha']

            results.append(commit)

        return results
开发者ID:aaronmartin0303,项目名称:reviewboard,代码行数:30,代码来源:github.py

示例4: _parse_commit

# 需要导入模块: from reviewboard.scmtools.core import Commit [as 别名]
# 或者: from reviewboard.scmtools.core.Commit import parent [as 别名]
    def _parse_commit(self, meta, diff=None):
        """Parse and return the meta response and return a Commit.

        Args:
            meta (dict):
                A member of the JSON response from the ``all-commits``
                endpoint corresponding to a single commit.

            diff (bytes, optional):
                The diff corresponding to the commit.

        Returns:
            reviewboard.scmtools.core.Commit:
            The parsed commit.
        """
        commit = Commit(
            author_name=meta['author'],
            id=meta['revision'],
            date=meta['time'],
            message=meta['message'],
            diff=diff
        )

        if meta['parents']:
            commit.parent = meta['parents'][0]

        return commit
开发者ID:chipx86,项目名称:reviewboard,代码行数:29,代码来源:gerrit.py

示例5: get_commits

# 需要导入模块: from reviewboard.scmtools.core import Commit [as 别名]
# 或者: from reviewboard.scmtools.core.Commit import parent [as 别名]
    def get_commits(self, repository, branch=None, start=None):
        repo_api_url = self._get_repo_api_url(repository)
        commits = self.client.api_get_commits(repo_api_url, start=start)

        results = []
        for item in commits:
            commit = Commit(
                item['commit']['author']['name'],
                item['sha'],
                item['commit']['committer']['date'],
                item['commit']['message'])
            if item['parents']:
                commit.parent = item['parents'][0]['sha']

            results.append(commit)

        return results
开发者ID:klpyang,项目名称:reviewboard,代码行数:19,代码来源:github.py

示例6: get_commits

# 需要导入模块: from reviewboard.scmtools.core import Commit [as 别名]
# 或者: from reviewboard.scmtools.core.Commit import parent [as 别名]
    def get_commits(self, repository, branch=None, start=None):
        repo_api_url = self._get_repo_api_url(repository)
        commits = self.client.api_get_commits(repo_api_url, start=start)

        results = []
        for item in commits:
            commit = Commit(
                item["commit"]["author"]["name"],
                item["sha"],
                item["commit"]["committer"]["date"],
                item["commit"]["message"],
            )
            if item["parents"]:
                commit.parent = item["parents"][0]["sha"]

            results.append(commit)

        return results
开发者ID:sichenzhao,项目名称:reviewboard,代码行数:20,代码来源:github.py

示例7: get_commits

# 需要导入模块: from reviewboard.scmtools.core import Commit [as 别名]
# 或者: from reviewboard.scmtools.core.Commit import parent [as 别名]
    def get_commits(self, repository, start=None):
        resource = 'commits'
        url = self._build_api_url(repository, resource)
        if start:
            url += '&sha=%s' % start

        rsp = self._api_get(url)

        results = []
        for item in rsp:
            commit = Commit(
                item['commit']['author']['name'],
                item['sha'],
                item['commit']['committer']['date'],
                item['commit']['message'])
            if item['parents']:
                commit.parent = item['parents'][0]['sha']

            results.append(commit)

        return results
开发者ID:ei-grad,项目名称:reviewboard,代码行数:23,代码来源:github.py

示例8: _build_commit_from_rsp

# 需要导入模块: from reviewboard.scmtools.core import Commit [as 别名]
# 或者: from reviewboard.scmtools.core.Commit import parent [as 别名]
    def _build_commit_from_rsp(self, commit_rsp):
        """Return a Commit from an API reesponse.

        This will parse a response from the API and return a structured
        commit.

        Args:
            commit_rsp (dict):
                The API payload for a commit.

        Returns:
            reviewboard.scmtools.core.Commit:
            A commit based on the payload.
        """
        commit = Commit(
            author_name=commit_rsp['author']['raw'],
            id=commit_rsp['hash'],
            date=commit_rsp['date'],
            message=commit_rsp['message'])

        if commit_rsp['parents']:
            commit.parent = commit_rsp['parents'][0]['hash']

        return commit
开发者ID:darmhoo,项目名称:reviewboard,代码行数:26,代码来源:bitbucket.py

示例9: Commit

# 需要导入模块: from reviewboard.scmtools.core import Commit [as 别名]
# 或者: from reviewboard.scmtools.core.Commit import parent [as 别名]
        try:
            rsp = self._api_get(url)
        except Exception, e:
            logging.warning('Failed to fetch commits from %s: %s',
                            url, e)
            return results

        for item in rsp:
            commit = Commit(
                item['commit']['author']['name'],
                item['sha'],
                item['commit']['committer']['date'],
                item['commit']['message'])
            if item['parents']:
                commit.parent = item['parents'][0]['sha']

            results.append(commit)

        return results

    def get_change(self, repository, revision):
        # Step 1: fetch the commit itself that we want to review, to get
        # the parent SHA and the commit message. Hopefully this information
        # is still in cache so we don't have to fetch it again.
        commit = cache.get(repository.get_commit_cache_key(revision))
        if commit:
            author_name = commit.author_name
            date = commit.date
            parent_revision = commit.parent
            message = commit.message
开发者ID:is00hcw,项目名称:reviewboard,代码行数:32,代码来源:github.py


注:本文中的reviewboard.scmtools.core.Commit.parent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。