b.t.p.t.TestRevisionHistoryCaching(per_branch.TestCaseWithBranch) : class documentation

Part of bzrlib.tests.per_branch.test_revision_history View In Hierarchy

Tests for the caching of branches' revision_history.

When locked, branches should avoid regenerating or rereading revision_history by caching the last value of it. This is safe because the branch is locked, so nothing can change the revision_history unexpectedly.

When not locked, obviously the revision_history will need to be regenerated or reread each time.

We test if revision_history is using the cache by instrumenting the branch's _gen_revision_history method, which is called by Branch.revision_history if the branch does not have a cache of the revision history.

Method get_instrumented_branch Get a branch and monkey patch it to log calls to
Method test_revision_history_when_unlocked Repeated calls to revision history will call _gen_revision_history
Method test_revision_history_when_locked Repeated calls to revision history will only call
Method test_set_revision_history_when_locked When the branch is locked, calling set_revision_history should cache
Method test_set_revision_history_when_unlocked When the branch is not locked, calling set_revision_history will not
Method test_set_last_revision_info_when_locked When the branch is locked, calling set_last_revision_info should
Method test_set_last_revision_info_none Passing None to set_last_revision_info raises an exception.
Method test_set_last_revision_info_uncaches_revision_history_for_format6 On format 6 branches, set_last_revision_info invalidates the revision
Method test_cached_revision_history_not_accidentally_mutable When there's a cached version of the history, revision_history

Inherited from TestCaseWithBranch:

Method setUp Undocumented
Method get_branch Undocumented
Method get_default_format Undocumented
Method make_branch Undocumented
Method create_tree_with_merge Create a branch with a simple ancestry.
def get_instrumented_branch(self):
Get a branch and monkey patch it to log calls to _gen_revision_history.
Returnsa tuple of (the branch, list that calls will be logged to)
def test_revision_history_when_unlocked(self):
Repeated calls to revision history will call _gen_revision_history each time when the branch is not locked.
def test_revision_history_when_locked(self):
Repeated calls to revision history will only call _gen_revision_history once while the branch is locked.
def test_set_revision_history_when_locked(self):
When the branch is locked, calling set_revision_history should cache the revision history so that a later call to revision_history will not need to call _gen_revision_history.
def test_set_revision_history_when_unlocked(self):
When the branch is not locked, calling set_revision_history will not cause the revision history to be cached.
def test_set_last_revision_info_when_locked(self):
When the branch is locked, calling set_last_revision_info should cache the last revision info so that a later call to last_revision_info will not need the revision_history. Thus the branch will not to call _gen_revision_history in this situation.
def test_set_last_revision_info_none(self):
Passing None to set_last_revision_info raises an exception.
def test_set_last_revision_info_uncaches_revision_history_for_format6(self):
On format 6 branches, set_last_revision_info invalidates the revision history cache.
def test_cached_revision_history_not_accidentally_mutable(self):
When there's a cached version of the history, revision_history returns a copy of the cached data so that callers cannot accidentally corrupt the cache.
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.