Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 5
0
def hg_checkout(path, state):
    (ret, stdout) = command(
        ['hg', 'update', '--rev', state], cwd=path)
    return (ret, stdout)
Ejemplo n.º 6
0
def git_clone(path, url, cwd):
    (ret, stdout) = command(['git', 'clone', url, path], cwd=cwd)
    return (ret, stdout)
Ejemplo n.º 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)
Ejemplo n.º 8
0
def hg_out_cached(path):
    (ret, stdout) = command(['hg', 'cout'], cwd=path)
    out = ret == 0
    return (out, stdout)
Ejemplo n.º 9
0
def git_id(path):
    (ret, stdout) = command(
        ['git', 'show', '--format=short'], cwd=path)
    return stdout.splitlines()[0]
Ejemplo n.º 10
0
def git_init(path):
    (ret, stdout) = command(['git', 'init', path])
    return (ret, stdout)
Ejemplo n.º 11
0
def git_dump_state(path):
    (ret, stdout) = command(
        ['git', 'log', '--pretty=format:%H', '-n1'], cwd=path)
    return stdout.splitlines()[0]
Ejemplo n.º 12
0
def hg_checkout(path, state):
    (ret, stdout) = command(['hg', 'update', '--rev', state], cwd=path)
    return (ret, stdout)
Ejemplo n.º 13
0
def bzr_init(path):
    (ret, stdout) = command(['bzr', 'init', path])
    return (ret, stdout)
Ejemplo n.º 14
0
def hg_init(path):
    (ret, stdout) = command(['hg', 'init', path])
    return (ret, stdout)
Ejemplo n.º 15
0
def git_init(path):
    (ret, stdout) = command(['git', 'init', path])
    return (ret, stdout)
Ejemplo n.º 16
0
def hg_init(path):
    (ret, stdout) = command(['hg', 'init', path])
    return (ret, stdout)
Ejemplo n.º 17
0
def bzr_init(path):
    (ret, stdout) = command(['bzr', 'init', path])
    return (ret, stdout)
Ejemplo n.º 18
0
def hg_clone(path, url, cwd):
    (ret, stdout) = command(['hg', 'clone', url, path], cwd=cwd)
    return (ret, stdout)
Ejemplo n.º 19
0
def hg_dump_state(path):
    (ret, stdout) = command(
        ['hg', 'log', '--rev', '.', '--template', '{node}'], cwd=path)
    return stdout.strip()
Ejemplo n.º 20
0
def git_pull(path):
    return command(['git', 'fetch'], cwd=path)
Ejemplo n.º 21
0
def hg_id(path):
    (ret, stdout) = command(
        ['hg', 'id', '--num', '--id', '--branch', '--tags',
         '--bookmarks'], cwd=path)
    return stdout.strip()
Ejemplo n.º 22
0
def hg_dump_state(path):
    (ret,
     stdout) = command(['hg', 'log', '--rev', '.', '--template', '{node}'],
                       cwd=path)
    return stdout.strip()
Ejemplo n.º 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)
Ejemplo n.º 24
0
def bzr_id(path):
    (ret, stdout) = command(
        ['bzr', 'version-info', '--custom', '--template', '{revision_id}'],
        cwd=path)
    return stdout.strip()
Ejemplo n.º 25
0
def git_checkout(path, state):
    (ret, stdout) = command(['git', 'checkout', state], cwd=path)
    return (ret, stdout)
Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 28
0
def hg_out(path):
    (ret, stdout) = command(['hg', 'outgoing'], cwd=path)
    out = ret == 0
    return (out, stdout)
Ejemplo n.º 29
0
def git_id(path):
    (ret, stdout) = command(['git', 'show', '--format=short'], cwd=path)
    return stdout.splitlines()[0]
Ejemplo n.º 30
0
def bzr_id(path):
    (ret, stdout) = command(
        ['bzr', 'version-info', '--custom', '--template', '{revision_id}'],
        cwd=path)
    return stdout.strip()
Ejemplo n.º 31
0
def hg_id(path):
    (ret, stdout) = command(
        ['hg', 'id', '--num', '--id', '--branch', '--tags', '--bookmarks'],
        cwd=path)
    return stdout.strip()
Ejemplo n.º 32
0
def bzr_checkout(path, state):
    (ret, stdout) = command(
        ['bzr', 'update', '--revision', state], cwd=path)
    return (ret, stdout)
Ejemplo n.º 33
0
def hg_commit(path, message):
    (ret,
     stdout) = command(['hg', 'commit', '--addremove', '--message', message],
                       cwd=path)
    return (ret, stdout)
Ejemplo n.º 34
0
def git_checkout(path, state):
    (ret, stdout) = command(
        ['git', 'checkout', state], cwd=path)
    return (ret, stdout)
Ejemplo n.º 35
0
def hg_isclean(path):
    (ret, stdout) = command(['hg', 'status'], cwd=path)
    return isclean_from_stdout(stdout)
Ejemplo n.º 36
0
def bzr_clone(path, url, cwd):
    (ret, stdout) = command(['bzr', 'branch', url, path], cwd=cwd)
    return (ret, stdout)
Ejemplo n.º 37
0
def hg_commit(path, message):
    (ret, stdout) = command(
        ['hg', 'commit', '--addremove', '--message', message], cwd=path)
    return (ret, stdout)
Ejemplo n.º 38
0
def hg_pull(path):
    return command(['hg', 'pull'], cwd=path)
Ejemplo n.º 39
0
def bzr_isclean(path):
    (ret, stdout) = command(['bzr', 'status', '--short'], cwd=path)
    return isclean_from_stdout(stdout)
Ejemplo n.º 40
0
def bzr_isclean(path):
    (ret, stdout) = command(['bzr', 'status', '--short'], cwd=path)
    return isclean_from_stdout(stdout)
Ejemplo n.º 41
0
def bzr_checkout(path, state):
    (ret, stdout) = command(['bzr', 'update', '--revision', state], cwd=path)
    return (ret, stdout)
Ejemplo n.º 42
0
def git_dump_state(path):
    (ret, stdout) = command(['git', 'log', '--pretty=format:%H', '-n1'],
                            cwd=path)
    return stdout.splitlines()[0]
Ejemplo n.º 43
0
def hg_isclean(path):
    (ret, stdout) = command(['hg', 'status'], cwd=path)
    return isclean_from_stdout(stdout)