From e63feee1b968ee554554b6b5d4909a2b7367f9aa Mon Sep 17 00:00:00 2001 From: Stephan Hohe Date: Tue, 20 Feb 2024 17:07:23 +0100 Subject: [PATCH] Don't add file if plugin sets content to `None` --- hg-fast-export.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hg-fast-export.py b/hg-fast-export.py index fcd5600..bf5b503 100755 --- a/hg-fast-export.py +++ b/hg-fast-export.py @@ -194,13 +194,14 @@ def export_file_contents(ctx,manifest,files,hgtags,encoding='',plugins={}): filename=file_data['filename'] file_ctx=file_data['file_ctx'] - wr(b'M %s inline %s' % (gitmode(manifest.flags(file)), - strip_leading_slash(filename))) - wr(b'data %d' % len(d)) # had some trouble with size() - wr(d) - count+=1 - if count%cfg_export_boundary==0: - sys.stderr.buffer.write(b'Exported %d/%d files\n' % (count,max)) + if d is not None: + wr(b'M %s inline %s' % (gitmode(manifest.flags(file)), + strip_leading_slash(filename))) + wr(b'data %d' % len(d)) # had some trouble with size() + wr(d) + count+=1 + if count%cfg_export_boundary==0: + sys.stderr.buffer.write(b'Exported %d/%d files\n' % (count,max)) if max>cfg_export_boundary: sys.stderr.buffer.write(b'Exported %d/%d files\n' % (count,max))