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