You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Andrey Repin <an...@freemail.ru> on 2009/04/03 18:01:18 UTC
Is there a way to unset the built-in -u option to diff command?
Greetings, All!
I'm exhausted of ideas...
I want diff command to simple show the changed lines as per diff -cb or diff -b
Any way to unset built-in -u flag? It does set it even to the external diff command...
--
WBR,
Andrey Repin (anrdaemon@freemail.ru) 03.04.2009, <21:29>
Sorry for my terrible english...
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1534350
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: Is there a way to unset the built-in -u option to diff command?
Posted by Stefan Sperling <st...@elego.de>.
On Fri, Apr 03, 2009 at 04:15:27PM -0400, Paul Koning wrote:
> >>>>> "Stefan" == Stefan Sperling <st...@elego.de> writes:
>
> Stefan> On Fri, Apr 03, 2009 at 02:57:24PM -0400, Paul Koning wrote:
> >> >>>>> "Hari" == Hari Kodungallur <hk...@gmail.com> writes:
> >>
> >> > I am not sure if you are looking for something similar, but if >
> >> you pass the following, it shows the unified diff with only the >
> >> changed line. > --diff-cmd diff -x "--unified=0"
> >>
> >> The problem is that you can't get rid of the -u. Essentially, SVN
> >> assumes that all possible things you might supply as diff-cmd are
> >> like GNU diff. If you want to call a diff program for which -u
> >> isn't a valid switch, you're stuck, short of wrapping it in a
> >> script to get rid of the invalid swich.
> >>
> >> An example is xxdiff.
>
> Stefan> I cannot reproduce this problem:
>
> Ok, I did some more testing. It may be that this existed in the first
> svn I used (v1.2.3). WIth -x it works in v1.4.4, at least in the
> sense that the -u goes away.
>
> However, the -L does not go away, and xxdiff doesn't like -L either.
> I think minimally there needs to be a way to say "don't give me ANY
> switches". More general would be a way to specify what switch token
> to use for what purpose. For example xxdiff wants --title1 and
> --title2 rather than the first and second -L.
Yes. I agree.
Stefan
Re: Is there a way to unset the built-in -u option to diff command?
Posted by Paul Koning <Pa...@dell.com>.
>>>>> "Stefan" == Stefan Sperling <st...@elego.de> writes:
Stefan> On Fri, Apr 03, 2009 at 02:57:24PM -0400, Paul Koning wrote:
>> >>>>> "Hari" == Hari Kodungallur <hk...@gmail.com> writes:
>>
>> > I am not sure if you are looking for something similar, but if >
>> you pass the following, it shows the unified diff with only the >
>> changed line. > --diff-cmd diff -x "--unified=0"
>>
>> The problem is that you can't get rid of the -u. Essentially, SVN
>> assumes that all possible things you might supply as diff-cmd are
>> like GNU diff. If you want to call a diff program for which -u
>> isn't a valid switch, you're stuck, short of wrapping it in a
>> script to get rid of the invalid swich.
>>
>> An example is xxdiff.
Stefan> I cannot reproduce this problem:
Ok, I did some more testing. It may be that this existed in the first
svn I used (v1.2.3). WIth -x it works in v1.4.4, at least in the
sense that the -u goes away.
However, the -L does not go away, and xxdiff doesn't like -L either.
I think minimally there needs to be a way to say "don't give me ANY
switches". More general would be a way to specify what switch token
to use for what purpose. For example xxdiff wants --title1 and
--title2 rather than the first and second -L.
paul
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1535326
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: Is there a way to unset the built-in -u option to diff command?
Posted by Stefan Sperling <st...@elego.de>.
On Fri, Apr 03, 2009 at 02:57:24PM -0400, Paul Koning wrote:
> >>>>> "Hari" == Hari Kodungallur <hk...@gmail.com> writes:
>
> > I am not sure if you are looking for something similar, but if
> > you pass the following, it shows the unified diff with only the
> > changed line.
> > --diff-cmd diff -x "--unified=0"
>
> The problem is that you can't get rid of the -u. Essentially, SVN
> assumes that all possible things you might supply as diff-cmd are like
> GNU diff. If you want to call a diff program for which -u isn't a
> valid switch, you're stuck, short of wrapping it in a script to get
> rid of the invalid swich.
>
> An example is xxdiff.
I cannot reproduce this problem:
$ cat ~/diffcmd.sh
#!/bin/sh
echo $*
$ svn diff --diff-cmd ~/diffcmd.sh -x '-p -x -w but not minus u' alpha
Index: alpha
===================================================================
-p -x -w but not minus u -L alpha (revision 2) -L alpha (working copy) .svn/text-base/alpha.svn-base /tmp/tempfile.tmp
$
It passes two -L flags (which might arguably be a problem), but not -u.
Stefan
Re: Is there a way to unset the built-in -u option to diff command?
Posted by Andrey Repin <an...@freemail.ru>.
Greetings, Andrey Repin!
> Moreover, the SVN behavior in this regard inconsistent.
> My tests to now:
> A. Using internal diff library.
1>> svn diff
> unified diff
2>> svn diff -x -b
> unified diff
2>> svn diff -x -cb
> svn: Error parsing diff options: Bad character specified on command line
> (expected, but quite disturbing, as this is most human-readable diff format)
> B. Using external diff (script
>> echo %* 1>&2
>> C:/bin/diff.exe %*
> so I can control the passed parameters)
1>> svn diff
> Parameters passed:
> -u -L "file1 (revision 9)" -L "file2 (working copy)" file1 file2
> unified diff
2>> svn diff -x -b
> Parameters passed:
> -b -L "file1 (revision 9)" -L "file2 (working copy)" file1 file2
> raw diff (lines removed-lines added)
2>> svn diff -x -cb
> Parameters passed:
> -cb -L "file1 (revision 9)" -L "file2 (working copy)" file1 file2
> contextual diff (lines changed-lines removed-lines added)
> And there's no way to set the external diff parameters in config. Or am I
> doing it wrong?
Based on this observation, I suggest to not pass -u to internal diff if an -x
specified, and implement config option to explicitly set the default options
for svn diff, being it internal or external diff, with "-u" as default option,
but accepting empty parameter set to disable it.
More correct way of doing this could be change in the way the external diff
program called, to pass only 2 compared files, leaving file descriptions as
optional 3&4 arguments, or tokenize the parameter, as follows:
diff-cmd = C:/bin/diff.exe -b -L "%olddesc" -L "%newdesc" -- %oldfile %newfile
--
WBR,
Andrey Repin (anrdaemon@freemail.ru) 04.04.2009, <0:30>
Sorry for my terrible english...
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1535475
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: Is there a way to unset the built-in -u option to diff command?
Posted by Andrey Repin <an...@freemail.ru>.
Greetings, Paul Koning!
>> I am not sure if you are looking for something similar, but if
>> you pass the following, it shows the unified diff with only the
>> changed line.
>> --diff-cmd diff -x "--unified=0"
> The problem is that you can't get rid of the -u. Essentially, SVN
> assumes that all possible things you might supply as diff-cmd are like
> GNU diff. If you want to call a diff program for which -u isn't a
> valid switch, you're stuck, short of wrapping it in a script to get
> rid of the invalid swich.
> An example is xxdiff.
Moreover, the SVN behavior in this regard inconsistent.
My tests to now:
A. Using internal diff library.
1> svn diff
unified diff
2> svn diff -x -b
unified diff
2> svn diff -x -cb
svn: Error parsing diff options: Bad character specified on command line
(expected, but quite disturbing, as this is most human-readable diff format)
B. Using external diff (script
> echo %* 1>&2
> C:/bin/diff.exe %*
so I can control the passed parameters)
1> svn diff
Parameters passed:
-u -L "file1 (revision 9)" -L "file2 (working copy)" file1 file2
unified diff
2> svn diff -x -b
Parameters passed:
-b -L "file1 (revision 9)" -L "file2 (working copy)" file1 file2
raw diff (lines removed-lines added)
2> svn diff -x -cb
Parameters passed:
-cb -L "file1 (revision 9)" -L "file2 (working copy)" file1 file2
contextual diff (lines changed-lines removed-lines added)
And there's no way to set the external diff parameters in config. Or am I
doing it wrong?
--
WBR,
Andrey Repin (anrdaemon@freemail.ru) 03.04.2009, <23:14>
Sorry for my terrible english...
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1535000
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: Is there a way to unset the built-in -u option to diff command?
Posted by Hari Kodungallur <hk...@gmail.com>.
On Fri, Apr 3, 2009 at 11:57 AM, Paul Koning <Pa...@dell.com> wrote:
> >>>>> "Hari" == Hari Kodungallur <hk...@gmail.com> writes:
>
> > I am not sure if you are looking for something similar, but if
> > you pass the following, it shows the unified diff with only the
> > changed line.
> > --diff-cmd diff -x "--unified=0"
>
> The problem is that you can't get rid of the -u. Essentially, SVN
> assumes that all possible things you might supply as diff-cmd are like
> GNU diff. If you want to call a diff program for which -u isn't a
> valid switch, you're stuck, short of wrapping it in a script to get
> rid of the invalid swich.
>
> An example is xxdiff.
>
>
>
Sorry, completely misread the question. I thought he wanted the unified diff
but with only the changed lines without the context. My bad.
That said, while the -c options is not recognized by svn's internal diff
command, if you use --diff-cmd and pass -x -cb as the OP wants, it should
work. At least it works for me.
thanks,
-Hari
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1535088
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: Is there a way to unset the built-in -u option to diff command?
Posted by Paul Koning <Pa...@dell.com>.
>>>>> "Hari" == Hari Kodungallur <hk...@gmail.com> writes:
> I am not sure if you are looking for something similar, but if
> you pass the following, it shows the unified diff with only the
> changed line.
> --diff-cmd diff -x "--unified=0"
The problem is that you can't get rid of the -u. Essentially, SVN
assumes that all possible things you might supply as diff-cmd are like
GNU diff. If you want to call a diff program for which -u isn't a
valid switch, you're stuck, short of wrapping it in a script to get
rid of the invalid swich.
An example is xxdiff.
paul
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1534756
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: Is there a way to unset the built-in -u option to diff command?
Posted by Hari Kodungallur <hk...@gmail.com>.
On Fri, Apr 3, 2009 at 11:44 AM, Andrey Repin <an...@freemail.ru> wrote:
> Greetings, Paul Koning!
>
> >> Greetings, All! I'm exhausted of ideas... I want diff
> >> command to simple show the changed lines as per diff -cb or
> >> diff -b Any way to unset built-in -u flag? It does set it
> >> even to the external diff command...
>
> > I mentioned that quite a while ago. It seems that the only way to do
> > it is to use a script as your external command, which strips out the
> > -u flag and passes only what you want to the real diff command.
>
> I could do that, however, but... it's not what I prefer to do every now and
> then.
>
> > This is an unfortunate bug.
>
> More like absence of a feature... at least in relation to builtin diff.
> For external program call, it is sure bug.
>
> Fake edit:
> After some research, the c:/bin/diff.bat with
> > shift
> > C:/bin/diff.exe %*
> did the trick. Thanks.
>
I am not sure if you are looking for something similar, but if you pass the
following, it shows the unified diff with only the changed line.
--diff-cmd diff -x "--unified=0"
thanks,
-Hari
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1534725
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: Is there a way to unset the built-in -u option to diff command?
Posted by Andrey Repin <an...@freemail.ru>.
Greetings, Paul Koning!
>> Greetings, All! I'm exhausted of ideas... I want diff
>> command to simple show the changed lines as per diff -cb or
>> diff -b Any way to unset built-in -u flag? It does set it
>> even to the external diff command...
> I mentioned that quite a while ago. It seems that the only way to do
> it is to use a script as your external command, which strips out the
> -u flag and passes only what you want to the real diff command.
I could do that, however, but... it's not what I prefer to do every now and
then.
> This is an unfortunate bug.
More like absence of a feature... at least in relation to builtin diff.
For external program call, it is sure bug.
Fake edit:
After some research, the c:/bin/diff.bat with
> shift
> C:/bin/diff.exe %*
did the trick. Thanks.
--
WBR,
Andrey Repin (anrdaemon@freemail.ru) 03.04.2009, <22:29>
Sorry for my terrible english...
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1534659
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
Re: Is there a way to unset the built-in -u option to diff command?
Posted by Paul Koning <Pa...@dell.com>.
>>>>> "Andrey" == Andrey Repin <an...@freemail.ru> writes:
Andrey> Greetings, All! I'm exhausted of ideas... I want diff
Andrey> command to simple show the changed lines as per diff -cb or
Andrey> diff -b Any way to unset built-in -u flag? It does set it
Andrey> even to the external diff command...
I mentioned that quite a while ago. It seems that the only way to do
it is to use a script as your external command, which strips out the
-u flag and passes only what you want to the real diff command.
This is an unfortunate bug.
paul
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1534398
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].