コード例 #1
0
ファイル: git.py プロジェクト: ptnapoleon/jenkins-autojobs
def get_newest_commit_from_branch(ref, repo, yamlpath):
    repo_path = path.join(path.dirname(path.realpath(yamlpath)), 'cassandra')
    if not path.isdir(repo_path):
        cmd = ('git', 'clone', '--bare', 'https://github.com/apache/cassandra', repo_path)
        check_output(cmd).decode('utf8')
    cmd = ('git', '--git-dir=%s' % repo_path, 'fetch', repo, ref)
    check_output(cmd).decode('utf8')
    cmd = ('git', '--git-dir=%s' % repo_path, 'show', '--format=%cd','--date=short', '--quiet', 'FETCH_HEAD')
    out = check_output(cmd).decode('utf8')
    return out
コード例 #2
0
ファイル: hg.py プロジェクト: mambocab/jenkins-autojobs
def hg_branch_iter_remote(repo, python):
    with NamedTemporaryFile() as fh:
        cmd = (hg_list_remote_py % {'repo': repo}).encode('utf8')
        fh.write(cmd)
        fh.flush()
        out = check_output((python, fh.name))

    out = literal_eval(out.decode('utf8'))
    return [i[0] for i in out]
コード例 #3
0
ファイル: hg.py プロジェクト: gbl4ck/jenkins-autojobs
def hg_branch_iter_remote(repo, python):
    with NamedTemporaryFile() as fh:
        cmd = (hg_list_remote_py % repo).encode('utf8')
        fh.write(cmd)
        fh.flush()
        out = check_output((python, fh.name))

    out = literal_eval(out.decode('utf8'))
    return [i[0] for i in out]
コード例 #4
0
ファイル: git.py プロジェクト: PaulKlumpp/jenkins-autojobs
def git_refs_iter_remote(repo):
    cmd = ('git', 'ls-remote', repo)
    out = check_output(cmd).decode('utf8').split(linesep)

    for sha, ref in (i.split() for i in out if i):
        if not ref.startswith('refs/'):
            continue
        # :todo: generalize
        if ref.endswith('^{}'):
            continue

        yield ref
コード例 #5
0
def git_refs_iter_remote(repo):
    cmd = ('git', 'ls-remote', repo)
    out = check_output(cmd).decode('utf8').split(linesep)

    for sha, ref in (i.split() for i in out if i):
        if not ref.startswith('refs/'):
            continue
        # :todo: generalize
        if ref.endswith('^{}'):
            continue

        yield ref
コード例 #6
0
ファイル: svn.py プロジェクト: ncoquelet/jenkins-autojobs
def svn_ls(url, username=None, password=None, dirsonly=True):
    cmd = ['svn', 'ls', '--trust-server-cert', '--non-interactive']

    # :todo: plaintext (will probably have to use the bindings).
    if username: cmd += ['--username', username]
    if password: cmd += ['--password', password]

    cmd.append(url)
    out = check_output(cmd).decode('utf8').split(linesep)

    if dirsonly:
        out = [i.rstrip('/') for i in out if i.endswith('/')]

    return out
コード例 #7
0
def svn_ls(url, username=None, password=None, dirsonly=True):
    cmd = ['svn', 'ls', '--trust-server-cert', '--non-interactive']

    # :todo: plaintext (will probably have to use the bindings)
    if username: cmd += ['--username', username]
    if password: cmd += ['--password', password]

    cmd.append(url)
    out = check_output(cmd).decode('utf8').split(linesep)

    if dirsonly:
        out = [i.rstrip('/') for i in out if i.endswith('/')]

    return out
コード例 #8
0
ファイル: git.py プロジェクト: ptnapoleon/jenkins-autojobs
def git_refs_iter_remote(repo, stale, before, yamlpath):
    cmd = ('git', 'ls-remote', '--heads', repo)
    out = check_output(cmd).decode('utf8').split(linesep)

    for sha, ref in (i.split() for i in out if i):
        if not ref.startswith('refs/'):
            continue
        # :todo: generalize
        if ref.endswith('^{}'):
            continue

        if stale and stale_branch(ref, repo, stale, before, yamlpath):
            continue

        yield ref
コード例 #9
0
ファイル: svn.py プロジェクト: gk529/jenkins-autojobs
def svn_ls(url, username=None, password=None, dirsonly=True):
    cmd = ["svn", "ls", "--trust-server-cert", "--non-interactive"]

    # :todo: plaintext (will probably have to use the bindings).
    if username:
        cmd += ["--username", username]
    if password:
        cmd += ["--password", password]

    cmd.append(url)
    out = check_output(cmd).decode("utf8").split(linesep)

    if dirsonly:
        out = [i.rstrip("/") for i in out if i.endswith("/")]

    return out
コード例 #10
0
ファイル: git.py プロジェクト: PaulKlumpp/jenkins-autojobs
def git_refs_iter_local(repo):
    cmd = ('git', 'show-ref')
    out = check_output(cmd, cwd=repo).split(linesep)

    return (ref for sha, ref in [i.split() for i in out if i])
コード例 #11
0
ファイル: hg.py プロジェクト: mambocab/jenkins-autojobs
def hg_branch_iter_local(repo):
    cmd = ('hg', '-y', 'branches', '-c', '-R', repo)
    out = check_output(cmd).decode('utf8').split(linesep)

    out = (re.split('\s+', i, 1) for i in out if i)
    return (name for name, rev in out)
コード例 #12
0
ファイル: hg.py プロジェクト: gbl4ck/jenkins-autojobs
def hg_branch_iter_local(repo):
    cmd = ('hg', '-y', 'branches', '-c', '-R', repo)
    out = check_output(cmd).decode('utf8').split(linesep)

    out = (re.split('\s+', i, 1) for i in out if i)
    return (name for name, rev in out)
コード例 #13
0
def git_refs_iter_local(repo):
    cmd = ('git', 'show-ref')
    out = check_output(cmd, cwd=repo).split(linesep)

    return (ref for sha, ref in [i.split() for i in out if i])
コード例 #14
0
ファイル: hg.py プロジェクト: ThomasMatern/jenkins-autojobs
def hg_branch_iter_local(repo, python, max_branch_age):
    cmd = ("hg", "-y", "branches", "-c", "-R", repo)
    out = check_output(cmd).decode("utf8").split(linesep)

    out = (re.split("\s+", i, 1) for i in out if i)
    return (name for name, rev in out)