def start(branch, directory=""): branches = Git.branches() if branch in branches: raise ValueError(_ERROR % (branch, " ".join(branches))) directory = clone(directory) Call.call_raw("git checkout -b " + branch, cwd=directory) banner("Checked out new branch", branch)
def clone(directory): settings = Project.settings("clone") branch = settings.get("base_branch", "develop") root = GitRoot.root(os.getcwd()) if root: directory = directory or os.path.basename(root) root = os.path.dirname(root) else: directory = directory or Settings.PROJECT root = os.getcwd() directory = File.next_version(os.path.join(root, directory)) settings.update(branch=branch, directory=directory, project=Settings.PROJECT, user=Settings.USER) # Call git clone. if Git.git(*_CLONE.format(**settings).split(), cwd=root): raise ValueError("Failed to start new directory") Remote.remote("all", cwd=directory) Remote.remote("upstream", Settings.PROJECT, directory) Git.git("pull", "upstream", branch) banner("Created", branch + ", directory", directory) return directory
def test(): banner('Testing', Settings.PROJECT) run_test(GitRoot.ROOT) banner('Testing complete for', Settings.PROJECT)