changeset 41986:95e4ae86329f

patch: include newline at EOF in help text for interactive patch The lack of a newline means that some "editors" that are useful in tests, such as `echo "+new line" >> "$1"` don't work. It's obviously easy to work around it, but newline at EOF seems like a good practice anyway. Differential Revision: https://phab.mercurial-scm.org/D6124
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 12 Mar 2019 14:58:35 -0700
parents b1bc6e5f5249
children c1d83d916e85
files mercurial/patch.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Tue Mar 19 16:36:59 2019 +0300
+++ b/mercurial/patch.py	Tue Mar 12 14:58:35 2019 -0700
@@ -1117,7 +1117,8 @@
                     f = util.nativeeolwriter(os.fdopen(patchfd, r'wb'))
                     chunk.header.write(f)
                     chunk.write(f)
-                    f.write('\n'.join(['# ' + i for i in phelp.splitlines()]))
+                    f.write(''.join(['# ' + i + '\n'
+                                     for i in phelp.splitlines()]))
                     f.close()
                     # Start the editor and wait for it to complete
                     editor = ui.geteditor()