Exemple #1
0
def bzr_commit(path, message):
    (ret, stdout) = command(['bzr', 'add'], cwd=path)
    if ret != 0:
        return (ret, stdout)
    (ret, stdout) = command(['bzr', 'remove'], cwd=path)
    if ret != 0:
        return (ret, stdout)
    (ret, stdout) = command(
        ['bzr', 'commit', '--message', message], cwd=path)
    return (ret, stdout)
Exemple #2
0
def git_commit(path, message):
    (ret, stdout) = command(['git', 'add', '.'], cwd=path)
    if ret != 0:
        return (ret, stdout)
    (ret, stdout) = command(['git', 'ls-files', '--deleted'], cwd=path)
    if ret != 0:
        return (ret, stdout)
    deleted = stdout.splitlines()
    if deleted:
        (ret, stdout) = command(['git', 'rm'] + deleted, cwd=path)
        if ret != 0:
            return (ret, stdout)
    (ret, stdout) = command(
        ['git', 'commit', '--message', message], cwd=path)
    return (ret, stdout)
Exemple #3
0
def git_attip(path):
    (ret, stdout) = command(['git', 'branch', '-v'], cwd=path)
    for line in stdout.splitlines():
        line = line.lstrip()
        if line.startswith('*'):
            return '[behind' not in line
    return False
Exemple #4
0
def hg_apropos_out_command():
    (_unused_, hghelp) = command(['hg', 'help'])
    if 'phase' in hghelp:
        return hg_out_phase
    elif 'cout' in hghelp:
        return hg_out_cached
    else:
        return hg_out
Exemple #5
0
def hg_checkout(path, state):
    (ret, stdout) = command(
        ['hg', 'update', '--rev', state], cwd=path)
    return (ret, stdout)
Exemple #6
0
def git_clone(path, url, cwd):
    (ret, stdout) = command(['git', 'clone', url, path], cwd=cwd)
    return (ret, stdout)
Exemple #7
0
def bzr_out(path):
    (ret, stdout) = command(['bzr', 'missing', '--mine-only'], cwd=path)
    out = 'This branch is up to date.' not in stdout
    return (out, stdout)
Exemple #8
0
def hg_out_cached(path):
    (ret, stdout) = command(['hg', 'cout'], cwd=path)
    out = ret == 0
    return (out, stdout)
Exemple #9
0
def git_id(path):
    (ret, stdout) = command(
        ['git', 'show', '--format=short'], cwd=path)
    return stdout.splitlines()[0]
Exemple #10
0
def git_init(path):
    (ret, stdout) = command(['git', 'init', path])
    return (ret, stdout)
Exemple #11
0
def git_dump_state(path):
    (ret, stdout) = command(
        ['git', 'log', '--pretty=format:%H', '-n1'], cwd=path)
    return stdout.splitlines()[0]
Exemple #12
0
def hg_checkout(path, state):
    (ret, stdout) = command(['hg', 'update', '--rev', state], cwd=path)
    return (ret, stdout)
Exemple #13
0
def bzr_init(path):
    (ret, stdout) = command(['bzr', 'init', path])
    return (ret, stdout)
Exemple #14
0
def hg_init(path):
    (ret, stdout) = command(['hg', 'init', path])
    return (ret, stdout)
Exemple #15
0
def git_init(path):
    (ret, stdout) = command(['git', 'init', path])
    return (ret, stdout)
Exemple #16
0
def hg_init(path):
    (ret, stdout) = command(['hg', 'init', path])
    return (ret, stdout)
Exemple #17
0
def bzr_init(path):
    (ret, stdout) = command(['bzr', 'init', path])
    return (ret, stdout)
Exemple #18
0
def hg_clone(path, url, cwd):
    (ret, stdout) = command(['hg', 'clone', url, path], cwd=cwd)
    return (ret, stdout)
Exemple #19
0
def hg_dump_state(path):
    (ret, stdout) = command(
        ['hg', 'log', '--rev', '.', '--template', '{node}'], cwd=path)
    return stdout.strip()
Exemple #20
0
def git_pull(path):
    return command(['git', 'fetch'], cwd=path)
Exemple #21
0
def hg_id(path):
    (ret, stdout) = command(
        ['hg', 'id', '--num', '--id', '--branch', '--tags',
         '--bookmarks'], cwd=path)
    return stdout.strip()
Exemple #22
0
def hg_dump_state(path):
    (ret,
     stdout) = command(['hg', 'log', '--rev', '.', '--template', '{node}'],
                       cwd=path)
    return stdout.strip()
Exemple #23
0
def git_out(path):
    (ret, stdout) = command(['git', 'status'], cwd=path)
    out = ('Your branch is ahead of' in stdout or
           'Changes not staged for commit' in stdout)
    return (out, stdout)
Exemple #24
0
def bzr_id(path):
    (ret, stdout) = command(
        ['bzr', 'version-info', '--custom', '--template', '{revision_id}'],
        cwd=path)
    return stdout.strip()
Exemple #25
0
def git_checkout(path, state):
    (ret, stdout) = command(['git', 'checkout', state], cwd=path)
    return (ret, stdout)
Exemple #26
0
def hg_out_phase(path):
    (ret, stdout) = command(
        ['hg', 'log', '--rev', 'draft()', '--template',
         r'{node|short} {desc|firstline}\n'], cwd=path)
    out = bool(stdout.strip())
    return (out, stdout)
Exemple #27
0
def hg_attip(path):
    (ret1, stdout1) = command(['hg', 'identify', '--id'], cwd=path)
    (ret2, stdout2) = command(['hg', 'identify', '--id', '--rev', 'tip'],
                              cwd=path)
    return stdout1.strip() == stdout2.strip()
Exemple #28
0
def hg_out(path):
    (ret, stdout) = command(['hg', 'outgoing'], cwd=path)
    out = ret == 0
    return (out, stdout)
Exemple #29
0
def git_id(path):
    (ret, stdout) = command(['git', 'show', '--format=short'], cwd=path)
    return stdout.splitlines()[0]
Exemple #30
0
def bzr_id(path):
    (ret, stdout) = command(
        ['bzr', 'version-info', '--custom', '--template', '{revision_id}'],
        cwd=path)
    return stdout.strip()
Exemple #31
0
def hg_id(path):
    (ret, stdout) = command(
        ['hg', 'id', '--num', '--id', '--branch', '--tags', '--bookmarks'],
        cwd=path)
    return stdout.strip()
Exemple #32
0
def bzr_checkout(path, state):
    (ret, stdout) = command(
        ['bzr', 'update', '--revision', state], cwd=path)
    return (ret, stdout)
Exemple #33
0
def hg_commit(path, message):
    (ret,
     stdout) = command(['hg', 'commit', '--addremove', '--message', message],
                       cwd=path)
    return (ret, stdout)
Exemple #34
0
def git_checkout(path, state):
    (ret, stdout) = command(
        ['git', 'checkout', state], cwd=path)
    return (ret, stdout)
Exemple #35
0
def hg_isclean(path):
    (ret, stdout) = command(['hg', 'status'], cwd=path)
    return isclean_from_stdout(stdout)
Exemple #36
0
def bzr_clone(path, url, cwd):
    (ret, stdout) = command(['bzr', 'branch', url, path], cwd=cwd)
    return (ret, stdout)
Exemple #37
0
def hg_commit(path, message):
    (ret, stdout) = command(
        ['hg', 'commit', '--addremove', '--message', message], cwd=path)
    return (ret, stdout)
Exemple #38
0
def hg_pull(path):
    return command(['hg', 'pull'], cwd=path)
Exemple #39
0
def bzr_isclean(path):
    (ret, stdout) = command(['bzr', 'status', '--short'], cwd=path)
    return isclean_from_stdout(stdout)
Exemple #40
0
def bzr_isclean(path):
    (ret, stdout) = command(['bzr', 'status', '--short'], cwd=path)
    return isclean_from_stdout(stdout)
Exemple #41
0
def bzr_checkout(path, state):
    (ret, stdout) = command(['bzr', 'update', '--revision', state], cwd=path)
    return (ret, stdout)
Exemple #42
0
def git_dump_state(path):
    (ret, stdout) = command(['git', 'log', '--pretty=format:%H', '-n1'],
                            cwd=path)
    return stdout.splitlines()[0]
Exemple #43
0
def hg_isclean(path):
    (ret, stdout) = command(['hg', 'status'], cwd=path)
    return isclean_from_stdout(stdout)