« Return to Thread: SVN Blame with SVNKit

Re: SVN Blame with SVNKit

by Alexander Kitaev-3 :: Rate this Message:

Reply to Author | View in Thread

Hello,

 > We need that that report looks like
 >   Auther : apit
 >   Modifications :
 >     Class1 line 2
 >     Class2 line 4
 >      ......
 > is it possible and how to do it ?

Annotate operation will report you each line of file as it is at the
last revision with the information on who changed that line and in what
revision. Annotate will not parse file contents in any way - so in your
example it is not possible to say what lines belongs to Class1 and what
to Class2 as long as these two classes are in the same file.

Take a look at default annotation output, it will look like (for example):

2775 alex This is a README.txt file for SVNKit
1695 user
1695 user 1. DESCRIPTION
1695 user
2775 alex SVNKit is a pure Java Subversion client library.
1695 user
...

So, above information is what ISVNAnnotateHandler receives. From it you
may compose a Map, where users will be keys and values - amount of lines
that were created(last changed) by that user in that file (as it is at
HEAD revision or other revision specified). For the above example it
will be a Map like:

alex: 2
user: 4

Alexander Kitaev,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!

APIT wrote:

> Hello All
>  I was trying to implement svn blame with svnkit and Its working the problem
> is that the log file is not the needed one, I need to extract for each
> source line in the project in the svn the person how modified it.
>  here is the code :
>                        
>                  Iterator<SVNURL> fileiter = entries.iterator();
> while (fileiter.hasNext()) {
> SVNURL svnfileUrl = (SVNURL) fileiter.next();
> svnLogClient.doAnnotate(svnfileUrl, SVNRevision.HEAD,
> SVNRevision.create(1), SVNRevision.HEAD,
> new ISVNAnnotateHandler() {
> public void handleLine(Date date, long revision,
> String author, String line)
> throws SVNException {
> svnBlameExtractor.addLineNo(line);
> svnBlameExtractor
> .setVcsNameOfProgrammerToBlame(author);
> svnBlameExtractor.setDate(date);
> svnBlameExtractor.setRevision(revision);
>
> }
> });
> svnBlameExtractor.generateReport();
>
>
>
> And here is a sample of code :
>
> -----------------------------------------------------------------------
> Revision :1246
> -----------------------------------------------------------------------
> Author :apit
> Modification :
> ------------------------------------------------------------------------
> package com.piterion.test;
>
> public class Class1 {
> Cla
> }
> package com.piterion.test2;
>
> public class Class2 {
> s
> }
> <?xml version="1.0" encoding="UTF-8"?>
> <classpath>
> <classpathentry kind="src" path="src"/>
> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
> <classpathentry kind="output" path="bin"/>
> </classpath>
> <?xml version="1.0" encoding="UTF-8"?>
> <projectDescription>
> <name>com.piterion.test</name>
> <comment></comment>
> <projects>
> </projects>
> <buildSpec>
> <buildCommand>
> <name>org.eclipse.jdt.core.javabuilder</name>
> <arguments>
> </arguments>
> </buildCommand>
> </buildSpec>
> <natures>
> <nature>org.eclipse.jdt.core.javanature</nature>
> </natures>
> </projectDescription>
>
>
>
> We need that that report looks like
>   Auther : apit
>   Modifications :
>     Class1 line 2
>     Class2 line 4
>      ......
> is it possible and how to do it ?
>
>
> :confused:
>
>  

---------------------------------------------------------------------
To unsubscribe, e-mail: svnkit-users-unsubscribe@...
For additional commands, e-mail: svnkit-users-help@...

 « Return to Thread: SVN Blame with SVNKit