You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Guillaume Chazarain <gu...@yahoo.fr> on 2004/12/19 14:04:19 UTC

svn annotate question

Hi !

I have some doubt about the behaviour of "svn annotate", hopefully 
someone can enlighten me.

Is this assertion true ?
    When "svn annotate" outputs a line with: $REV    $USER    $LINE
    it means that $REV is the biggest number so that "diff -r$((REV - 
1)):$REV"
    outputs a line containing "+$LINE"

If this assertion should be true, then I have an example in which it's 
false. I am sorry, it's
a bit contrived but I didn't manage to extract a simpler case. The 
problems lies within the
line named "9", the remaining is noise, or not ? I am using 
subversion-1.1.1 on linux.

So here it is :

[g ~/svn]$ svnadmin create repo  # It happens both with bdb and fsfs
[g ~/svn]$ bzcat svn_dump.bz2 | svnadmin load -q repo  # The attachment
[g ~/svn]$ svn annotate file://$PWD/repo/file
     5          g 0
     8          g 1
     7          g 3
     4          g 4
     2          g 6
     1          g 7
     8          g 8
     8          g 9       <============== So the line "9" was changed in r8
     3          g 15
     8          g 17
     6          g 18
[g ~/svn]$ svn diff -r7:8 file://$PWD/repo/file
Index: file
===================================================================
--- file        (revision 7)
+++ file        (revision 8)
@@ -1,9 +1,11 @@
 0
-j
+1
 3
 4
 6
 7
+8
 9                        <============== Seems not
 15
+17
 18
[g ~/svn]$ svn cat -r1 file://$PWD/repo/file   
j
7
9                         <============== It was there since the beginning

[g ~/svn]$ svn diff -r1:8 file://$PWD/repo/file
Index: file
===================================================================
--- file        (revision 1)
+++ file        (revision 8)
@@ -1,4 +1,11 @@
-j
+0
+1
+3
+4
+6
 7
+8
 9
-
+15
+17
+18


My intuition is that the line algorithm used by diff is not the same as 
the one used by annotate,
thus the discrepancy, but I hope I am wrong.

Thanks for any help.

-- 
Guillaume


[FIXED] Re: svn annotate question

Posted by Guillaume Chazarain <gu...@yahoo.fr>.
Guillaume Chazarain wrote :

> If this assertion should be true, then I have an example in which it's 
> false.


With subversion-1.1.2 it works fine.
I guess "* fixed: 'svn blame' algorithm bug (r11527)" is for something ...

I should have tested trunk/ before, sorry, and congratulations for the
great work.

-- 
Guillaume


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

Re: svn annotate question

Posted by Guillaume Chazarain <gu...@yahoo.fr>.
Patrick Smears wrote :

>I think that by "$LINE", Guillaume was referring to the _contents_ of the
>line, rather than the line number. So in this example, if the original
>
Yes, that what's I meant.
Sorry, the example was more contrived than what I thought :-(

-- 
Guillaume


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

RE: svn annotate question

Posted by Patrick Smears <pa...@ensoft.co.uk>.
> Consider adding lines 1 through 10 in rev 1.
> 
> In rev 2, add a line at the beginning of the file.
> 
> In rev 3, delete the first line of the file.
> 
> Now, "svn annotate" will tell you that the current line 1 was added in rev
> 1.  But the latest revision that added a line that was numbered 1 *in that
> revision* was rev 2.

I think that by "$LINE", Guillaume was referring to the _contents_ of the
line, rather than the line number. So in this example, if the original
file contains ten lines containing "line1" to "line10", and R2 adds (and
R3 removes) a line at the start containing "addedline", then Guillaume's
hypothesis is that the line containing "line1" will indeed be marked as
coming from R1, since that was the only revision that added a line
containing that string. (Possibly the example was confusing because the
content of each line was a number, which could all to easily be taken for
the number of that line!)

Patrick
-- 
The easy way to type accents in Windows: http://www.frkeys.com/


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

RE: svn annotate question

Posted by Dale Worley <dw...@pingtel.com>.
-----Original Message-----
From: Guillaume Chazarain [mailto:guichaz@yahoo.fr]

I have some doubt about the behaviour of "svn annotate", hopefully
someone can enlighten me.

Is this assertion true ?
    When "svn annotate" outputs a line with: $REV    $USER    $LINE
    it means that $REV is the biggest number so that "diff -r$((REV -
1)):$REV"
    outputs a line containing "+$LINE"
-----------------------------

No.

Consider adding lines 1 through 10 in rev 1.

In rev 2, add a line at the beginning of the file.

In rev 3, delete the first line of the file.

Now, "svn annotate" will tell you that the current line 1 was added in rev
1.  But the latest revision that added a line that was numbered 1 *in that
revision* was rev 2.

But why would you expect that to be true?

The underlying problem is that line numbers are transient things, the number
of a particular line of information changes when changes are done to other
parts of a file, and so a line's number will change all the time.

Dale


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