summaryrefslogtreecommitdiff
path: root/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnKitAnnotateClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnKitAnnotateClient.java')
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnKitAnnotateClient.java63
1 files changed, 57 insertions, 6 deletions
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnKitAnnotateClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnKitAnnotateClient.java
index 191bd9079237..c2423de0b70d 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnKitAnnotateClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnKitAnnotateClient.java
@@ -4,13 +4,17 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.checkin.CommitInfo;
+import org.jetbrains.idea.svn.diff.DiffOptions;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.ISVNAnnotateHandler;
-import org.tmatesoft.svn.core.wc.SVNDiffOptions;
import org.tmatesoft.svn.core.wc.SVNLogClient;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
+import java.io.File;
+import java.util.Date;
+
/**
* @author Konstantin Kolosovsky.
*/
@@ -22,21 +26,68 @@ public class SvnKitAnnotateClient extends BaseSvnClient implements AnnotateClien
@NotNull SVNRevision endRevision,
@Nullable SVNRevision pegRevision,
boolean includeMergedRevisions,
- @Nullable SVNDiffOptions diffOptions,
- @Nullable ISVNAnnotateHandler handler) throws VcsException {
+ @Nullable DiffOptions diffOptions,
+ @Nullable AnnotationConsumer handler) throws VcsException {
try {
SVNLogClient client = myVcs.getSvnKitManager().createLogClient();
- client.setDiffOptions(diffOptions);
+ client.setDiffOptions(toDiffOptions(diffOptions));
if (target.isFile()) {
- client.doAnnotate(target.getFile(), pegRevision, startRevision, endRevision, true, includeMergedRevisions, handler, null);
+ client
+ .doAnnotate(target.getFile(), pegRevision, startRevision, endRevision, true, includeMergedRevisions, toAnnotateHandler(handler),
+ null);
}
else {
- client.doAnnotate(target.getURL(), pegRevision, startRevision, endRevision, true, includeMergedRevisions, handler, null);
+ client
+ .doAnnotate(target.getURL(), pegRevision, startRevision, endRevision, true, includeMergedRevisions, toAnnotateHandler(handler),
+ null);
}
}
catch (SVNException e) {
throw new VcsException(e);
}
}
+
+ @Nullable
+ private static ISVNAnnotateHandler toAnnotateHandler(@Nullable final AnnotationConsumer handler) {
+ ISVNAnnotateHandler result = null;
+
+ if (handler != null) {
+ result = new ISVNAnnotateHandler() {
+ @Override
+ public void handleLine(Date date, long revision, String author, String line) throws SVNException {
+ // deprecated - not called
+ }
+
+ @Override
+ public void handleLine(Date date,
+ long revision,
+ String author,
+ String line,
+ Date mergedDate,
+ long mergedRevision,
+ String mergedAuthor,
+ String mergedPath,
+ int lineNumber) throws SVNException {
+ if (revision > 0) {
+ CommitInfo info = new CommitInfo.Builder(revision, date, author).build();
+ CommitInfo mergeInfo = mergedDate != null ? new CommitInfo.Builder(mergedRevision, mergedDate, mergedAuthor).build() : null;
+
+ handler.consume(lineNumber, info, mergeInfo);
+ }
+ }
+
+ @Override
+ public boolean handleRevision(Date date, long revision, String author, File contents) throws SVNException {
+ return false;
+ }
+
+ @Override
+ public void handleEOF() throws SVNException {
+ }
+ };
+ }
+
+ return result;
+ }
}