Beispiel #1
0
def commit_files(message, files="", push=True):
    """Commit some files
    """
    commit_all_files = files in ("*", ".")
    if not commit_all_files and type(files) in (unicode, str):
        files = [files]

    if is_subversion("."):
        if commit_all_files:
            runcmd_unmemoized('svn commit -m "%s"' % (message))
        else:
            runcmd_unmemoized('svn commit -m "%s" %s' % (message, " ".join(files)))

    elif is_git("."):
        if commit_all_files:
            runcmd_unmemoized("git add .")
        else:
            for file_ in files:
                runcmd_unmemoized("git add %s" % file_)
        runcmd_unmemoized('git commit -m "%s"' % message)
        if push:
            git.push_committed_changes(".")

    else:
        raise Exception("unkown scm")
Beispiel #2
0
def remove_files(files):
    """Removes and untrack each file of `files`.
    This just runs commands like "svn remove bla.txt", but it does not commit

    """
    if type(files) in (unicode, str):
        files = (files,)
    if is_subversion("."):
        runcmd_unmemoized("svn remove %s" % " ".join(files))
    elif is_git("."):
        runcmd_unmemoized("git rm %s" % " ".join(files))
Beispiel #3
0
def push_committed_changes(path):
    if is_git_svn(path):
        cmd = 'cd %s ; git svn dcommit' % path
    elif is_git(path):
        cmd = 'cd %s ; git push' % path
    else:
        raise NotAGitsvnRepository
    return runcmd_unmemoized(cmd, log=True, respond=True)
Beispiel #4
0
def add_and_commit_files(message, files="*", push=True):
    """Adds and commits files to the scm. The repository
    must be .
    Use files='*' to commit all changed files
    """
    commit_all_files = files in ("*", ".")
    if not commit_all_files and type(files) in (unicode, str):
        files = [files]
    if is_subversion("."):
        if commit_all_files:
            runcmd_unmemoized("svn add *")
        else:
            for file_ in files:
                runcmd_unmemoized("svn add %s" % file_)
    elif is_git("."):
        if commit_all_files:
            runcmd_unmemoized("git add .")
        else:
            for file_ in files:
                runcmd("git add %s" % file_)
    else:
        raise Exception("unknown scm")
    commit_files(message, files=files, push=push)
Beispiel #5
0
def update(path):
    """Runs svn up
    """
    cmd = 'svn up'
    return runcmd_unmemoized(cmd, log=True)