Example #1
0
 def finish_commit(self,
                   commit,
                   description=None,
                   tree_object_hashes=None,
                   datum_object_hash=None,
                   size_bytes=None,
                   empty=None):
     """
     Ends the process of committing data to a Repo and persists the
     Commit. Once a Commit is finished the data becomes immutable and
     future attempts to write to it with PutFile will error.
     Params:
     * commit: A tuple, string, or `Commit` object representing the commit.
     * description: An optional string describing this commit.
     * tree_object_hashes: A list of zero or more strings specifying object
     hashes.
     * datum_object_hash: An optional string specifying an object hash.
     * size_bytes: An optional int.
     * empty: An optional bool. If set, the commit will be closed (its
     `finished` field will be set to the current time) but its `tree` will
     be left nil.
     """
     req = proto.FinishCommitRequest(
         commit=commit_from(commit),
         description=description,
         trees=[proto.Object(hash=h) for h in tree_object_hashes]
         if tree_object_hashes is not None else None,
         datums=proto.Object(hash=datum_object_hash)
         if datum_object_hash is not None else None,
         size_bytes=size_bytes,
         empty=empty,
     )
     return self.stub.FinishCommit(req, metadata=self.metadata)
Example #2
0
    def finish_commit(self, commit):
        """
        Ends the process of committing data to a Repo and persists the
        Commit. Once a Commit is finished the data becomes immutable and
        future attempts to write to it with PutFile will error.

        Params:
        * commit: A tuple, string, or Commit object representing the commit.
        """
        req = proto.FinishCommitRequest(commit=commit_from(commit))
        res = self.stub.FinishCommit(req, metadata=self.metadata)
        return res