You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Bob Proulx <bo...@proulx.com> on 2005/09/06 00:02:21 UTC

svn diff -r BASE:HEAD upside down in diff titles?

Are the diff titles upside down when using BASE:HEAD?

I created a test repository and added a two line file to it for this
test.  The file is just to have something semi-interesting in it.
This was actually found by one of the guys I work with in a larger
project context.

On a sample here I get:

  svn diff -r BASE:HEAD
  Index: testfile
  ===================================================================
  --- testfile    (revision 0)
  +++ testfile    (working copy)
  @@ -0,0 +1,2 @@
  +#!/usr/bin/env ruby
  +# A ruby script.

I believe the working copy is tagged to the wrong side of the diff.
The diff content data seems correct in both cases.  But the revisions
listed in the parens seem to be reversed.  Shouldn't that be the
following?  (BASE is 1 and HEAD is 2.)

  svn diff -r BASE:HEAD
  Index: testfile
  ===================================================================
  --- testfile    (working copy)
  +++ testfile    (revision 2)
  @@ -0,0 +1,2 @@
  +#!/usr/bin/env ruby
  +# A ruby script.

Then try it the other way around.  This looks okay.

  svn diff -r HEAD:BASE
  Index: testfile
  ===================================================================
  --- testfile    (revision 2)
  +++ testfile    (working copy)
  @@ -1,2 +0,0 @@
  -#!/usr/bin/env ruby
  -# A ruby script.

The titles there are matched appropriately.

Then try the same test with numbers.

  svn diff -r 1:2
  Index: testfile
  ===================================================================
  --- testfile    (revision 0)
  +++ testfile    (revision 2)
  @@ -0,0 +1,2 @@
  +#!/usr/bin/env ruby
  +# A ruby script.

And the other way around.

  svn diff -r 2:1
  Index: testfile
  ===================================================================
  --- testfile    (revision 2)
  +++ testfile    (revision 1)
  @@ -1,2 +0,0 @@
  -#!/usr/bin/env ruby
  -# A ruby script.

Those both seem "correct".  Shouldn't the numbers behave exactly the
same as the ones using BASE and HEAD?

I looked through the existing issues and could not find this listed
there.  Am I misunderstanding this case?

Actually I think I would prefer if the parens always listed the
revision numbers and never listed "working copy".  Although I don't
feel strongly and it does not really matter.  I just think that always
listing things the same way is cleaner and more consistent and so I
would prefer to always see the "revision #" there.

Thanks
Bob

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

Re: svn diff -r BASE:HEAD upside down in diff titles?

Posted by Bob Proulx <bo...@proulx.com>.
Joshua Varner wrote:
> export REPO=`(cd test-repos/; pwd)`

I have had various portability issues[1] with the above type of
construct.  In general I now avoid VAR=`cd dir ; pwd` as a way to get
the directory.  The above does not look too bad for this report but
let me suggest this instead:

  export REPO=$(pwd)/test-repos

I think it reads cleaner and avoids various issues.

Bob

[1] Think of what happens when CDPATH is set.  Think of running on a
BSD amd system with /.automount as the real mount point.  Things like
that.

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

Re: svn diff -r BASE:HEAD upside down in diff titles?

Posted by Joshua Varner <jl...@gmail.com>.
On 9/6/05, Bob Proulx <bo...@proulx.com> wrote:
> Madan U Sreenivasan wrote:
> > Bob Proulx wrote:
> > >   svn diff -r 1:2
> > >   Index: testfile
> > >   ===================================================================
> > >   --- testfile    (revision 0)
> > >   +++ testfile    (revision 2)
> > >   @@ -0,0 +1,2 @@
> > >   +#!/usr/bin/env ruby
> > >   +# A ruby script.
> >
> > Am wondering why a revision 0 is coming into the picture...
> 
> I believe the answer is that it is just how new files are encoded.
> The file is a new file. It did not exist in any previous revision.
> The earliest possible revision is revision 0 so that is used to
> represent the start of new files.  The revision 2 is where the file
> came into being.  I see revision 0 used with regards to new files.
> 
> But take that with caution as I am the one asking the original
> question!  :-)
> 

Revision 0 means the object did not exist in that particular
revision (either not yet added, or it had been deleted). I think
this is a bug though. What is probably happening is that, since
the object does not exist in BASE, it is setting the revision
number to 0, which is obviously not the same as the wc, so it
assumes the other one must be the wc's revision number.

The diff is done correctly but the heading is wrong. Attached is a script
reproduce. I think this is a bug, but a minor one. If someone wants
me too I will add this to the Issue Tracker.

Josh

Re: svn diff -r BASE:HEAD upside down in diff titles?

Posted by Bob Proulx <bo...@proulx.com>.
Madan U Sreenivasan wrote:
> Bob Proulx wrote:
> >   svn diff -r 1:2
> >   Index: testfile
> >   ===================================================================
> >   --- testfile    (revision 0)
> >   +++ testfile    (revision 2)
> >   @@ -0,0 +1,2 @@
> >   +#!/usr/bin/env ruby
> >   +# A ruby script.
> 
> Am wondering why a revision 0 is coming into the picture...

I believe the answer is that it is just how new files are encoded.
The file is a new file. It did not exist in any previous revision.
The earliest possible revision is revision 0 so that is used to
represent the start of new files.  The revision 2 is where the file
came into being.  I see revision 0 used with regards to new files.

But take that with caution as I am the one asking the original
question!  :-)

Bob

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

Re: svn diff -r BASE:HEAD upside down in diff titles?

Posted by Madan U Sreenivasan <ma...@collab.net>.
On Tue, 2005-09-06 at 05:32, Bob Proulx wrote:
> Are the diff titles upside down when using BASE:HEAD?
> I created a test repository and added a two line file to it for this
> test.  The file is just to have something semi-interesting in it.
> This was actually found by one of the guys I work with in a larger
> project context.
> 
> On a sample here I get:
> 
>   svn diff -r BASE:HEAD
>   Index: testfile
>   ===================================================================
>   --- testfile    (revision 0)
>   +++ testfile    (working copy)
>   @@ -0,0 +1,2 @@
>   +#!/usr/bin/env ruby
>   +# A ruby script.
> 
> I believe the working copy is tagged to the wrong side of the diff.
[snip]
> Then try the same test with numbers.
> 
>   svn diff -r 1:2
>   Index: testfile
>   ===================================================================
>   --- testfile    (revision 0)
>   +++ testfile    (revision 2)
>   @@ -0,0 +1,2 @@
>   +#!/usr/bin/env ruby
>   +# A ruby script.
[snip]
> Those both seem "correct".  Shouldn't the numbers behave exactly the
> same as the ones using BASE and HEAD?
Just pointing out... may not be related to your question or the answer
thereof...
  svn diff -r BASE:HEAD
  lists a revision 0.. what is this revision 0 ( I gather from your mail that your wc
  is at r1 and the HEAD is at r2. where is this 0 coming from?

  Same question with one of the number usage scenarios you are pointing out...

  svn diff -r 1:2
  Also lists a  revision 0.

Am wondering why a revision 0 is coming into the picture...

Regards,
Madan.


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