You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Wesley J Landaker <wj...@icecavern.net> on 2003/08/19 03:22:25 UTC

doing a diff between the trunk and a tag

Hi folks,

I've been using subversion for a while now, and I really like it. =) 

There is one thing that came up a bunch today a few times while I was 
trying to view some changes between various tags, and I wonder if there 
is a good way to do it that I'm missing:

In CVS, if I had TAG1 and TAG2, and I wanted to see what changed between 
them, I'd say:

cvs diff -rTAG1 -rTAG2

So in subversion, if I have:

/trunk
/branch/tag1
/branch/tag2

I basically wanted to do:

svn diff --old branch/tag1 --new branch/tag2

But of course, that doesn't actually work. ;)

What I ended up doing was:

svn log branch/tag1 (see what revision tag1 was created on)
svn log branch/tag2 (see what revision tag2 was created on)
svn diff -r<tag1-rev>:<tag2-rev> trunk

Is there an easier paradigm for doing a diff between tags or branches? 
Maybe some kind of:

svn merge --just-print-out-all-the-diffs-to-stdout-like-svn-diff-does

=)

-- 
Wesley J. Landaker - wjl@icecavern.net
OpenPGP FP: 4135 2A3B 4726 ACC5 9094  0097 F0A9 8A4C 4CD6 E3D2


Re: doing a diff between the trunk and a tag

Posted by Wesley J Landaker <wj...@icecavern.net>.
On Tuesday 19 August 2003 10:38 pm, John Szakmeister wrote:
> On Tuesday 19 August 2003 19:20, Wesley J Landaker wrote:
> [snip]
>
> > Take this tiny example:
> >
> > $ svn info
> > Path:
> > Url: file:///tmp/repos
> > Revision: 0
> > Node Kind: directory
> > Schedule: normal
> >
> > $ ls
> > branch/  trunk/
> >
> > $ ls branch
> > tag1/  tag2/
> >
> > $ svn diff --old=file:///tmp/repos/branch/tag1
> > --new=file:///tmp/repos/branch/tag2
> >
> > (that works)
> >
> > $ svn diff --old=branch/tag1 --new=branch/tag2
> > svn: Incorrect parameters given
> > svn: Sorry, svn_client_diff was called in a way that is not yet
> > supported.
> > svn: do_diff: paths aren't equal!
> >
> > (that doesn't work!)
>
> Hmmm.  I took another quick look at this, and from the error it
> implies that it only supports looking at a different version of the
> same file.  But what even more strange (in my mind anyways) is that
>
> svn diff branch/tag1 branch/tag2
>
> gives no output whatsoever.  This implies to me that the command
> found nothing different between the branches, which is clearly a bug.
>  It should either throw up the same error it did with the --old/--new
> or it should complain that branch/tag1 and branch/tag2 are not URLs
> (since usage 3 suggests that typing the targets in this way implies
> usage 3).

Actually, I think that without the --new and --old that is just diffing 
both tags2 individually against the latest revision (i.e. show me the 
local mods in both branches).

Although, I do admit that the first thing I tried was that syntax, 
before I realized what it was doing.

> I did a quick look through the issue tracker and don't see this
> listed. Perhaps this one should get listed?

Well, it seems like it should work with the --new/--old syntax with 
working directories like I mentioned before, so maybe that is an issue, 
but I think the "svn diff branch/tag1 branch/tag2" behavior actually 
does kind of make sense (otherwise, you couldn't do "svn diff *.txt" or 
something)

-- 
Wesley J. Landaker - wjl@icecavern.net
OpenPGP FP: 4135 2A3B 4726 ACC5 9094  0097 F0A9 8A4C 4CD6 E3D2


Re: doing a diff between the trunk and a tag

Posted by John Szakmeister <jo...@szakmeister.net>.
On Wednesday 20 August 2003 13:55, cmpilato@collab.net wrote:
> John Szakmeister <jo...@szakmeister.net> writes:
> > > Current, 'svn diff' doesn't support the comparitive working copy path
> > > case unless the paths being compared are the same and revision of one
> > > is BASE and the other is WORKING.
> >
> > The usage information seems to indicate that this should be supported,
> > although I do see in the code exactly what you are talking about.
>
> Yep.  And maybe one day it well.

:-)

> > > That means something different.  That means "show me my local mods in
> > > branch/tag1, and then show me my local mods in branch/tag2".
> >
> > Ah... That seems a little counter-intuitive.  As a user I'd expect this
> > to work exactly the same as usage case 3.
>
> We've been around this bush before, and I think you're outnumbered
> here.  For folks like me who often have multiple changes in progress
> in a given working copy, the ability to say 'svn diff
> subversion/libsvn_fs include/svn_fs.h subversion/tests/libsvn_fs >
> fs-changes.txt' is pretty valuable.[1]

I certain wasn't suggesting a change to it, just merely pointing out that it 
seemed inconsistent.

> > svn diff --new=my_checkout_repo/README \
> > --old=file://<path to repo>/branches/tag1/README
> >
> > From the usage description, I would expect that this should work as well,
> > although in my setup, it is producing no output, and no error.  If I
> > specify both with a URL I see the diff.  But if one or the other is a
> > working copy path, I get nothing.
>
> That might actually be a bug.  If you could send a small recipe using,
> say, the Subversion repository and a trunk checkout thereof, it would
> rock.

Hrmph.  Well, I've updated to the HEAD version, and I don't see this problem.  
Or perhaps I grew a brain, and I'm not doing something wrong anymore. :-)  
Whatever the case is, I can't reproduce the problem (although, I swear I did 
with svn 0.26).

> --
>
> [1] I made comments exactly opposite to this in previous threads on
>     'svn diff' syntax -- the behavior is so intuitive that I honestly
>     didn't realize that I ran 'svn diff' in this fashion *all the time*.

I must admit that until I tried doing something a little unusual, I didn't 
realize that I did the same as well. :-)

-John


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

Re: doing a diff between the trunk and a tag

Posted by Michael Wood <mw...@its.uct.ac.za>.
On Wed, Aug 20, 2003 at 12:55:37PM -0500, cmpilato@collab.net wrote:
> John Szakmeister <jo...@szakmeister.net> writes:
> 
> > > Current, 'svn diff' doesn't support the comparitive working copy path
> > > case unless the paths being compared are the same and revision of one
> > > is BASE and the other is WORKING.
> > 
> > The usage information seems to indicate that this should be supported, 
> > although I do see in the code exactly what you are talking about.
> 
> Yep.  And maybe one day it well.
[snip]

Oh God!  Didn't we have this discussion before? :)

-- 
Michael Wood <mw...@its.uct.ac.za>

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

Re: doing a diff between the trunk and a tag

Posted by cm...@collab.net.
John Szakmeister <jo...@szakmeister.net> writes:

> > Current, 'svn diff' doesn't support the comparitive working copy path
> > case unless the paths being compared are the same and revision of one
> > is BASE and the other is WORKING.
> 
> The usage information seems to indicate that this should be supported, 
> although I do see in the code exactly what you are talking about.

Yep.  And maybe one day it well.

> > That means something different.  That means "show me my local mods in
> > branch/tag1, and then show me my local mods in branch/tag2".
> 
> Ah... That seems a little counter-intuitive.  As a user I'd expect this to 
> work exactly the same as usage case 3.

We've been around this bush before, and I think you're outnumbered
here.  For folks like me who often have multiple changes in progress
in a given working copy, the ability to say 'svn diff
subversion/libsvn_fs include/svn_fs.h subversion/tests/libsvn_fs >
fs-changes.txt' is pretty valuable.[1]

> svn diff --new=my_checkout_repo/README \
> --old=file://<path to repo>/branches/tag1/README
> 
> From the usage description, I would expect that this should work as well, 
> although in my setup, it is producing no output, and no error.  If I specify 
> both with a URL I see the diff.  But if one or the other is a working copy 
> path, I get nothing.

That might actually be a bug.  If you could send a small recipe using,
say, the Subversion repository and a trunk checkout thereof, it would
rock.

--

[1] I made comments exactly opposite to this in previous threads on
    'svn diff' syntax -- the behavior is so intuitive that I honestly
    didn't realize that I ran 'svn diff' in this fashion *all the time*.

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

Re: doing a diff between the trunk and a tag

Posted by John Szakmeister <jo...@szakmeister.net>.
On Wednesday 20 August 2003 09:33, cmpilato@collab.net wrote:
> John Szakmeister <jo...@szakmeister.net> writes:
> > > $ svn diff --old=branch/tag1 --new=branch/tag2
> > > svn: Incorrect parameters given
> > > svn: Sorry, svn_client_diff was called in a way that is not yet
> > > supported.
> > > svn: do_diff: paths aren't equal!
> > >
> > > (that doesn't work!)
> >
> > Hmmm.  I took another quick look at this, and from the error it implies
> > that it only supports looking at a different version of the same file.
>
> Current, 'svn diff' doesn't support the comparitive working copy path
> case unless the paths being compared are the same and revision of one
> is BASE and the other is WORKING.

The usage information seems to indicate that this should be supported, 
although I do see in the code exactly what you are talking about.

>
> > svn diff branch/tag1 branch/tag2
>
> That means something different.  That means "show me my local mods in
> branch/tag1, and then show me my local mods in branch/tag2".

Ah... That seems a little counter-intuitive.  As a user I'd expect this to 
work exactly the same as usage case 3.

> > I did a quick look through the issue tracker and don't see this listed.
> > Perhaps this one should get listed?
>
> Nope.  You gotta understand the "expected" before claiming a differing
> "actual".

I agree to that assesment. :-)

> If you want to file a feature request for the working copy
> comparitive case, have at it -- but I'll toss into Post-1.0
> immediately.  Why?  Ever heard of "diff -ru --exclude '.svn'"?

I can live with that too.  But I feel as if 'svn diff' is claiming to do 
something that it cannot, and I feel that is misleading to the end users.  
Also, what's not clear to me is that in usage case 1, is it okay to do:

svn diff --new=my_checkout_repo/README \
--old=file://<path to repo>/branches/tag1/README

Re: doing a diff between the trunk and a tag

Posted by cm...@collab.net.
John Szakmeister <jo...@szakmeister.net> writes:

> > $ svn diff --old=branch/tag1 --new=branch/tag2
> > svn: Incorrect parameters given
> > svn: Sorry, svn_client_diff was called in a way that is not yet
> > supported.
> > svn: do_diff: paths aren't equal!
> >
> > (that doesn't work!)
> 
> Hmmm.  I took another quick look at this, and from the error it implies that 
> it only supports looking at a different version of the same file.

Current, 'svn diff' doesn't support the comparitive working copy path
case unless the paths being compared are the same and revision of one
is BASE and the other is WORKING.

> svn diff branch/tag1 branch/tag2

That means something different.  That means "show me my local mods in
branch/tag1, and then show me my local mods in branch/tag2".

> I did a quick look through the issue tracker and don't see this listed.  
> Perhaps this one should get listed?

Nope.  You gotta understand the "expected" before claiming a differing
"actual".  If you want to file a feature request for the working copy
comparitive case, have at it -- but I'll toss into Post-1.0
immediately.  Why?  Ever heard of "diff -ru --exclude '.svn'"?

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

Re: doing a diff between the trunk and a tag

Posted by John Szakmeister <jo...@szakmeister.net>.
On Tuesday 19 August 2003 19:20, Wesley J Landaker wrote:
[snip]
> Take this tiny example:
>
> $ svn info
> Path:
> Url: file:///tmp/repos
> Revision: 0
> Node Kind: directory
> Schedule: normal
>
> $ ls
> branch/  trunk/
>
> $ ls branch
> tag1/  tag2/
>
> $ svn diff --old=file:///tmp/repos/branch/tag1
> --new=file:///tmp/repos/branch/tag2
>
> (that works)
>
> $ svn diff --old=branch/tag1 --new=branch/tag2
> svn: Incorrect parameters given
> svn: Sorry, svn_client_diff was called in a way that is not yet
> supported.
> svn: do_diff: paths aren't equal!
>
> (that doesn't work!)

Hmmm.  I took another quick look at this, and from the error it implies that 
it only supports looking at a different version of the same file.  But what 
even more strange (in my mind anyways) is that

svn diff branch/tag1 branch/tag2

gives no output whatsoever.  This implies to me that the command found nothing 
different between the branches, which is clearly a bug.  It should either 
throw up the same error it did with the --old/--new or it should complain 
that branch/tag1 and branch/tag2 are not URLs (since usage 3 suggests that 
typing the targets in this way implies usage 3).

I did a quick look through the issue tracker and don't see this listed.  
Perhaps this one should get listed?

-John


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

Re: doing a diff between the trunk and a tag

Posted by John Szakmeister <jo...@szakmeister.net>.
On Tuesday 19 August 2003 19:20, Wesley J Landaker wrote:
> On Tuesday 19 August 2003 3:54 am, John Szakmeister wrote:
> > On Monday 18 August 2003 23:22, Wesley J Landaker wrote:
> > > There is one thing that came up a bunch today a few times while I
> > > was trying to view some changes between various tags, and I wonder
> > > if there is a good way to do it that I'm missing:
> > >
> > > In CVS, if I had TAG1 and TAG2, and I wanted to see what changed
> > > between them, I'd say:
> > >
> > > cvs diff -rTAG1 -rTAG2
> > >
> > > So in subversion, if I have:
> > >
> > > /trunk
> > > /branch/tag1
> > > /branch/tag2
> > >
> > > I basically wanted to do:
> > >
> > > svn diff --old branch/tag1 --new branch/tag2
> >
> > It appears that the way you typed this that branch/tag1 and
> > branch/tag2 are in your working copy.  That's probably not the case.
>
> No, I really do have them all in my working copy. I use branches and
> tags *reeeeallly* heavily in some projects, so I'll often check out my
> working directory from the repository root.

Wow.  I honestly don't know why that doesn't work then... Hmmm, maybe I'll 
fire up gdb and take a look at that.  It sounds like a bug to me... or as the 
error says, it just hasn't been implemented yet.  I'm going to let one of the 
more active Subversion developers answer this one.

> > You could do this though:
> >
> > svn diff --old=http://my.svnrepo.com/branch/tag1  \
> >   --new=http://my.svnrepo.com/branch/tag2
> >
> > This would perform a diff between HEAD revisions of each branch in
> > the repo.
>
> This does work, why doesn't this work giving working copies instead?
>
> Take this tiny example:
>
> $ svn info
> Path:
> Url: file:///tmp/repos
> Revision: 0
> Node Kind: directory
> Schedule: normal
>
> $ ls
> branch/  trunk/
>
> $ ls branch
> tag1/  tag2/
>
> $ svn diff --old=file:///tmp/repos/branch/tag1
> --new=file:///tmp/repos/branch/tag2
>
> (that works)
>
> $ svn diff --old=branch/tag1 --new=branch/tag2
> svn: Incorrect parameters given
> svn: Sorry, svn_client_diff was called in a way that is not yet
> supported.
> svn: do_diff: paths aren't equal!
>
> (that doesn't work!)
>
> It seems like it should, because of the following from 'svn diff
> --help':
>
> diff (di): display the differences between two paths.
> usage: 1. diff [-r N[:M]] [--old OLD-TGT] [--new NEW-TGT] [PATH ...]
>        2. diff -r N:M URL
>        3. diff [-r N[:M]] URL1[@N] URL2[@M]
>
>   1. Display the differences between OLD-TGT and NEW-TGT.  PATHs, if
>      given, are relative to OLD-TGT and NEW-TGT and restrict the output
>      to differences for those paths.  ***OLD-TGT and NEW-TGT may be
>      working copy paths or URL[@REV].*** (emphasis mine)
>
>      OLD-TGT defaults to the path '.' and NEW-TGT defaults to OLD-TGT.
>      N defaults to "BASE" or, if OLD-TGT is an URL, to "HEAD".
>      M defaults to the current working version or, if NEW-TGT is an URL,
>      to "HEAD".
>
>      '-r N' sets the revision of OLD-TGT to N, '-r N:M' also sets the
>      revision of NEW-TGT to M.
>
>
> In #1, this seems to say pretty clearly that it can be a URL or a
> working version. Maybe this is a bug or a "wishlist" kind of feature,
> but it seems like the documentation supports this format.

I'd agree.  I'll try and investigate this a little bit.

> Anyway, thanks for the message. I can at least do what I need to with
> the longer URI format, but it seems like it should work this other way
> as well, since I have all the branches checked out.

-John


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

Re: doing a diff between the trunk and a tag

Posted by Wesley J Landaker <wj...@icecavern.net>.
On Tuesday 19 August 2003 3:54 am, John Szakmeister wrote:
> On Monday 18 August 2003 23:22, Wesley J Landaker wrote:
> > There is one thing that came up a bunch today a few times while I
> > was trying to view some changes between various tags, and I wonder
> > if there is a good way to do it that I'm missing:
> >
> > In CVS, if I had TAG1 and TAG2, and I wanted to see what changed
> > between them, I'd say:
> >
> > cvs diff -rTAG1 -rTAG2
> >
> > So in subversion, if I have:
> >
> > /trunk
> > /branch/tag1
> > /branch/tag2
> >
> > I basically wanted to do:
> >
> > svn diff --old branch/tag1 --new branch/tag2
>
> It appears that the way you typed this that branch/tag1 and
> branch/tag2 are in your working copy.  That's probably not the case.

No, I really do have them all in my working copy. I use branches and 
tags *reeeeallly* heavily in some projects, so I'll often check out my 
working directory from the repository root.

> You could do this though:
>
> svn diff --old=http://my.svnrepo.com/branch/tag1  \
>   --new=http://my.svnrepo.com/branch/tag2
>
> This would perform a diff between HEAD revisions of each branch in
> the repo.

This does work, why doesn't this work giving working copies instead?

Take this tiny example:

$ svn info
Path:
Url: file:///tmp/repos
Revision: 0
Node Kind: directory
Schedule: normal

$ ls
branch/  trunk/

$ ls branch
tag1/  tag2/

$ svn diff --old=file:///tmp/repos/branch/tag1 
--new=file:///tmp/repos/branch/tag2

(that works)

$ svn diff --old=branch/tag1 --new=branch/tag2
svn: Incorrect parameters given
svn: Sorry, svn_client_diff was called in a way that is not yet 
supported.
svn: do_diff: paths aren't equal!

(that doesn't work!)

It seems like it should, because of the following from 'svn diff 
--help':

diff (di): display the differences between two paths.
usage: 1. diff [-r N[:M]] [--old OLD-TGT] [--new NEW-TGT] [PATH ...]
       2. diff -r N:M URL
       3. diff [-r N[:M]] URL1[@N] URL2[@M]

  1. Display the differences between OLD-TGT and NEW-TGT.  PATHs, if
     given, are relative to OLD-TGT and NEW-TGT and restrict the output
     to differences for those paths.  ***OLD-TGT and NEW-TGT may be   
     working copy paths or URL[@REV].*** (emphasis mine)

     OLD-TGT defaults to the path '.' and NEW-TGT defaults to OLD-TGT.
     N defaults to "BASE" or, if OLD-TGT is an URL, to "HEAD".
     M defaults to the current working version or, if NEW-TGT is an URL,
     to "HEAD".

     '-r N' sets the revision of OLD-TGT to N, '-r N:M' also sets the
     revision of NEW-TGT to M.


In #1, this seems to say pretty clearly that it can be a URL or a 
working version. Maybe this is a bug or a "wishlist" kind of feature, 
but it seems like the documentation supports this format.

Anyway, thanks for the message. I can at least do what I need to with 
the longer URI format, but it seems like it should work this other way 
as well, since I have all the branches checked out.

-- 
Wesley J. Landaker - wjl@icecavern.net
OpenPGP FP: 4135 2A3B 4726 ACC5 9094  0097 F0A9 8A4C 4CD6 E3D2


Re: doing a diff between the trunk and a tag

Posted by John Szakmeister <jo...@szakmeister.net>.
On Monday 18 August 2003 23:22, Wesley J Landaker wrote:
> Hi folks,
>
> I've been using subversion for a while now, and I really like it. =)

Me too! :-)

>
> There is one thing that came up a bunch today a few times while I was
> trying to view some changes between various tags, and I wonder if there
> is a good way to do it that I'm missing:
>
> In CVS, if I had TAG1 and TAG2, and I wanted to see what changed between
> them, I'd say:
>
> cvs diff -rTAG1 -rTAG2
>
> So in subversion, if I have:
>
> /trunk
> /branch/tag1
> /branch/tag2
>
> I basically wanted to do:
>
> svn diff --old branch/tag1 --new branch/tag2

It appears that the way you typed this that branch/tag1 and branch/tag2 are in 
your working copy.  That's probably not the case.

You could do this though:

svn diff --old=http://my.svnrepo.com/branch/tag1  \
  --new=http://my.svnrepo.com/branch/tag2

This would perform a diff between HEAD revisions of each branch in the repo.
 
-John


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