コード例 #1
0
ファイル: diff.py プロジェクト: seansay/ellen
def diff(repository, ref, from_ref=None, **kwargs):
    # TODO: add merge_base support
    _diff = {}
    ref = ref.strip()
    sha = _resolve_version(repository, ref)
    if not sha:
        raise JagareError("%s...%s" % (from_ref, ref))
    commit = get_commit_by_sha(repository, sha)
    from_commit = None
    if from_ref:
        from_ref = from_ref.strip()
        from_sha = _resolve_version(repository, from_ref)
        if not from_sha:
            raise JagareError("%s...%s" % (from_ref, ref))
        from_commit = get_commit_by_sha(repository, from_sha)
    # get pygit2 diff
    if from_commit:
        diff, _diff['old_sha'] = diff_commits(repository, commit, from_commit,
                                              **kwargs)
    else:
        diff, _diff['old_sha'] = diff_commit(repository, commit, **kwargs)
    _diff['new_sha'] = commit.hex
    _diff['diff'] = diff
    return _diff
コード例 #2
0
ファイル: repo.py プロジェクト: seansay/ellen
 def sha(self, rev='HEAD'):
     return _resolve_version(self.repository, rev)
コード例 #3
0
ファイル: repo.py プロジェクト: seansay/ellen
 def resolve_commit(self, version):
     version = version.strip()
     return _resolve_version(self.repository, version)