You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Berlin <db...@dberlin.org> on 2005/02/15 21:06:38 UTC

linevector for backwards blame

This was described to me by someone who knows how cvs does backwards
annotating.
I'm not sure what CVS does to prevent memory explosion due to copying
the text, it must share the lines instead of malloc'ing them like i do
(or refcount them, but that could be expensive since you'd want to go
through the vector and free lines when you resized it)

Anyway, i tested this with something that just parses rcs diffs and
calls the linevector_add/delete calls in the right order, and the blame
came out right :)

All that should need to be done is what is described at the top of the
file, and we should be good to go.


Re: linevector for backwards blame

Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Wed, 16 Feb 2005, Daniel Berlin wrote:

> On Wed, 2005-02-16 at 08:37 +0100, Peter N. Lundblad wrote:
> > On Tue, 15 Feb 2005, Daniel Berlin wrote:
> >
> > > I've started to implement it.
> > > The real problem is that i have to read each file into an artificial
> > > buffer seperated by lines since diff gives me line numbers, but no text
> > > for the lines.
> > >
>
>
> > Noe that get_filerevs currently doesn't give revisions backwards.
> It does in my version :)
>
Fine. Don't forget about compatibility against 1.1 clients, though. I'll
wait for your patch.

Best,
//Peter

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

Re: linevector for backwards blame

Posted by Daniel Berlin <db...@dberlin.org>.
On Wed, 2005-02-16 at 08:37 +0100, Peter N. Lundblad wrote:
> On Tue, 15 Feb 2005, Daniel Berlin wrote:
> 
> > On Tue, 2005-02-15 at 20:05 -0500, Mark Benedetto King wrote:
> >
> > > This should not be difficult: the existing system just tracks everything
> > > by line number until it is time to output the blame, then it simply reads
> > > through the blamed revision (which exists in a temporary file) one line
> > > at a time, calling the blame callback as it goes.
> >
> >
> > I've started to implement it.
> > The real problem is that i have to read each file into an artificial
> > buffer seperated by lines since diff gives me line numbers, but no text
> > for the lines.
> >
> Mark's point was that you don't actually need the text of all the lines.
This is true, you could add fake lines :).
However, We don't fix it up on the fly, we actually add and delete the
lines diff by diff as we are processing blame to keep everything
straight. For purposes of comparing to the youngest revision, only
deletes matter (we diff youngest to next youngest, then next youngest to
next younger than that, etc. *not* the other way around).  So
theoretically, you could just add fake lines with no real data, since
even modifies are processed as "add/delete"



> All lines you are eventually going to output are in the youngest file, so
> just keep that file around ntil the bitter end.


> 
> Noe that get_filerevs currently doesn't give revisions backwards.
It does in my version :)



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

Re: linevector for backwards blame

Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Tue, 15 Feb 2005, Daniel Berlin wrote:

> On Tue, 2005-02-15 at 20:05 -0500, Mark Benedetto King wrote:
>
> > This should not be difficult: the existing system just tracks everything
> > by line number until it is time to output the blame, then it simply reads
> > through the blamed revision (which exists in a temporary file) one line
> > at a time, calling the blame callback as it goes.
>
>
> I've started to implement it.
> The real problem is that i have to read each file into an artificial
> buffer seperated by lines since diff gives me line numbers, but no text
> for the lines.
>
Mark's point was that you don't actually need the text of all the lines.
All lines you are eventually going to output are in the youngest file, so
just keep that file around ntil the bitter end.

Noe that get_filerevs currently doesn't give revisions backwards. It is
braindead design of mine. I'll take a look about the API docs to see
whether we need a deprecation round - as a kind of punishment for that:-)

Regards,
//Peter

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

Re: linevector for backwards blame

Posted by Daniel Berlin <db...@dberlin.org>.
On Tue, 2005-02-15 at 20:05 -0500, Mark Benedetto King wrote:

> This should not be difficult: the existing system just tracks everything
> by line number until it is time to output the blame, then it simply reads
> through the blamed revision (which exists in a temporary file) one line
> at a time, calling the blame callback as it goes.


I've started to implement it.
The real problem is that i have to read each file into an artificial
buffer seperated by lines since diff gives me line numbers, but no text
for the lines.

--Dan




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

Re: linevector for backwards blame

Posted by Mark Benedetto King <mb...@lowlatency.com>.
On Tue, Feb 15, 2005 at 04:06:38PM -0500, Daniel Berlin wrote:
> This was described to me by someone who knows how cvs does backwards
> annotating.
> I'm not sure what CVS does to prevent memory explosion due to copying
> the text, it must share the lines instead of malloc'ing them like i do
> (or refcount them, but that could be expensive since you'd want to go
> through the vector and free lines when you resized it)
> 
> Anyway, i tested this with something that just parses rcs diffs and
> calls the linevector_add/delete calls in the right order, and the blame
> came out right :)
> 
> All that should need to be done is what is described at the top of the
> file, and we should be good to go.
> 
> /* Note that these structures can use up a lot of memory if we don't do something (refcounting, or something)
>    the lines so we delete them when they aren't used by any version anymore,
>    We could also not copy the text like we do now, and share it
>    with whatever handed it to us.
> */

This should not be difficult: the existing system just tracks everything
by line number until it is time to output the blame, then it simply reads
through the blamed revision (which exists in a temporary file) one line
at a time, calling the blame callback as it goes.


--ben

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