This is an archive of the discontinued Mercurial Phabricator instance.

patch: include newline at EOF in help text for interactive patch
ClosedPublic

Authored by martinvonz on Mar 12 2019, 6:13 PM.

Details

Summary

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.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Mar 12 2019, 6:13 PM
pulkit accepted this revision.Mar 19 2019, 2:06 PM

test-check-code.t says hi.

Amended the following in flight:

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1117,7 +1117,8 @@ the hunk is left unchanged.
                     f = util.nativeeolwriter(os.fdopen(patchfd, r'wb'))
                     chunk.header.write(f)
                     chunk.write(f)
-                    f.write(''.join(['# ' + i + '\n' 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()
In D6124#89743, @pulkit wrote:

Amended the following in flight:

Sorry, and thanks for fixing!

This revision was automatically updated to reflect the committed changes.