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)
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)
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
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
def hg_checkout(path, state): (ret, stdout) = command( ['hg', 'update', '--rev', state], cwd=path) return (ret, stdout)
def git_clone(path, url, cwd): (ret, stdout) = command(['git', 'clone', url, path], cwd=cwd) return (ret, stdout)
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)
def hg_out_cached(path): (ret, stdout) = command(['hg', 'cout'], cwd=path) out = ret == 0 return (out, stdout)
def git_id(path): (ret, stdout) = command( ['git', 'show', '--format=short'], cwd=path) return stdout.splitlines()[0]
def git_init(path): (ret, stdout) = command(['git', 'init', path]) return (ret, stdout)
def git_dump_state(path): (ret, stdout) = command( ['git', 'log', '--pretty=format:%H', '-n1'], cwd=path) return stdout.splitlines()[0]
def hg_checkout(path, state): (ret, stdout) = command(['hg', 'update', '--rev', state], cwd=path) return (ret, stdout)
def bzr_init(path): (ret, stdout) = command(['bzr', 'init', path]) return (ret, stdout)
def hg_init(path): (ret, stdout) = command(['hg', 'init', path]) return (ret, stdout)
def hg_clone(path, url, cwd): (ret, stdout) = command(['hg', 'clone', url, path], cwd=cwd) return (ret, stdout)
def hg_dump_state(path): (ret, stdout) = command( ['hg', 'log', '--rev', '.', '--template', '{node}'], cwd=path) return stdout.strip()
def git_pull(path): return command(['git', 'fetch'], cwd=path)
def hg_id(path): (ret, stdout) = command( ['hg', 'id', '--num', '--id', '--branch', '--tags', '--bookmarks'], cwd=path) return stdout.strip()
def hg_dump_state(path): (ret, stdout) = command(['hg', 'log', '--rev', '.', '--template', '{node}'], cwd=path) return stdout.strip()
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)
def bzr_id(path): (ret, stdout) = command( ['bzr', 'version-info', '--custom', '--template', '{revision_id}'], cwd=path) return stdout.strip()
def git_checkout(path, state): (ret, stdout) = command(['git', 'checkout', state], cwd=path) return (ret, stdout)
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)
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()
def hg_out(path): (ret, stdout) = command(['hg', 'outgoing'], cwd=path) out = ret == 0 return (out, stdout)
def git_id(path): (ret, stdout) = command(['git', 'show', '--format=short'], cwd=path) return stdout.splitlines()[0]
def bzr_checkout(path, state): (ret, stdout) = command( ['bzr', 'update', '--revision', state], cwd=path) return (ret, stdout)
def hg_commit(path, message): (ret, stdout) = command(['hg', 'commit', '--addremove', '--message', message], cwd=path) return (ret, stdout)
def git_checkout(path, state): (ret, stdout) = command( ['git', 'checkout', state], cwd=path) return (ret, stdout)
def hg_isclean(path): (ret, stdout) = command(['hg', 'status'], cwd=path) return isclean_from_stdout(stdout)
def bzr_clone(path, url, cwd): (ret, stdout) = command(['bzr', 'branch', url, path], cwd=cwd) return (ret, stdout)
def hg_commit(path, message): (ret, stdout) = command( ['hg', 'commit', '--addremove', '--message', message], cwd=path) return (ret, stdout)
def hg_pull(path): return command(['hg', 'pull'], cwd=path)
def bzr_isclean(path): (ret, stdout) = command(['bzr', 'status', '--short'], cwd=path) return isclean_from_stdout(stdout)
def bzr_checkout(path, state): (ret, stdout) = command(['bzr', 'update', '--revision', state], cwd=path) return (ret, stdout)
def git_dump_state(path): (ret, stdout) = command(['git', 'log', '--pretty=format:%H', '-n1'], cwd=path) return stdout.splitlines()[0]