Run file_data_filter on deleted files

The `file_data_filter` method should be called when files are deleted.
In this case the `data` and `file_ctx` keys map to None. This is so
that a filter which modifies file names can apply the same name
transformations before files are deleted.
This commit is contained in:
Frej Drejhammar
2024-02-16 17:12:49 +01:00
parent 21ab3f347b
commit ddfc3a8300
5 changed files with 140 additions and 3 deletions

View File

@@ -311,9 +311,18 @@ def export_commit(ui,repo,revision,old_marks,max,count,authors,
% (branch, type.encode(), revision + 1, max, len(modified), len(removed))
)
for filename in removed:
for file in removed:
if fn_encoding:
filename=filename.decode(fn_encoding).encode('utf8')
filename=file.decode(fn_encoding).encode('utf8')
else:
filename=file
if plugins and plugins['file_data_filters']:
file_data = {'filename':filename, 'file_ctx':None, 'data':None}
for filter in plugins['file_data_filters']:
filter(file_data)
filename=file_data['filename']
filename=strip_leading_slash(filename)
if filename==b'.hgsub':
remove_gitmodules(ctx)