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 test_new_branch(self): [c1] = build_commit_graph(self.repo.object_store, [[1]]) self.repo[b"HEAD"] = c1.id porcelain.branch_create(self.repo, b"foo") self.assertEqual( set([b"master", b"foo"]), set(porcelain.branch_list(self.repo)))
def main(): os.chdir("test1") print(porcelain.branch_list(".")) mb = porcelain.merge_base(".", ["br1", "br2"]) print(mb) print(porcelain.merge_base_is_ancestor(".", mb, "br1")) print(porcelain.merge_base_is_ancestor(".", mb, "br2")) porcelain.branch_merge(".", ["br1", "br2"], do_file_merge_myers)
def get_branch_commits(repo, ignored_branches): branches = filter(lambda b: b not in ignored_branches, porcelain.branch_list(repo)) branches_with_commits = {} for branch_name in branches: branch_ref = bytes("refs/heads/%s" % branch_name) commits = [ entry.commit for entry in repo.get_walker(include=[repo[branch_ref].id], max_entries=1) ] branches_with_commits[branch_name] = commits[0].id return branches_with_commits
def test_standard(self): self.assertEqual(set([]), set(porcelain.branch_list(self.repo)))
def branch_list(self): return list(to_string_iterable(git.branch_list(self)))
def branch_exists(branch_name): if branch_name.encode() in porcelain.branch_list(REPO_PATH): return True return False
def list_branches(self): """List all repository branches.""" return branch_list(self)
result["modify"] = status[0]["modify"] result["delete"] = status[0]["delete"] result["unstaged_changes"] = status[1] #unstaged result["untracked_changes"] = status[2] #unstaged results.append(result) splunk.Intersplunk.outputResults(results) elif command == "treechanges": porcelain.get_tree_changes(repoPath) elif command == "branch": """ def branch_list(repo): List all branches. Parameters repo Path to the repository """ branches = porcelain.branch_list(repoPath) print "branches" for item in branches: print item elif command == "fetch": """ def fetch(repo, remote_location, outstream=sys.stdout, errstream=default_bytes_err_stream): Fetch objects from a remote server. Parameters repo Path to the repository remote_location String identifying a remote server outstream Output stream (defaults to stdout) errstream Error stream (defaults to stderr) Returns Dictionary with refs on the remote """ porcelain.fetch(repoPath, remote) # remote should be the host etc from a stanze
def list_branch(repo): return [str(x, encoding='utf-8') for x in porcelain.branch_list(repo)]