Patchwork D6124: patch: include newline at EOF in help text for interactive patch

login
register
mail settings
Submitter phabricator
Date March 12, 2019, 10:13 p.m.
Message ID <differential-rev-PHID-DREV-wyd5ioipopomnxcfimuv-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/39233/
State Superseded
Headers show

Comments

phabricator - March 12, 2019, 10:13 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION 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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6124

AFFECTED FILES
  mercurial/patch.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - March 19, 2019, 6:15 p.m.
pulkit added a comment.


  `test-check-code.t` says hi.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6124

To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel
phabricator - March 19, 2019, 6:19 p.m.
pulkit added a comment.


  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()

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6124

To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel
phabricator - March 19, 2019, 6:22 p.m.
martinvonz added a comment.


  
  
  In https://phab.mercurial-scm.org/D6124#89743, @pulkit wrote:
  
  > Amended the following in flight:
  
  
  Sorry, and thanks for fixing!

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6124

To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1117,7 +1117,7 @@ 
                     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()