You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Jesse Barnum <wo...@360works.com> on 2005/03/25 03:52:18 UTC

svn external diff with non-local file fails?

I am pretty new to svn, so I apologize in advance if I am doing 
something wrong, but I've searched this mailing list and google and 
have not found an answer to my problem.

I have written a little shell wrapper, as many people have suggested, 
to pass diff arguments to my preferred diff utility (FileMerge on OS 
X).

As long as I'm doing a diff against the base version in my own 
repository, like this:

svn diff --diff-cmd /Users/jesse/.subversion/svndiff AdReqDetail.java

I get the 6th (.svn/text-base/AdReqDetail.java.svn-base) and 7th 
(AdReqDetail.java) parameters with the two filenames, pass them off, 
and everything is fine.

The problem is when I try to compare to a version on the server other 
than the base version. For example, when I use this command:

svn diff --diff-cmd /Users/jesse/.subversion/svndiff -r78 
AdReqDetail.java

The 6th parameter is now pulling from the tmp folder,  
'.svn/tmp/text-base/AdReqDetail.java.svn-base', and the file does not 
exist. FileMerge gives me an error because it can't read from the 
non-existent file.

My expectation is that Subversion should copy the necessary revision 
into that temp folder, and then call my diff utility. Is that how it is 
intended to work?

This is with svn, version 1.1.3 (r12730), Compiled Jan 16 2005, 23:38:26
I am running on Mac OS X 10.3.8.

--Jesse Barnum, CEO, 360Works
http://www.360works.com (866) 662-9185
Try WooF, the only solution for linking WebObjects and FileMaker!


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: svn external diff with non-local file fails? [SOLVED]

Posted by Ryan Schmidt <su...@ryandesign.com>.
On 26.03.2005, at 14:17, Jesse Barnum wrote:

> On Mar 25, 2005, at 6:13 PM, Marshall White wrote:
>
>> Subversion will delete the temporary files when your script exits.  
>> So, if
>> your script doesn't wait on FileMerge to exit before it does, the 
>> files can
>> disappear before FileMerge gets a chance to open them.
>
> Marshall, it looks like you're right about this. I changed my shell 
> script to copy the temp file to another file, instead of trying to 
> open it, and my shell script works now by opening this other temp 
> file. Thanks for your help!

See also the files svndiff.sh and svnfilemerge.sh (attached) from the 
svnX program which also does it this way.

It would seem to be the better solution to pass a switch to opendiff to 
tell it to wait for FileMerge to exit before returning, but there does 
not appear to be any such switch -- at least not that I can see from 
its brief usage message.


Re: svn external diff with non-local file fails? [SOLVED]

Posted by Jesse Barnum <wo...@360works.com>.
Marshall, it looks like you're right about this. I changed my shell 
script to copy the temp file to another file, instead of trying to open 
it, and my shell script works now by opening this other temp file. 
Thanks for your help!

--Jesse

On Mar 25, 2005, at 6:13 PM, Marshall White wrote:

> On Friday 25 March 2005 12:20 am, Jesse Barnum wrote:
>> Thanks for your fast response!
>>
>> I am just taking the arguments provided by subversion... when I wrote
>> that the file I was trying to open is
>> '.svn/tmp/text-base/AdReqDetail.java.svn-base', that is coming from
>> subversion - I didn't specifically go into that directory. The problem
>> is that this file1 argument being passed to my shell script is
>> referencing a non-existent file - when I try to pass it along to
>> FileMerge, I get an error that it could not be read, and when I look 
>> in
>> that directory after running the diff command, the directory is empty.
>>
>> Here is the complete list of arguments being passed to my script:
>>
>> jesse% svn diff --diff-cmd /Users/jesse/.subversion/svndiff -r78
>> AdReqDetail.java
>> Index: AdReqDetail.java
>> ===================================================================
>> ---Opening FileMerge---
>> -u -L AdReqDetail.java (revision 78) -L AdReqDetail.java (working 
>> copy)
>> .svn/tmp/text-base/AdReqDetail.java.svn-base AdReqDetail.java
>>
>> --Jesse
>>
>
>
> Subversion will delete the temporary files when your script exits.  
> So, if
> your script doesn't wait on FileMerge to exit before it does, the 
> files can
> disappear before FileMerge gets a chance to open them.
>
> Marshall


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: svn external diff with non-local file fails?

Posted by Marshall White <ma...@pobox.com>.
On Friday 25 March 2005 12:20 am, Jesse Barnum wrote:
> Thanks for your fast response!
>
> I am just taking the arguments provided by subversion... when I wrote
> that the file I was trying to open is
> '.svn/tmp/text-base/AdReqDetail.java.svn-base', that is coming from
> subversion - I didn't specifically go into that directory. The problem
> is that this file1 argument being passed to my shell script is
> referencing a non-existent file - when I try to pass it along to
> FileMerge, I get an error that it could not be read, and when I look in
> that directory after running the diff command, the directory is empty.
>
> Here is the complete list of arguments being passed to my script:
>
> jesse% svn diff --diff-cmd /Users/jesse/.subversion/svndiff -r78
> AdReqDetail.java
> Index: AdReqDetail.java
> ===================================================================
> ---Opening FileMerge---
> -u -L AdReqDetail.java (revision 78) -L AdReqDetail.java (working copy)
> .svn/tmp/text-base/AdReqDetail.java.svn-base AdReqDetail.java
>
> --Jesse
>


Subversion will delete the temporary files when your script exits.  So, if 
your script doesn't wait on FileMerge to exit before it does, the files can 
disappear before FileMerge gets a chance to open them.

Marshall

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: svn external diff with non-local file fails?

Posted by Jesse Barnum <wo...@360works.com>.
Thanks for your fast response!

I am just taking the arguments provided by subversion... when I wrote 
that the file I was trying to open is 
'.svn/tmp/text-base/AdReqDetail.java.svn-base', that is coming from 
subversion - I didn't specifically go into that directory. The problem 
is that this file1 argument being passed to my shell script is 
referencing a non-existent file - when I try to pass it along to 
FileMerge, I get an error that it could not be read, and when I look in 
that directory after running the diff command, the directory is empty.

Here is the complete list of arguments being passed to my script:

jesse% svn diff --diff-cmd /Users/jesse/.subversion/svndiff -r78 
AdReqDetail.java
Index: AdReqDetail.java
===================================================================
---Opening FileMerge---
-u -L AdReqDetail.java (revision 78) -L AdReqDetail.java (working copy) 
.svn/tmp/text-base/AdReqDetail.java.svn-base AdReqDetail.java

--Jesse

On Thursday, March 24, 2005, at 11:16  PM, Ben Collins-Sussman wrote:

>
> On Mar 24, 2005, at 9:52 PM, Jesse Barnum wrote:
>>
>> My expectation is that Subversion should copy the necessary revision 
>> into that temp folder, and then call my diff utility. Is that how it 
>> is intended to work?
>>
>
> I think you misunderstood what was meant when you were told to "write 
> a shell wrapper".
>
> It's absolutely none of your business how Subversion works under the 
> hood, and you should absolutely not be poking around in the .svn/ 
> directory, trying to second-guess what Subversion is doing.  :-)
>
> What we meant was:  write a script which rearranges the arguments 
> normally passed to GNU diff into an order that can be passed to 
> FileMerge.
>
> It's our fault:  we should have documented this in the book, and 
> haven't.  But if you look at the source code, Subversion is invoking 
> external diff programs like this:
>
>    diff -u -L leftlabel -L rightlabel file1 file2
>
> All you need to do is write a shell script to rearrange the incoming 
> args, and pass the ones you want to FileMerge.  Subversion will take 
> care of providing file1 and file2 for you.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: svn external diff with non-local file fails?

Posted by Ben Collins-Sussman <su...@collab.net>.
On Mar 24, 2005, at 9:52 PM, Jesse Barnum wrote:
>
> My expectation is that Subversion should copy the necessary revision 
> into that temp folder, and then call my diff utility. Is that how it 
> is intended to work?
>

I think you misunderstood what was meant when you were told to "write a 
shell wrapper".

It's absolutely none of your business how Subversion works under the 
hood, and you should absolutely not be poking around in the .svn/ 
directory, trying to second-guess what Subversion is doing.  :-)

What we meant was:  write a script which rearranges the arguments 
normally passed to GNU diff into an order that can be passed to 
FileMerge.

It's our fault:  we should have documented this in the book, and 
haven't.  But if you look at the source code, Subversion is invoking 
external diff programs like this:

    diff -u -L leftlabel -L rightlabel file1 file2

All you need to do is write a shell script to rearrange the incoming 
args, and pass the ones you want to FileMerge.  Subversion will take 
care of providing file1 and file2 for you.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org