shelve: expurious newline after shelving patch hunk

Issue #579 resolved
Wagner Bruna
created an issue

Shelving the first hunk of the attached patch (the one changing "widget tooltip") ends up writing a newline just before the following "diff --git...", showing then a parse error on the patch widget.

Apart from the extra newline, the resulting patch file seems ok.

Tested with 2.0.3 and stable tip (<<changeset 7562f0e8dc7b>>). "hg showconfig diff patch" shows:

{{{ diff.git=True diff.showfunc=True patch.eol=auto }}}

Comments (8)

  1. Kevin Bell

    I've also experienced this issue quite frequently lately. Here's the steps I usually take. Using the repo in my attachment:

    1. Open Shelve tool
    2. Click 'move all files right' button
    3. Select first chunk in 'Department.cs'
    4. Click 'move selected chunks left' button
    5. Shelf pane contents disappear and is replaced with '*ParseError*'

    Thanks to the original report, it's easier to recover from now that I know I can just delete the extra blank line in the shelf file.

  2. Steve Borho

    Are you using git diffs as well?

    What's frustrating is that there is code in the shelve tool that actually does add extra line feeds on purpose because the record extension's patch parser seems to leave them off in some cases (record only ever deals with one file at a time, so doesn't get bitten by inter-file diff boundaries). So this is going to be tricky to fix robustly.

    Thanks for the second repro case.

  3. Log in to comment