def test_simple(self): [c1] = build_commit_graph(self.repo.object_store, [[1]]) self.repo[b"HEAD"] = c1.id porcelain.branch_create(self.repo, b'foo') self.assertTrue(b"foo" in porcelain.branch_list(self.repo)) porcelain.branch_delete(self.repo, b'foo') self.assertFalse(b"foo" in porcelain.branch_list(self.repo))
def branch_create(repo, name, objectish=None, force=False): Create a branch. Parameters repo Path to the repository name Name of the new branch objectish Target object to point new branch at (defaults to HEAD) force Force creation of branch, even if it already exists """ porcelain.branch_create(repoPath, branch) elif command == "deletebranch": """ def branch_delete(repo, name): Delete a branch. Parameters repo Path to the repository name Name of the branch """ porcelain.branch_delete(repoPath, branch) elif command == "printcommit": """ def print_commit(commit, decode, outstream=sys.stdout): Write a human-readable commit log entry. Parameters commit A Commit object outstream A stream file to write to """ print >> sys.stderr, "handle command printcommit" print >> sys.stderr, commit decode = lambda x: commit_decode(entry.commit, x) porcelain.print_commit(commit, decode=decode) elif command == "diff-tree": """ diff_tree(repo, old_tree, new_tree, outstream=sys.stdout): Compares the content and mode of blobs found via two tree objects.
def delete_branch(repo, branch): porcelain.branch_delete(repo, branch)