class documentation
class CommitFilter:
Constructor: CommitFilter(object_store, filter_fn, filter_author, filter_committer, ...)
Filter for rewriting commits during filter-branch operations.
| Method | __init__ |
Initialize a commit filter. |
| Method | get |
Get the mapping of old commit SHAs to new commit SHAs. |
| Method | process |
Process a single commit, creating a filtered version. |
| Instance Variable | commit |
Undocumented |
| Instance Variable | filter |
Undocumented |
| Instance Variable | filter |
Undocumented |
| Instance Variable | filter |
Undocumented |
| Instance Variable | filter |
Undocumented |
| Instance Variable | index |
Undocumented |
| Instance Variable | object |
Undocumented |
| Instance Variable | parent |
Undocumented |
| Instance Variable | prune |
Undocumented |
| Instance Variable | subdirectory |
Undocumented |
| Instance Variable | tag |
Undocumented |
| Instance Variable | tree |
Undocumented |
| Method | _apply |
Apply index filter by creating temp index and running filter. |
| Method | _apply |
Apply tree filter by checking out tree and running filter. |
| Method | _filter |
Extract a subdirectory from a tree as the new root. |
| Instance Variable | _old |
Undocumented |
| Instance Variable | _processed |
Undocumented |
| Instance Variable | _tree |
Undocumented |
def __init__(self, object_store:
BaseObjectStore, *, filter_fn: Callable[ [ Commit], CommitData | None] | None = None, filter_author: Callable[ [ bytes], bytes | None] | None = None, filter_committer: Callable[ [ bytes], bytes | None] | None = None, filter_message: Callable[ [ bytes], bytes | None] | None = None, tree_filter: Callable[ [ ObjectID, str], ObjectID | None] | None = None, index_filter: Callable[ [ ObjectID, str], ObjectID | None] | None = None, parent_filter: Callable[ [ Sequence[ ObjectID]], list[ ObjectID]] | None = None, commit_filter: Callable[ [ Commit, ObjectID], ObjectID | None] | None = None, subdirectory_filter: bytes | None = None, prune_empty: bool = False, tag_name_filter: Callable[ [ bytes], bytes | None] | None = None):
¶
Initialize a commit filter.
| Parameters | |
objectBaseObjectStore | Object store to read from and write to |
filterCallable[ | Optional callable that takes a Commit object and returns a dict of updated fields (author, committer, message, etc.) |
filterCallable[ | Optional callable that takes author bytes and returns updated author bytes or None to keep unchanged |
filterCallable[ | Optional callable that takes committer bytes and returns updated committer bytes or None to keep unchanged |
filterCallable[ | Optional callable that takes commit message bytes and returns updated message bytes |
treeCallable[ | Optional callable that takes (tree_sha, temp_dir) and returns new tree SHA after modifying working directory |
indexCallable[ | Optional callable that takes (tree_sha, temp_index_path) and returns new tree SHA after modifying index |
parentCallable[ | Optional callable that takes parent list and returns modified parent list |
commitCallable[ | Optional callable that takes (Commit, tree_sha) and returns new commit SHA or None to skip commit |
subdirectorybytes | None | Optional subdirectory path to extract as new root |
prunebool | Whether to prune commits that become empty |
tagCallable[ | Optional callable to rename tags |