示例#1
0
文件: git.py 项目: dakkar/rbtools
def get_unique_commit_hashes(ref_name, new_rev):
    """Returns a list of abbreviated commit hashes unique to ref_name."""
    git_command = [
        'git', 'rev-list', new_rev, '--abbrev-commit', '--reverse', '--not'
    ]
    git_command.extend(get_excluded_branches(ref_name))
    return execute(git_command).strip().split('\n')
示例#2
0
文件: git.py 项目: dakkar/rbtools
def get_commit_hashes(old_rev, new_rev):
    """Returns a list of abbreviated commit hashes from old_rev to new_rev."""
    git_command = [
        'git', 'rev-list', '--abbrev-commit', '--reverse',
        '%s..%s' % (old_rev, new_rev)
    ]
    return execute(git_command).split('\n')
示例#3
0
文件: git.py 项目: MistShi/rbtools
def get_commit_message(commit):
    """Returns the specified commit's commit message."""
    git_command = ['git', 'show', '-s', '--pretty=format:%B', commit]
    return execute(git_command).strip()
示例#4
0
文件: git.py 项目: MistShi/rbtools
def get_branches_containing_commit(commit_hash):
    """Returns a list of all branches containing the specified commit."""
    git_command = ['git', 'branch', '--contains', commit_hash]
    branches = execute(git_command).replace('*', '').split('\n')
    return [branch.strip() for branch in branches]
示例#5
0
文件: git.py 项目: MistShi/rbtools
def get_excluded_branches(ref_name):
    """Returns a list of all branches, excluding the specified branch."""
    git_command = ['git', 'for-each-ref', 'refs/heads/', '--format=%(refname)']
    all_branches = execute(git_command).strip().split('\n')
    return [branch.strip() for branch in all_branches if branch != ref_name]
示例#6
0
文件: git.py 项目: MistShi/rbtools
def get_unique_commit_hashes(ref_name, new_rev):
    """Returns a list of abbreviated commit hashes unique to ref_name."""
    git_command = ['git', 'rev-list', new_rev, '--abbrev-commit', '--reverse',
                   '--not']
    git_command.extend(get_excluded_branches(ref_name))
    return execute(git_command).strip().split('\n')
示例#7
0
文件: git.py 项目: MistShi/rbtools
def get_commit_hashes(old_rev, new_rev):
    """Returns a list of abbreviated commit hashes from old_rev to new_rev."""
    git_command = ['git', 'rev-list', '--abbrev-commit', '--reverse', '%s..%s'
                   % (old_rev, new_rev)]
    return execute(git_command).split('\n')
示例#8
0
文件: git.py 项目: dakkar/rbtools
def get_commit_message(commit):
    """Returns the specified commit's commit message."""
    git_command = ['git', 'show', '-s', '--pretty=format:%B', commit]
    return execute(git_command).strip()
示例#9
0
文件: git.py 项目: dakkar/rbtools
def get_branches_containing_commit(commit_hash):
    """Returns a list of all branches containing the specified commit."""
    git_command = ['git', 'branch', '--contains', commit_hash]
    branches = execute(git_command).replace('*', '').split('\n')
    return [branch.strip() for branch in branches]
示例#10
0
文件: git.py 项目: dakkar/rbtools
def get_excluded_branches(ref_name):
    """Returns a list of all branches, excluding the specified branch."""
    git_command = ['git', 'for-each-ref', 'refs/heads/', '--format=%(refname)']
    all_branches = execute(git_command).strip().split('\n')
    return [branch.strip() for branch in all_branches if branch != ref_name]