예제 #1
0
    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,
        )
예제 #2
0
 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),
     )
예제 #3
0
    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,
        )