Example #1
0
    def start_commit(self,
                     repo_name,
                     branch=None,
                     parent=None,
                     description=None):
        """
        Begins the process of committing data to a Repo. Once started you can
        write to the Commit with PutFile and when all the data has been
        written you must finish the Commit with FinishCommit. NOTE, data is
        not persisted until FinishCommit is called. A Commit object is
        returned.

        Params:
        * repo_name: The name of the repo.
        * branch: A more convenient way to build linear chains of commits.
        When a commit is started with a non-empty branch the value of branch
        becomes an alias for the created Commit. This enables a more intuitive
        access pattern. When the commit is started on a branch the previous
        head of the branch is used as the parent of the commit.
        * parent: Specifies the parent Commit, upon creation the new Commit
        will appear identical to the parent Commit, data can safely be added
        to the new commit without affecting the contents of the parent Commit.
        You may pass "" as parentCommit in which case the new Commit will have
        no parent and will initially appear empty.
        * description: (optional) explanation of the commit for clarity.
        """
        req = proto.StartCommitRequest(parent=proto.Commit(
            repo=proto.Repo(name=repo_name), id=parent),
                                       branch=branch,
                                       description=description)
        res = self.stub.StartCommit(req, metadata=self.metadata)
        return res
Example #2
0
 def start_commit(self,
                  repo_name,
                  branch=None,
                  parent=None,
                  description=None,
                  provenance=None):
     """
     Begins the process of committing data to a Repo. Once started you can
     write to the Commit with PutFile and when all the data has been
     written you must finish the Commit with FinishCommit. NOTE, data is
     not persisted until FinishCommit is called. A Commit object is
     returned.
     Params:
     * repo_name: A string specifying the name of the repo.
     * branch: A string specifying the branch name. This is a more
     convenient way to build linear chains of commits. When a commit is
     started with a non-empty branch the value of branch becomes an alias
     for the created Commit. This enables a more intuitive access pattern.
     When the commit is started on a branch the previous head of the branch
     is used as the parent of the commit.
     * parent: An optional `Commit` object specifying the parent commit.
     Upon creation the new commit will appear identical to the parent
     commit, data can safely be added to the new commit without affecting
     the contents of the parent commit.
     * description: An optional string describing the commit.
     * provenance: An optional iterable of `CommitProvenance` objects
     specifying the commit provenance.
     """
     req = proto.StartCommitRequest(
         parent=proto.Commit(repo=proto.Repo(name=repo_name), id=parent),
         branch=branch,
         description=description,
         provenance=provenance,
     )
     return self.stub.StartCommit(req, metadata=self.metadata)