Create an SVN patch, including new directories

First of all, excuse the long text, but I try to be as detailed as I can.

I am developing an open source project (DSpace). I do not have rights to their SVN repo, so I checked the source and used git for version control.

During my development, I added several directories and binaries to my project.

It's time to make an SVN patch file so that I can return something to the community! Netbeans does this for me through the Team-> Create patch option. So far so good ...

However, when I check the source again on another computer 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 

Script launch

When I run this script, everything goes well until the patch tries to modify the 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 can fix a bunch of files that were already in the original version of dspace, so I think this is not related to the -pXXX option of the patch command (nevertheless I tried before -p10) ... I think that this only happens when I try to fix a file inside one of my created directories. I assume that the patch command does not create new directories, so it cannot find the correct paths.

It drives me crazy, please, does anyone know how to solve my problem?

Thanks in advance!

EDIT:

I added the --verbose option to the patch command. Here is 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 completing the patch process, if I create

 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 that I added during development, which proves that the patch does not create these new folders.

+4
source share
1 answer

In the case of creating patches, which should include adding new files / directories, for a clean CLI with subversion you need to add the --git option to the svn diff

0
source

Source: https://habr.com/ru/post/1369042/


All Articles