You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by al...@collab.net on 2005/05/09 07:28:46 UTC
[PATCH] 'svn blame --xml' - v5
[[[
Version: 5, Patch to add XML output for 'svn blame'
* subversion/clients/cmdline/blame-cmd.c
(print_blame_xml): New function for XML output
(blame_receiver_xml): New callback function to print
blame output in XML format
(print_header_xml): New function to print XML header
(print_footer_xml): New function to print XML footer
(svn_cl__blame): Modified for XML output
* subversion/clients/cmdline/main.c
(svn_cl__cmd_table[]): added --xml and --incremental options
for blame
* subversion/clients/cmdline/dtd/blame.dtd
New dtd for blame --xml
* subversion/tests/clients/cmdline/blame_tests.py
(blame_in_xml): New test for blame --xml
(blame_on_unknown_revision): New test for blame output on
unknown revision
(test_list): added blame_in_xml, blame_on_unknown_revision
]]]
Re: [PATCH] 'svn blame --xml' - v5
Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Mon, 9 May 2005 alexander@collab.net wrote:
I committed a variant of this patch in r14690. I fixed some bugs and style
nits. Please take a look at the diff to see what I did and feel welcome to
ask why I did what I did if you want. (And a final review would also be
welcome if I did any stupid mistakes:-)
> [[[
> Version: 5, Patch to add XML output for 'svn blame'
>
> * subversion/clients/cmdline/blame-cmd.c
> (print_blame_xml): New function for XML output
> (blame_receiver_xml): New callback function to print
> blame output in XML format
I merged these two.
> * subversion/tests/clients/cmdline/blame_tests.py
> (blame_in_xml): New test for blame --xml
> (blame_on_unknown_revision): New test for blame output on
> unknown revision
I didn't find this last test, but it would be useful. Please submit a
separate patch if you have it somewhere.
Regards,
//Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] 'svn blame --xml' - v5
Posted by "Øyvind A. Holm" <su...@sunbase.org>.
On 2005-05-09 00:28:46 alexander@collab.net wrote:
> [[[
> Version: 5, Patch to add XML output for 'svn blame'
> [...]
> ]]]
This looks very nice. Have tested this patch in various ways against
r14645, and it works very well. For the record again, the XML now looks
like this (formatted for readability):
<?xml version="1.0" encoding="utf-8"?>
<blame>
<target path="README">
<entry line-number="0">
<commit revision="1110">
<author>striker</author>
<date>2002-01-30T11:32:43.341969Z</date>
</commit>
</entry>
<entry line-number="1">
<commit revision="1">
<author>svn</author>
<date>2001-08-31T04:24:14.966996Z</date>
</commit>
</entry>
[...]
</target>
</blame>
(/trunk/README in the svn repository.) This structure is great for
several reasons:
- It is possible to specify a revision range, and even though all lines
in the file are listed, lines which changed outside this range appears
as empty <entry></entry> elements. That’s probably fine, but now that
there are line numbers in the XML, these empty elements could probably
be skipped to minimise the size of the output?
- Several files can be annotated in one single XML file.
There is one problem, though. If a directory or unversioned file is
specified on the command line after a regular, versioned file, svn
aborts before it prints the terminating </blame> which results in
invalid XML:
~/subversion/trunk$ svn-xml ann --xml README nonexistant
<?xml version="1.0" encoding="utf-8"?>
<blame>
<target
path="README">
<entry
line-number="0">
<commit
revision="1110">
[...]
</commit>
</entry>
</target>
subversion/libsvn_client/ra.c:836: (apr_err=150004)
svn: 'nonexistant' has no URL
~/subversion/trunk$
Other than that, it seems to work perfectly. It even works on symlinks,
annotating the single line they contains. That’s a feature.
The line numbers are zero-based, btw. Is that a good thing when most
text editors start counting at 1? Probably. The editors are wrong.
-- sunny256
Re: [PATCH] 'svn blame --xml' - v5
Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Mon, 9 May 2005 kfogel@collab.net wrote:
> "Peter N. Lundblad" <pe...@famlundblad.se> writes:
> > Well, I didn't implement it... But, you can avoid having to traverse all
> > the history of a file with this.
>
> What I'm getting at is, if this is solely a performance enhancement,
> and we're speeding up blame anyway thanks to dberlin's changes, then
> perhaps we should deprecate revision ranges in blame.
>
Blame will always be O(n) (unless we introduce some caching), so I don't
see the point in deprecating this.
Regards,
//Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] 'svn blame --xml' - v5
Posted by Michael Sinz <Mi...@sinz.org>.
kfogel@collab.net wrote:
> "Peter N. Lundblad" <pe...@famlundblad.se> writes:
>
>>Well, I didn't implement it... But, you can avoid having to traverse all
>>the history of a file with this.
>
>
> What I'm getting at is, if this is solely a performance enhancement,
> and we're speeding up blame anyway thanks to dberlin's changes, then
> perhaps we should deprecate revision ranges in blame.
For me it is not a "performance" issue but a usability feature. Say,
for example, the last tested/good/etc version of the code was r123.
Now something is not going well, you will do a diff against r123. But,
more interesting, you really want a diff with blame - what changed and
by whom since r123 until today's r211.
Blame is not really diff but it will show changed lines and who did them
and when. A very valuable feature. If it always goes back to the "first"
checkin, there is a lot more noise in the file.
(Ok, so I really want diff-blame but that is a different story.)
--
Michael Sinz Technology and Engineering Director/Consultant
"Starting Startups" mailto:michael.sinz@sinz.org
My place on the web http://www.sinz.org/Michael.Sinz
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] 'svn blame --xml' - v5
Posted by kf...@collab.net.
"Peter N. Lundblad" <pe...@famlundblad.se> writes:
> Well, I didn't implement it... But, you can avoid having to traverse all
> the history of a file with this.
What I'm getting at is, if this is solely a performance enhancement,
and we're speeding up blame anyway thanks to dberlin's changes, then
perhaps we should deprecate revision ranges in blame.
Thoughts?
-Karl
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] 'svn blame --xml' - v5
Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Mon, 9 May 2005 kfogel@collab.net wrote:
> "Peter N. Lundblad" <pe...@famlundblad.se> writes:
> > > - some lines Q were modified in r15 and again in r19;
> > >
> > Annotated by r19.
> >
> > > - some lines R were added in r13, modified in r15 and r16, and
> > > later deleted in r20;
> > >
> > Not visible, since we're viewing r25.
>
> We're doing -r12:25. So what you're saying is, revision ranges in
> blame mean "show me changes that occurred within the range, that are
> still present in the last revision in the range", not "show me any
> changes still present on any incarnation within the range".
>
Yep.
> Uh, why is this a useful feature, again? :-)
>
Well, I didn't implement it... But, you can avoid having to traverse all
the history of a file with this.
Anyway, it is like it is.
//Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] 'svn blame --xml' - v5
Posted by kf...@collab.net.
"Peter N. Lundblad" <pe...@famlundblad.se> writes:
> > - some lines Q were modified in r15 and again in r19;
> >
> Annotated by r19.
>
> > - some lines R were added in r13, modified in r15 and r16, and
> > later deleted in r20;
> >
> Not visible, since we're viewing r25.
We're doing -r12:25. So what you're saying is, revision ranges in
blame mean "show me changes that occurred within the range, that are
still present in the last revision in the range", not "show me any
changes still present on any incarnation within the range".
> Balme with a revision range is nothing new at all.
> svn blame -rQ:P path
> will show you the file at revision P, with blame annotations going back to
> Q. Lines not modified (or added) between Q and P (inclusive) are annotated
> with dashes indicating "no info".
Huh. Okay, thanks.
Uh, why is this a useful feature, again? :-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] 'svn blame --xml' - v5
Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Mon, 9 May 2005 kfogel@collab.net wrote:
> Øyvind A. Holm <su...@sunbase.org> writes:
> > - It is possible to specify a revision range, and even though all lines
> > in the file are listed, lines which changed outside this range appears
> > as empty <entry></entry> elements. That’s probably fine, but now that
> > there are line numbers in the XML, these empty elements could probably
> > be skipped to minimise the size of the output?
>
> I'd like to understand better what a revision range means in 'svn blame'.
>
> For example, you do
>
> $ svn blame --xml -r12:25 foo.c
>
> Suppose that
>
> - some lines Q were modified in r15 and again in r19;
>
Annotated by r19.
> - some lines R were added in r13, modified in r15 and r16, and
> later deleted in r20;
>
Not visible, since we're viewing r25.
> - some lines S were deleted in r17;
>
Same her.e
> - some lines T were modified in r18 and deleted in r22;
>
Same.
> I haven't read the patch carefully. Would revision ranges be
> prohibited unless --xml were also passed? If not, how would they be
> handled in non-xml output?
>
Balme with a revision range is nothing new at all.
svn blame -rQ:P path
will show you the file at revision P, with blame annotations going back to
Q. Lines not modified (or added) between Q and P (inclusive) are annotated
with dashes indicating "no info".
Regards,
//Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] 'svn blame --xml' - v5
Posted by kf...@collab.net.
Øyvind A. Holm <su...@sunbase.org> writes:
> - It is possible to specify a revision range, and even though all lines
> in the file are listed, lines which changed outside this range appears
> as empty <entry></entry> elements. That’s probably fine, but now that
> there are line numbers in the XML, these empty elements could probably
> be skipped to minimise the size of the output?
I'd like to understand better what a revision range means in 'svn blame'.
For example, you do
$ svn blame --xml -r12:25 foo.c
Suppose that
- some lines Q were modified in r15 and again in r19;
- some lines R were added in r13, modified in r15 and r16, and
later deleted in r20;
- some lines S were deleted in r17;
- some lines T were modified in r18 and deleted in r22;
How would these sets of lines Q, R, S, and T show up in the output?
I haven't read the patch carefully. Would revision ranges be
prohibited unless --xml were also passed? If not, how would they be
handled in non-xml output?
Thanks,
-Karl
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] 'svn blame --xml' - v5
Posted by Greg Thomas <th...@omc.bt.co.uk>.
On 09 May 2005 10:03:13 -0500, "C. Michael Pilato"
<cm...@collab.net> wrote:
>Sometimes we
>have to pull our heads out of our laptops and look at the world around
>us, where checkout lines and building floor numbers
Of course, in the UK floor numbers do start at "0". Well, "Ground",
anyway. The first floor is the first floor above the ground.
Obviously some forward thinking by whoever came up with that scheme.
Greg
--
This post represents the views of the author and does
not necessarily accurately represent the views of BT.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] 'svn blame --xml' - v5
Posted by "C. Michael Pilato" <cm...@collab.net>.
Øyvind A. Holm <su...@sunbase.org> writes:
> The line numbers are zero-based, btw. Is that a good thing when most
> text editors start counting at 1? Probably. The editors are wrong.
Nonono, line numbers should be 1-based for our output. Sometimes we
have to pull our heads out of our laptops and look at the world around
us, where checkout lines and building floor numbers and parking spaces
and ... where the whole of the Real World contains ordered, numbered,
items, and where those systems are almost universally 1-based. :-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org