[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: git patch friendly question

From: asm <asmwarrior_at_gmail.com>
Date: Sat, 18 Aug 2012 17:26:14 +0800

On 2012-8-17 23:27, Stefan Küng wrote:
> On 17.08.2012 16:48, Yuanhui Zhang wrote:
>> Hi, I'm code::blocks developer, I use both tortoiseSVN(latest 1.7.8) and tortoiseGit for the development. The official Code::blocks use the SVN, but I sometimes use Git. When I would like to commit to the official SVN repo, what I would do is:
>> 1, create a patch in my git repo using the TortoiseGit.
>> 2, apply the patch in the local svn repo.
>> 3, commit the svn change to the remote servo.
>> But I have problems doing the second step. When I have a patch file create from git, I can't not directly apply the file by TortoiseSVN->Context Menu->Apply patch..., the TortoiseSVN always report a failure or did nothing, besides that, TortoiseSVN will create some empty dummy folder named "b" and "b/xxx".
>> What works for step two is one of the below way:
>> 1, I can use the svn command line, like: svn patch test.patch --strip 1
>> 2, I can use the "patch utility", like: patch -p1 <test.patch
>> Both of the above methods, I can directly apply the patch generated from the git without modifying the patch file.
>> So, my question is: can TortoiseSVN be more git patch friendly? Thanks.
>> We have a detailed discussion in Code::Blocks forum, see this link: http://forums.codeblocks.org/index.php/topic,16559.msg113716.html#msg113716
> Can you please send me:
> 1) an url where I can check out a test folder
> 2) a git patch that doesn't work with TMerge for that folder
> If I can reproduce the problem I might be able to fix it.
> Stefan
Hi, Stefan. Thanks.
Here is a simplified example which can reproduce this issue:

1, the url of the svn is below:
This is a sub folder of the codeblocks' source repo, you can just check out to local like:

2, I have two patches generated from the codeblocks' git repo, which is:git://cb.biplab.in/codeblocks.git
I just create two simple patches from the TortoiseGit.
a, changefile.patch: this patch just add two line in the file main.cpp
b, addnewfile.patch: this patch add a new file "hi.txt" in the ConsoleRunner
Both of the patches and the local ConsoleRunner files have CRLF EOF.

Test of patch utility:
1, I can use the patch utility to apply both patches
a, patch -p3 < changefile.patch --binary
b, patch -p3 < addnewfile.patch--binary
Note, "--binary" is necessary, because it avoid the patch utility to do a CRLF to LF conversion.
Note2, before running the patch utility, I put the two patches under "F:\test\svntest"

Test of the TortoiseSVN:
I just use TortoiseSVN->Context Menu->Apply patch, but failed.

Test of the svn command line:

F:\test\svntest\ConsoleRunner>svn patch ..\changefile.patch --strip 4
U main.cpp

F:\test\svntest\ConsoleRunner>svn patch ..\addnewfile.patch --strip 4
Skipped '.'
svn: E195018: Cannot strip 4 components from '\dev\null'
It looks like the svn command line does not under stand the "\dev\null" in the patch file.

The attachment is two simple patch files.

Thank you very much!

Yuanhui Zhang


To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].

Received on 2012-08-18 14:01:53 CEST

This is an archived mail posted to the TortoiseSVN Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.