You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by sebb <se...@gmail.com> on 2012/01/20 16:27:44 UTC

Restricting svn log --diff output to single file

The command
    svn log filename
shows a list of revisions in which filename was changed.

I would expect
    svn log --diff filename
to only show the differences for that file.

However, it shows the differences for all files changed in each revision.
Is that really intentional?
If so, how can I restrict the differences to just a single file?

I am using:

svn, version 1.7.2 (r1207936)
   compiled Nov 29 2011, 22:11:2

Try the following examples:

$ svn log -l2 http://svn.apache.org/repos/asf/subversion/branches/1.0.x/@848689
-qv

r848689 | sussman | 2004-02-11 22:01:13 +0000 (Wed, 11 Feb 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
------------------------------------------------------------------------
r848664 | kfogel | 2004-02-09 22:51:34 +0000 (Mon, 09 Feb 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
   M /subversion/branches/1.0.x/packages/win32-innosetup/Pre.rtf
   M /subversion/branches/1.0.x/packages/win32-innosetup/Readme.txt
   M /subversion/branches/1.0.x/packages/win32-innosetup/W32notes.txt
   A /subversion/branches/1.0.x/packages/win32-innosetup/is_main.pas
(from /subversion/trunk/packages/win32-innosetup/is_main.pas:848450)
   D /subversion/branches/1.0.x/packages/win32-innosetup/isx_main.pas
   M /subversion/branches/1.0.x/packages/win32-innosetup/svn.iss
   M /subversion/branches/1.0.x/packages/win32-innosetup/templates/paths_inno_src.iss
   M /subversion/branches/1.0.x/packages/win32-innosetup/tools/mk_distro.pl
   M /subversion/branches/1.0.x/packages/win32-innosetup/tools/mk_htmlhelp.bat
   M /subversion/branches/1.0.x/packages/win32-innosetup/tools/svnpath/main.c
------------------------------------------------------------------------

$ svn log -l2 http://svn.apache.org/repos/asf/subversion/branches/1.0.x/@848689
--diff

Index: STATUS
===================================================================
--- STATUS	(revision 848688)
+++ STATUS	(revision 848689)
<snip/>
Index: STATUS
===================================================================
--- STATUS	(revision 848663)
+++ STATUS	(revision 848664)
<snip/>
Index: packages/win32-innosetup/isx_main.pas (deleted)
===================================================================
Index: packages/win32-innosetup/Pre.rtf
===================================================================
--- packages/win32-innosetup/Pre.rtf	(revision 848663)
+++ packages/win32-innosetup/Pre.rtf	(revision 848664)
<snip/>

Re: Restricting svn log --diff output to single file

Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/1/20 sebb <se...@gmail.com>:
> On 20 January 2012 16:07, Stefan Sperling <st...@elego.de> wrote:
>> On Fri, Jan 20, 2012 at 03:54:37PM +0000, sebb wrote:
>>> Note that r848598 involves a directory copy.
>>>
>>> The diff command:
>>>
>>> $ svn log -l14 http://svn.apache.org/repos/asf/subversion/branches/1.0.x/STATUS@848689
>>> --diff
>>>
>>> behaves properly up to that point, but then I get:
>>>
>>> >>>
>>> r848598 | kfogel | 2004-01-27 17:08:24 +0000 (Tue, 27 Jan 2004) | 1 line
>>>
>>> Rename branches/1.0-stabilization to branches/1.0.x, as Brane suggested.
>>>
>>>
>>> Index: 1.0-stabilization/Makefile.in
>>> ===================================================================
>>> --- 1.0-stabilization/Makefile.in     (revision 848574)
>>> +++ 1.0-stabilization/Makefile.in     (revision 848575)
>>>
>>> <snip other file diffs/>
>>>
>>> <<<
>>>
>>> So it looks as though diff is broken when handling directory copies.
>>
>> This is a known problem. It has already been fixed in trunk, and the fix
>> has been nominated for backport. It will likely be included in 1.7.3.
>
> OK, thanks.
>
> In case it helps anyone else in the meantime, I've managed to get
> round the bug by using
>    svn log --diff --stop-on-copy url-path-to-file@version
> for each section of the files history (i.e. between copies)
>
> The relevant urls and versions can be found from:
>    svn log -qv filename | grep " (from "
> which shows all the copy commands, for example:
>   A /subversion/branches/1.0.x (from
> /subversion/branches/1.0-stabilization:848597)
>
> Unfortunately it also shows individual file copies which aren't
> relevant, but this can be worked round.

Note, that you can also get diff for particular revision of a file
using "svn diff -c"

E.g.
svn diff -c r848689
http://svn.apache.org/repos/asf/subversion/branches/1.0.x/STATUS@848689

Though this command shows less information than svn log --diff.

Best regards,
Konstantin Kolinko

Re: Restricting svn log --diff output to single file

Posted by sebb <se...@gmail.com>.
On 20 January 2012 16:07, Stefan Sperling <st...@elego.de> wrote:
> On Fri, Jan 20, 2012 at 03:54:37PM +0000, sebb wrote:
>> Note that r848598 involves a directory copy.
>>
>> The diff command:
>>
>> $ svn log -l14 http://svn.apache.org/repos/asf/subversion/branches/1.0.x/STATUS@848689
>> --diff
>>
>> behaves properly up to that point, but then I get:
>>
>> >>>
>> r848598 | kfogel | 2004-01-27 17:08:24 +0000 (Tue, 27 Jan 2004) | 1 line
>>
>> Rename branches/1.0-stabilization to branches/1.0.x, as Brane suggested.
>>
>>
>> Index: 1.0-stabilization/Makefile.in
>> ===================================================================
>> --- 1.0-stabilization/Makefile.in     (revision 848574)
>> +++ 1.0-stabilization/Makefile.in     (revision 848575)
>>
>> <snip other file diffs/>
>>
>> <<<
>>
>> So it looks as though diff is broken when handling directory copies.
>
> This is a known problem. It has already been fixed in trunk, and the fix
> has been nominated for backport. It will likely be included in 1.7.3.

OK, thanks.

In case it helps anyone else in the meantime, I've managed to get
round the bug by using
    svn log --diff --stop-on-copy url-path-to-file@version
for each section of the files history (i.e. between copies)

The relevant urls and versions can be found from:
    svn log -qv filename | grep " (from "
which shows all the copy commands, for example:
   A /subversion/branches/1.0.x (from
/subversion/branches/1.0-stabilization:848597)

Unfortunately it also shows individual file copies which aren't
relevant, but this can be worked round.

Re: Restricting svn log --diff output to single file

Posted by Stefan Sperling <st...@elego.de>.
On Fri, Jan 20, 2012 at 03:54:37PM +0000, sebb wrote:
> Note that r848598 involves a directory copy.
> 
> The diff command:
> 
> $ svn log -l14 http://svn.apache.org/repos/asf/subversion/branches/1.0.x/STATUS@848689
> --diff
> 
> behaves properly up to that point, but then I get:
> 
> >>>
> r848598 | kfogel | 2004-01-27 17:08:24 +0000 (Tue, 27 Jan 2004) | 1 line
> 
> Rename branches/1.0-stabilization to branches/1.0.x, as Brane suggested.
> 
> 
> Index: 1.0-stabilization/Makefile.in
> ===================================================================
> --- 1.0-stabilization/Makefile.in	(revision 848574)
> +++ 1.0-stabilization/Makefile.in	(revision 848575)
> 
> <snip other file diffs/>
> 
> <<<
> 
> So it looks as though diff is broken when handling directory copies.

This is a known problem. It has already been fixed in trunk, and the fix
has been nominated for backport. It will likely be included in 1.7.3.

Re: Restricting svn log --diff output to single file

Posted by sebb <se...@gmail.com>.
On 20 January 2012 15:36, Stephen Butler <sb...@elego.de> wrote:
>
> On Jan 20, 2012, at 16:27 , sebb wrote:
>
>> The command
>>    svn log filename
>> shows a list of revisions in which filename was changed.
>>
>> I would expect
>>    svn log --diff filename
>> to only show the differences for that file.
>>
>> However, it shows the differences for all files changed in each revision.
>> Is that really intentional?
>> If so, how can I restrict the differences to just a single file?
>>
>> I am using:
>>
>> svn, version 1.7.2 (r1207936)
>>   compiled Nov 29 2011, 22:11:2
>>
>> Try the following examples:
>>
>> $ svn log -l2 http://svn.apache.org/repos/asf/subversion/branches/1.0.x/@848689
>> -qv
>>
> [...]
>>
>> $ svn log -l2 http://svn.apache.org/repos/asf/subversion/branches/1.0.x/@848689
>> --diff
>
>
> Have you tried the full path to the file?  The following works for me:
>
>  $ svn log -l2 http://svn.apache.org/repos/asf/subversion/branches/1.0.x/STATUS@848689 --diff

Sorry, was trying lots of things and posted the wrong example, I did
try with the file name:

svn log -l14 http://svn.apache.org/repos/asf/subversion/branches/1.0.x/STATUS@848689
-qv

r848689 | sussman | 2004-02-11 22:01:13 +0000 (Wed, 11 Feb 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
------------------------------------------------------------------------
r848664 | kfogel | 2004-02-09 22:51:34 +0000 (Mon, 09 Feb 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
   M /subversion/branches/1.0.x/packages/win32-innosetup/Pre.rtf
   M /subversion/branches/1.0.x/packages/win32-innosetup/Readme.txt
   M /subversion/branches/1.0.x/packages/win32-innosetup/W32notes.txt
   A /subversion/branches/1.0.x/packages/win32-innosetup/is_main.pas
(from /subversion/trunk/packages/win32-innosetup/is_main.pas:848450)
   D /subversion/branches/1.0.x/packages/win32-innosetup/isx_main.pas
   M /subversion/branches/1.0.x/packages/win32-innosetup/svn.iss
   M /subversion/branches/1.0.x/packages/win32-innosetup/templates/paths_inno_src.iss
   M /subversion/branches/1.0.x/packages/win32-innosetup/tools/mk_distro.pl
   M /subversion/branches/1.0.x/packages/win32-innosetup/tools/mk_htmlhelp.bat
   M /subversion/branches/1.0.x/packages/win32-innosetup/tools/svnpath/main.c
------------------------------------------------------------------------
r848663 | kfogel | 2004-02-09 22:41:36 +0000 (Mon, 09 Feb 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
------------------------------------------------------------------------
r848660 | sussman | 2004-02-09 17:15:44 +0000 (Mon, 09 Feb 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
------------------------------------------------------------------------
r848649 | dlr | 2004-02-06 19:41:36 +0000 (Fri, 06 Feb 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
------------------------------------------------------------------------
r848644 | dlr | 2004-02-06 07:22:41 +0000 (Fri, 06 Feb 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
------------------------------------------------------------------------
r848642 | blair | 2004-02-06 00:49:19 +0000 (Fri, 06 Feb 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
------------------------------------------------------------------------
r848641 | kfogel | 2004-02-05 22:53:41 +0000 (Thu, 05 Feb 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
------------------------------------------------------------------------
r848640 | sussman | 2004-02-05 22:07:00 +0000 (Thu, 05 Feb 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
------------------------------------------------------------------------
r848605 | kfogel | 2004-01-27 20:50:59 +0000 (Tue, 27 Jan 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
------------------------------------------------------------------------
r848604 | josander | 2004-01-27 20:29:18 +0000 (Tue, 27 Jan 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
------------------------------------------------------------------------
r848600 | kfogel | 2004-01-27 18:29:48 +0000 (Tue, 27 Jan 2004)
Changed paths:
   M /subversion/branches/1.0.x/STATUS
------------------------------------------------------------------------
r848598 | kfogel | 2004-01-27 17:08:24 +0000 (Tue, 27 Jan 2004)
Changed paths:
   D /subversion/branches/1.0-stabilization
   A /subversion/branches/1.0.x (from
/subversion/branches/1.0-stabilization:848597)
------------------------------------------------------------------------
r848575 | kfogel | 2004-01-24 17:46:46 +0000 (Sat, 24 Jan 2004)
Changed paths:
   M /subversion/branches/1.0-stabilization/Makefile.in
   M /subversion/branches/1.0-stabilization/STATUS
   M /subversion/branches/1.0-stabilization/build/ac-macros/swig.m4
   M /subversion/branches/1.0-stabilization/packages/rpm/mandrake-9.0/Makefile
   M /subversion/branches/1.0-stabilization/packages/rpm/mandrake-9.1/Makefile
   M /subversion/branches/1.0-stabilization/packages/rpm/mandrake-9.2/Makefile
   M /subversion/branches/1.0-stabilization/subversion/bindings/swig/INSTALL
   M /subversion/branches/1.0-stabilization/subversion/bindings/swig/README
   M /subversion/branches/1.0-stabilization/subversion/bindings/swig/perl/Makefile.PL
   M /subversion/branches/1.0-stabilization/subversion/bindings/swig/swigutil_pl.h
   M /subversion/branches/1.0-stabilization/subversion/bindings/swig/swigutil_py.h
------------------------------------------------------------------------

Note that r848598 involves a directory copy.

The diff command:

$ svn log -l14 http://svn.apache.org/repos/asf/subversion/branches/1.0.x/STATUS@848689
--diff

behaves properly up to that point, but then I get:

>>>
r848598 | kfogel | 2004-01-27 17:08:24 +0000 (Tue, 27 Jan 2004) | 1 line

Rename branches/1.0-stabilization to branches/1.0.x, as Brane suggested.


Index: 1.0-stabilization/Makefile.in
===================================================================
--- 1.0-stabilization/Makefile.in	(revision 848574)
+++ 1.0-stabilization/Makefile.in	(revision 848575)

<snip other file diffs/>

<<<

So it looks as though diff is broken when handling directory copies.

> Regards,
> Steve

Re: Restricting svn log --diff output to single file

Posted by Stephen Butler <sb...@elego.de>.
On Jan 20, 2012, at 16:27 , sebb wrote:

> The command
>    svn log filename
> shows a list of revisions in which filename was changed.
> 
> I would expect
>    svn log --diff filename
> to only show the differences for that file.
> 
> However, it shows the differences for all files changed in each revision.
> Is that really intentional?
> If so, how can I restrict the differences to just a single file?
> 
> I am using:
> 
> svn, version 1.7.2 (r1207936)
>   compiled Nov 29 2011, 22:11:2
> 
> Try the following examples:
> 
> $ svn log -l2 http://svn.apache.org/repos/asf/subversion/branches/1.0.x/@848689
> -qv
> 
[...]
> 
> $ svn log -l2 http://svn.apache.org/repos/asf/subversion/branches/1.0.x/@848689
> --diff


Have you tried the full path to the file?  The following works for me:

  $ svn log -l2 http://svn.apache.org/repos/asf/subversion/branches/1.0.x/STATUS@848689 --diff

Regards,
Steve