Creating an SVN patch including new directories
First of all excuse the long text, but I am trying to be as detailed as I can.
I am developing for an open-source project (DSpace). I don't have commit privileges to their SVN repo, so I checked out the source and have been using git to manage my versioning.
During my development, i've added several directories and binary files to my project.
The time has come to make an SVN patch file so I can give something back to the community! Netbeans does this for me through the Team-> Create patch option. So far so good...
However, when I check out the source again on another machine and use the patch command:
# get current dir
DIR="$( cd "$( dirname "$0" )" && pwd )"
#check out dspace release
svn co http://scm.dspace.org/svn/repo/dspace/tags/dspace-1.7.2/ -q $DIR/dspace-1.7.2/
#apply patch
cd $DIR/dspace-1.7.2
echo "Now running at "&& pwd
patch --dry-run -N -p0 < $DIR/patches/patch.diff
cd $DIR
Running Script
When i run this script, all goes well until the patch attempts to modify a file inside one of my new directories. It says the following:
can't find file to patch at input line 9214
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: dspace-jspui/dspace-jspui-webapp/src/main/webapp/static/js/jQueryUI/jquery-ui.js
|--- dspace-jspui/dspace-jspui-webapp/src/main/webapp/static/js/jQueryUI/jquery-ui.js Base (BASE)
|+++ dspace-jspui/dspace-jspui-webapp/src/main/webapp/static/js/jQueryUI/jquery-ui.js Locally Modified (Based On LOCAL)
--------------------------
File to patch:
Before it stops, it is able to patch a bunch of files which were already in the original dspace release, so I think it is not related to the -pXXX parameter of the patch command (nevertheless i have tried up to -p10) ... I think this only happens when I attempt to patch a file inside one of my created directories. My guess is that the patch command does not create new directories, so it cannot find the correct paths.
This is driving me nuts, please does anyone have any idea how to solve my problem?
Thanks in advance!
EDIT:
I've added the --verbose option to the patch command. Here's the result:
--------------------------
Patching file dspace-jspui/dspace-jspui-webapp/src/main/webapp/static/js/autocompleter/styles.css using Plan A...
Hunk #1 succeeded at 1.
Hmm... The next patch looks like a unified diff to me...
can't find file to patch at input line 9214
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: dspace-jspui/dspace-jspui-webapp/src/main/webapp/static/js/jQueryUI/jquery-ui.js
|--- dspace-jspui/dspace-jspui-webapp/src/main/webapp/static/js/jQueryUI/jquery-ui.js Base (BASE)
|+++ dspace-jspui/dspace-jspui-webapp/src/main/webapp/static/js/jQueryUI/jquery-ui.js Locally Modified (Based On LOCAL)
--------------------------
File to patch:
After I quit 开发者_开发技巧the patch process, if i make
cd dspace-1.7.2/dspace-jspui/dspace-jspui-webapp/src/main/webapp/static/js/jQueryUI
I get:
-bash: cd: dspace-1.7.2/dspace-jspui/dspace-jspui-webapp/src/main/webapp/static/js/jQueryUI: No such file or directory
This is one of the folders I added during the development, which proves that patch is not creating these new folders.
In case of generating patches, which have to include adding new files/directories, for pure subversion CLI you have to add --git
option to svn diff
command
精彩评论