This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 112582 - Generated diffs do not apply with patch command
Summary: Generated diffs do not apply with patch command
Status: RESOLVED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: CVS (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@versioncontrol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-11 00:43 UTC by Jesse Glick
Modified: 2007-08-13 14:11 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2007-08-11 00:43:05 UTC
070810. Modify some files in nb.org CVS and generate a diff. As seen e.g. in

http://www.netbeans.org/nonav/issues/showattachment.cgi/46471/kits_golden_file.diff

you get a relative Index (relative to CVS root, that was issue #72938, thanks) but still absolute filenames, e.g.:

Index: nbbuild/antsrc/org/netbeans/nbbuild/ModuleDependencies.java
--- /space/src/nb_all/nbbuild/antsrc/org/netbeans/nbbuild/ModuleDependencies.java Base (1.26)
+++ /space/src/nb_all/nbbuild/antsrc/org/netbeans/nbbuild/ModuleDependencies.java Locally Modified (Based On 1.26)

as opposed to command-line cvs diff, which creates all relative paths, e.g.

Index: nbbuild/antsrc/org/netbeans/nbbuild/ModuleDependencies.java
===================================================================
RCS file: /shared/data/ccvs/repository/nbbuild/antsrc/org/netbeans/nbbuild/ModuleDependencies.java,v
retrieving revision 1.26
diff -u -r1.26 ModuleDependencies.java
--- nbbuild/antsrc/org/netbeans/nbbuild/ModuleDependencies.java	3 Aug 2007 11:40:28 -0000	1.26
+++ nbbuild/antsrc/org/netbeans/nbbuild/ModuleDependencies.java	10 Aug 2007 23:35:21 -0000

Command-line patch does not easily accept the patches created by NetBeans:

nb_all$ patch -p0 --dry-run < /tmp/kits_golden_file.diff 
can't find file to patch at input line 8
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|# This patch file was generated by NetBeans IDE
|# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
|# It uses platform neutral UTF-8 encoding.
|# Above lines and this line are ignored by the patching process.
|Index: nbbuild/antsrc/org/netbeans/nbbuild/ModuleDependencies.java
|--- /Users/petrjiricka/sources/trunk/nbbuild/antsrc/org/netbeans/nbbuild/ModuleDependencies.java Base (1.26)
|+++ /Users/petrjiricka/sources/trunk/nbbuild/antsrc/org/netbeans/nbbuild/ModuleDependencies.java Locally Modified
(Based On 1.26)
--------------------------
File to patch: 

whereas when the absolute prefix (here "/Users/petrjiricka/sources/trunk/") is removed by manual editing, it applies
cleanly:

nb_all$ patch -p0 < /tmp/kits_golden_file.diff 
patching file nbbuild/antsrc/org/netbeans/nbbuild/ModuleDependencies.java
patching file nbbuild/build.xml

Or you can use some higher -p option - in this case -p5, by trial and error.

Note that the patch applies cleanly with -p0 also if you happen to be applying it a checkout of the same full path name
as it was generated on! So to test you need to use a patch created on a different working directory.
Comment 1 Maros Sandor 2007-08-13 14:11:16 UTC
Now using relative paths in patch headers.

/shared/data/ccvs/repository/subversion/main/src/org/netbeans/modules/subversion/ui/diff/ExportDiffAction.java,v  <-- 
ExportDiffAction.java
new revision: 1.20; previous revision: 1.19
/shared/data/ccvs/repository/javacvs/cvsmodule/src/org/netbeans/modules/versioning/system/cvss/ui/actions/diff/ExportDiffAction.java,v
 <--  ExportDiffAction.java
new revision: 1.43; previous revision: 1.42