# HG changeset patch # User Felipe Contreras # Date 1678388533 21600 # Node ID dd42156b6441f6b8356100b4228fa16fbf95f669 # Parent 95acba2c29f6e90a7c19da0585a7b52efb416082 fastexport: rework newline logic Newlines should only be added when otherwise the stream would look weird without them (on blobs), therefore they are the exception. Flip the logic so they are added, not skipped. diff -r 95acba2c29f6 -r dd42156b6441 hgext/fastexport.py --- a/hgext/fastexport.py Mon Mar 06 11:27:57 2023 +0000 +++ b/hgext/fastexport.py Thu Mar 09 13:02:13 2023 -0600 @@ -69,10 +69,10 @@ return b"refs/heads/" + branch -def write_data(buf, data, skip_newline): +def write_data(buf, data, add_newline=False): buf.append(b"data %d\n" % len(data)) buf.append(data) - if not skip_newline or data[-1:] != b"\n": + if add_newline or data[-1:] != b"\n": buf.append(b"\n") @@ -103,7 +103,7 @@ marks[filerev] = mark data = filectx.data() buf = [b"blob\n", b"mark :%d\n" % mark] - write_data(buf, data, False) + write_data(buf, data, True) ui.write(*buf, keepprogressbar=True) del buf @@ -122,7 +122,7 @@ convert_to_git_date(ctx.date()), ), ] - write_data(buf, ctx.description(), True) + write_data(buf, ctx.description()) if parents: buf.append(b"from :%d\n" % marks[parents[0].hex()]) if len(parents) == 2: