[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] 'svn blame --xml' - v5

From: Øyvind A. Holm <sunny_at_sunbase.org>
Date: 2005-05-09 16:35:05 CEST

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

  • application/pgp-signature attachment: stored
Received on Mon May 9 16:55:49 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.