當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。