Skip to content

Commit

Permalink
Merge branch 'gh/328'
Browse files Browse the repository at this point in the history
  • Loading branch information
frej committed Apr 7, 2024
2 parents 3de7bcf + 08e2297 commit 2a38065
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions plugins/dos2unix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ def __init__(self, args):
pass

def file_data_filter(self,file_data):
if file_data['file_ctx'] == None:
return
file_ctx = file_data['file_ctx']
if not file_ctx.isbinary():
file_data['data'] = file_data['data'].replace(b'\r\n', b'\n')
2 changes: 2 additions & 0 deletions plugins/shell_filter_file_contents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def file_data_filter(self,file_data):
d = file_data['data']
file_ctx = file_data['file_ctx']
filename = file_data['filename']
if file_ctx == None:
return
filter_cmd = self.filter_contents + [filename, node.hex(file_ctx.filenode()), '1' if file_ctx.isbinary() else '0']
try:
filter_proc = subprocess.Popen(filter_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
Expand Down
4 changes: 3 additions & 1 deletion t/file_data_filter.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ git_convert() {
cd "$2" &&
hg-fast-export.sh --repo "../$1" \
-s --hgtags -n \
--plugin ../../plugins/rename_file_test_plugin
--plugin ../../plugins/rename_file_test_plugin \
--plugin dos2unix \
--plugin shell_filter_file_contents=../../plugins/id
)
}

Expand Down
2 changes: 2 additions & 0 deletions t/plugins/id
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
cat

0 comments on commit 2a38065

Please sign in to comment.