b.r.CommitBuilder(object) : class documentation

Part of bzrlib.repository View In Hierarchy

Known subclasses: bzrlib.vf_repository.VersionedFileCommitBuilder

Provides an interface to build up a commit.

This allows describing a tree to be committed without needing to know the internals of the format of the repository.

Method __init__ Initiate a CommitBuilder.
Method any_changes Return True if any entries were changed.
Method commit Make the actual commit.
Method abort Abort the commit that is being built.
Method revision_tree Return the tree that was just committed.
Method finish_inventory Tell the builder that the inventory is finished.
Method will_record_deletes Tell the commit builder that deletes are being notified.
Method record_iter_changes Record a new tree via iter_changes.
Method _validate_unicode_text Verify things like commit messages don't have bogus characters.
Method _validate_revprops Undocumented
Method _gen_revision_id Return new revision-id.
Method _generate_revision_if_needed Create a revision id if None was supplied.
def __init__(self, repository, parents, config, timestamp=None, timezone=None, committer=None, revprops=None, revision_id=None, lossy=False):
Initiate a CommitBuilder.
ParametersrepositoryRepository to commit to.
parentsRevision ids of the parents of the new revision.
timestampOptional timestamp recorded for commit.
timezoneOptional timezone for timestamp.
committerOptional committer to set for commit.
revpropsOptional dictionary of revision properties.
revision_idOptional revision id.
lossyWhether to discard data that can not be natively represented, when pushing to a foreign VCS
def any_changes(self):
Return True if any entries were changed.

This includes merge-only changes. It is the core for the --unchanged detection in commit.

ReturnsTrue if any changes have occured.
def _validate_unicode_text(self, text, context):
Verify things like commit messages don't have bogus characters.
def _validate_revprops(self, revprops):
Undocumented
def commit(self, message):
Make the actual commit.
ReturnsThe revision id of the recorded revision.
def abort(self):
Abort the commit that is being built.
def revision_tree(self):
Return the tree that was just committed.

After calling commit() this can be called to get a RevisionTree representing the newly committed tree. This is preferred to calling Repository.revision_tree() because that may require deserializing the inventory, while we already have a copy in memory.

def finish_inventory(self):
Tell the builder that the inventory is finished.
ReturnsThe inventory id in the repository, which can be used with repository.get_inventory.
def _gen_revision_id(self):
Return new revision-id.
def _generate_revision_if_needed(self):
Create a revision id if None was supplied.

If the repository can not support user-specified revision ids they should override this function and raise CannotSetRevisionId if _new_revision_id is not None.

RaisesCannotSetRevisionId
def will_record_deletes(self):
Tell the commit builder that deletes are being notified.

This enables the accumulation of an inventory delta; for the resulting commit to be valid, deletes against the basis MUST be recorded via builder.record_delete().

def record_iter_changes(self, tree, basis_revision_id, iter_changes):
Record a new tree via iter_changes.
ParameterstreeThe tree to obtain text contents from for changed objects.
basis_revision_idThe revision id of the tree the iter_changes has been generated against. Currently assumed to be the same as self.parents[0] - if it is not, errors may occur.
iter_changesAn iter_changes iterator with the changes to apply to basis_revision_id. The iterator must not include any items with a current kind of None - missing items must be either filtered out or errored-on beefore record_iter_changes sees the item.
ReturnsA generator of (file_id, relpath, fs_hash) tuples for use with tree._observed_sha1.
API Documentation for Bazaar, generated by pydoctor at 2020-01-26 00:37:26.