Hello Dian,
If by the "count of differences" you mean the number of changed lines, you can use an analog of "svn diff" command. See DiffTest.java for examples of SvnDiff operation usage.
http://svn.svnkit.com/repos/svnkit/trunk/svnkit/src/test/java/org/tmatesoft/svn/test/DiffTest.java
SvnDiff will write a patch to the output stream, you can convert it to String and then parse.
Another approach is to use an analog of "svn blame" command. Suppose you want to find changes between REV1 and REV2 (and suppose, that REV2>REV1). You run
$ svn blame <URL>@REV2
Every line will be annotated with a revision of the latest change of that line. You can collect lines with REV1<=revision<REV2. But note, that if since REV1 a line was changed to another value and then back, it
will be also reported, although in REV1 and REV2 it can have the same value. And deleted lines won't be reported. But I don't know your purposes, maybe it will be acceptable for you.
To run blame in SVNKit, use the following code:
final SvnAnnotate annotate = svnOperationFactory.createAnnotate();
annotate.setSingleTarget(SvnTarget.fromURL(url.appendPath("file", false), SVNRevision.create(rev2)));
annotate.setStartRevision(SVNRevision.create(rev1));
annotate.setEndRevision(SVNRevision.create(rev2));
annotate.setReceiver(new ISvnObjectReceiver<SvnAnnotateItem>() {
@Override
public void receive(SvnTarget target, SvnAnnotateItem annotateItem) throws SVNException {
if (annotateItem.isLine()) {
final String line = annotateItem.getLine();
final long revision = annotateItem.getRevision();
if (rev1 < revision && revision <= rev2) {
System.out.println("Line '" + line + "' was changed at r" + revision);
count++;
}
}
}
});
annotate.run();
--
Dmitry Pavlenko,
TMate Software,
http://subgit.com/ - git-svn bridge
Post by Dian Rodriguez BravoHello
Im new in all this svnkit thing and i need to do a method in java that
returns the count off differences between two given revisions of a same
file, done by a user or least the count off differences between those
revisions of that file. Thanks in advance