b.v.VersionedFileCommitBuilder(CommitBuilder) : class documentation

Part of bzrlib.vf_repository View In Hierarchy

Known subclasses: bzrlib.repofmt.pack_repo.PackCommitBuilder, bzrlib.vf_repository.VersionedFileRootCommitBuilder

Commit builder implementation for versioned files based repositories.
Method __init__ Initiate a CommitBuilder.
Method will_record_deletes Tell the commit builder that deletes are being notified.
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 get_basis_delta Return the complete inventory delta versus the basis inventory.
Method record_delete Record that a delete occured against a basis tree.
Method record_entry_contents Record the content of ie from tree into the commit if needed.
Method record_iter_changes Record a new tree via iter_changes.
Method _ensure_fallback_inventories Ensure that appropriate inventories are available.
Method _check_root Helper for record_entry_contents.
Method _require_root_change Enforce an appropriate root object change.
Method _get_delta Get a delta against the basis inventory for ie.
Method _heads Calculate the graph heads for revision_ids in the graph of file_id.
Method _add_text_to_weave Undocumented

Inherited from CommitBuilder:

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 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 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 _ensure_fallback_inventories(self):
Ensure that appropriate inventories are available.

This only applies to repositories that are stacked, and is about enusring the stacking invariants. Namely, that for any revision that is present, we either have all of the file content, or we have the parent inventory and the delta file content.

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 _check_root(self, ie, parent_invs, tree):
Helper for record_entry_contents.
ParametersieAn entry being added.
parent_invsThe inventories of the parent revisions of the commit.
treeThe tree that is being committed.
def _require_root_change(self, tree):
Enforce an appropriate root object change.

This is called once when record_iter_changes is called, if and only if the root was not in the delta calculated by record_iter_changes.

ParameterstreeThe tree which is being committed.
def _get_delta(self, ie, basis_inv, path):
Get a delta against the basis inventory for ie.
def _heads(self, file_id, revision_ids):
Calculate the graph heads for revision_ids in the graph of file_id.

This can use either a per-file graph or a global revision graph as we have an identity relationship between the two graphs.

def get_basis_delta(self):
Return the complete inventory delta versus the basis inventory.

This has been built up with the calls to record_delete and record_entry_contents. The client must have already called will_record_deletes() to indicate that they will be generating a complete delta.

ReturnsAn inventory delta, suitable for use with apply_delta, or Repository.add_inventory_by_delta, etc.
def record_delete(self, path, file_id):
Record that a delete occured against a basis tree.

This is an optional API - when used it adds items to the basis_delta being accumulated by the commit builder. It cannot be called unless the method will_record_deletes() has been called to inform the builder that a delta is being supplied.

ParameterspathThe path of the thing deleted.
file_idThe file id that was deleted.
def record_entry_contents(self, ie, parent_invs, path, tree, content_summary):
Record the content of ie from tree into the commit if needed.

Side effect: sets ie.revision when unchanged

ParametersieAn inventory entry present in the commit.
parent_invsThe inventories of the parent revisions of the commit.
pathThe path the entry is at in the tree.
treeThe tree which contains this entry and should be used to obtain content.
content_summarySummary data from the tree about the paths content - stat, length, exec, sha/link target. This is only accessed when the entry has a revision of None - that is when it is a candidate to commit.
ReturnsA tuple (change_delta, version_recorded, fs_hash). change_delta is an inventory_delta change for this entry against the basis tree of the commit, or None if no change occured against the basis tree. version_recorded is True if a new version of the entry has been recorded. For instance, committing a merge where a file was only changed on the other side will return (delta, False). fs_hash is either None, or the hash details for the path (currently a tuple of the contents sha1 and the statvalue returned by tree.get_file_with_stat()).
def record_iter_changes(self, tree, basis_revision_id, iter_changes, _entry_factory=entry_factory):
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 before record_iter_changes sees the item.
_entry_factoryPrivate method to bind entry_factory locally for performance.
ReturnsA generator of (file_id, relpath, fs_hash) tuples for use with tree._observed_sha1.
def _add_text_to_weave(self, file_id, new_text, parents, nostore_sha):
Undocumented
API Documentation for Bazaar, generated by pydoctor at 2019-10-20 00:34:54.