def create_branch(self, repo_name, branch_name, commit=None, provenance=None, trigger=None): """ Creates a new branch. Params: * `repo_name`: A string specifying the name of the repo. * `branch_name`: A string specifying the new branch name. * `commit`: An optional tuple, string, or `Commit` object representing the head commit of the branch. * `provenance`: An optional iterable of `Branch` objects representing the branch provenance. * `trigger`: An optional `Trigger` object controlling when the head of `branch_name` is moved. """ return self._req( Service.PFS, "CreateBranch", branch=pfs_proto.Branch(repo=pfs_proto.Repo(name=repo_name), name=branch_name), head=commit_from(commit) if commit is not None else None, provenance=provenance, trigger=trigger, )
def inspect_branch(self, repo_name, branch_name): """ Inspects a branch. Returns a `BranchInfo` object. """ return self._req( Service.PFS, "InspectBranch", branch=pfs_proto.Branch(repo=pfs_proto.Repo(name=repo_name), name=branch_name), )
def delete_branch(self, repo_name, branch_name, force=None): """ Deletes a branch, but leaves the commits themselves intact. In other words, those commits can still be accessed via commit IDs and other branches they happen to be on. Params: * `repo_name`: A string specifying the repo name. * `branch_name`: A string specifying the name of the branch to delete. * `force`: A bool specifying whether to force the branch deletion. """ return self._req( Service.PFS, "DeleteBranch", branch=pfs_proto.Branch(repo=pfs_proto.Repo(name=repo_name), name=branch_name), force=force, )