class documentation

Protocol for filter drivers.

Method clean Apply clean filter (working tree → repository).
Method cleanup Clean up any resources held by this filter driver.
Method reuse Check if this filter driver should be reused with the given configuration.
Method smudge Apply smudge filter (repository → working tree).
def clean(self, data: bytes) -> bytes:

Apply clean filter (working tree → repository).

def cleanup(self):

Clean up any resources held by this filter driver.

def reuse(self, config: StackedConfig, filter_name: str) -> bool:

Check if this filter driver should be reused with the given configuration.

This method determines whether a cached filter driver instance should continue to be used or if it should be recreated. Only filters that are expensive to create (like long-running process filters) and whose configuration hasn't changed should return True. Lightweight filters should return False to ensure they always use the latest configuration.

Parameters
config:StackedConfigThe current configuration stack
filter_name:strThe name of the filter in config
Returns
boolTrue if the filter should be reused, False if it should be recreated
def smudge(self, data: bytes, path: bytes = b'') -> bytes:

Apply smudge filter (repository → working tree).