Bug 198527 - Apply Diff Patch... is worthless: The patch cannot be applied in the selected context
Apply Diff Patch... is worthless: The patch cannot be applied in the selected...
Status: NEW
Product: utilities
Classification: Unclassified
Component: Diff
PC Other
: P3 (vote)
Assigned To: Tomas Stupka
Depends on:
  Show dependency treegraph
Reported: 2011-05-11 18:05 UTC by kpalsson
Modified: 2011-06-10 13:24 UTC (History)
0 users

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
Description kpalsson 2011-05-11 18:05:12 UTC
I used "team->export diff patch" to create a diff file, which looked good, but then when later trying to apply it again, I get the message, "The patch cannot be applied in the selected context" and nothing is done at all.

I realise that there are other bugs tracking the context path being relative to project roots and version control roots, but this bug is NOT about that.

This message is being applied simply because a hunk failed.  The "output" window had a tab labelled "patch report" which was _NOT_ brought to the foreground when this failed.  (It should have been, I should not have had to go looking)

On that tab, I get the following output:

11.5.2011 17:46:58  ===========================================================================
--- Successfully Patched ---
--- Failed ---
C:\srcx\cbms2-trunk\applications\mqtt2_v_ssr\mqtt2_v_ssr.cpp (Cannot apply hunk @@ 10 )

This is pretty worthless.  What happens at the command line when I try and apply the patch myself:

C:\srcx\cbms2-trunk\applications\mqtt2_v_ssr>patch -p0 --verbose -i mqtt_subtopi
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
|# This patch file was generated by NetBeans IDE
|# Following Index: paths are relative to: C:\srcx\cbms2-trunk\applications\mqtt
|# This patch can be applied using context Tools: Patch action on respective fol
|# It uses platform neutral UTF-8 encoding and \n newlines.
|# Above lines and this line are ignored by the patching process.
|Index: mqtt2_v_ssr.cpp
|--- mqtt2_v_ssr.cpp Base (BASE)
|+++ mqtt2_v_ssr.cpp Locally Modified (Based On LOCAL)
Patching file `mqtt2_v_ssr.cpp' using Plan A...
Hunk #1 succeeded at 51 (offset -1 lines).
Hunk #2 succeeded at 120.
Hunk #3 FAILED at 261.
Hunk #4 succeeded at 278 (offset -3 lines).
Hunk #5 succeeded at 388.
Hunk #6 succeeded at 768 (offset -3 lines).
Hunk #7 succeeded at 792.
Hunk #8 succeeded at 859 (offset -3 lines).
Hunk #9 succeeded at 897.
1 out of 9 hunks FAILED -- saving rejects to mqtt2_v_ssr.cpp.rej

Notes: That comment that the "patch can be applied..." is wrong, that just gives the bad context error.

I would like a patch that has failed hunks to _succeed_ and then offer to show me the failed hunks!  It's pretty worthless in it's current state.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo