diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..51b8b9c --- /dev/null +++ b/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..052f900 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + RepositoryMinerForCVS2 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..bb35fa0 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..10d633d --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1,2 @@ +/Main$1.class +/Main.class diff --git a/org-netbeans-lib-cvsclient.jar b/org-netbeans-lib-cvsclient.jar new file mode 100644 index 0000000..6dcedf8 --- /dev/null +++ b/org-netbeans-lib-cvsclient.jar Binary files differ diff --git a/org.eclipse.jgit-4.1.1.201511131810-r.jar b/org.eclipse.jgit-4.1.1.201511131810-r.jar new file mode 100644 index 0000000..4ab85bd --- /dev/null +++ b/org.eclipse.jgit-4.1.1.201511131810-r.jar Binary files differ diff --git a/src/Main.java b/src/Main.java new file mode 100644 index 0000000..013b823 --- /dev/null +++ b/src/Main.java @@ -0,0 +1,141 @@ +import java.io.IOException; + +import org.netbeans.lib.cvsclient.Client; +import org.netbeans.lib.cvsclient.admin.StandardAdminHandler; +import org.netbeans.lib.cvsclient.command.CommandAbortedException; +import org.netbeans.lib.cvsclient.command.CommandException; +import org.netbeans.lib.cvsclient.command.DefaultFileInfoContainer; +import org.netbeans.lib.cvsclient.command.FileInfoContainer; +import org.netbeans.lib.cvsclient.command.GlobalOptions; +import org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand; +import org.netbeans.lib.cvsclient.command.log.LogInformation; +import org.netbeans.lib.cvsclient.command.log.LogInformation.Revision; +import org.netbeans.lib.cvsclient.command.log.RlogCommand; +import org.netbeans.lib.cvsclient.connection.AuthenticationException; +import org.netbeans.lib.cvsclient.connection.PServerConnection; +import org.netbeans.lib.cvsclient.connection.StandardScrambler; +import org.netbeans.lib.cvsclient.event.BinaryMessageEvent; +import org.netbeans.lib.cvsclient.event.CVSAdapter; +import org.netbeans.lib.cvsclient.event.CVSListener; +import org.netbeans.lib.cvsclient.event.FileAddedEvent; +import org.netbeans.lib.cvsclient.event.FileInfoEvent; +import org.netbeans.lib.cvsclient.event.FileRemovedEvent; +import org.netbeans.lib.cvsclient.event.FileToRemoveEvent; +import org.netbeans.lib.cvsclient.event.FileUpdatedEvent; +import org.netbeans.lib.cvsclient.event.MessageEvent; +import org.netbeans.lib.cvsclient.event.ModuleExpansionEvent; +import org.netbeans.lib.cvsclient.event.TerminationEvent; + +public class Main { + + public static void main(String[] args) { + // PServer�Ƃ̐ڑ� + PServerConnection c = new PServerConnection(); +// c.setHostName("jedit.cvs.sourceforge.net"); // PServer�̃z�X�g���܂���IP(jEdit) +// c.setRepository("/cvsroot/jedit"); // �ڑ����邷�郊�|�W�g����(jEdit) + c.setHostName("jhotdraw.cvs.sourceforge.net"); // PServer�̃z�X�g���܂���IP(JHotDraw) + c.setRepository("/cvsroot/jhotdraw"); // �ڑ����邷�郊�|�W�g����(JHotDraw) + Client client = openConnection(c); + client.setLocalPath("./tmp"); + + CVSAdapter adapter = new CVSAdapter() { + @Override + public void commandTerminated(TerminationEvent arg0) { + super.commandTerminated(arg0); + } + @Override + public void fileAdded(FileAddedEvent arg0) { + super.fileAdded(arg0); + } + @Override + public void fileInfoGenerated(FileInfoEvent fileInfoEvent) { + FileInfoContainer fileInfoContainer = fileInfoEvent.getInfoContainer(); + if (fileInfoContainer instanceof DefaultFileInfoContainer) { + + } else if (fileInfoContainer instanceof LogInformation) { + LogInformation logInfo = (LogInformation) fileInfoContainer; + int length = Integer.parseInt(logInfo.getTotalRevisions()); + for (int i = 0; i < length; i++) { + Revision rev = (Revision) logInfo.getRevisionList().get(i); + System.out.println("---------------------"); + System.out.println("File:" + logInfo.getRepositoryFilename()); + System.out.println("Author:" + rev.getAuthor()); + System.out.println("CommitID:" + rev.getCommitID()); + System.out.println("Number:" + rev.getNumber()); + System.out.println("Message:" + rev.getMessage()); + System.out.println("Lines:" + rev.getLines()); + System.out.println("Date:" + rev.getDateString()); + } + } + } + @Override + public void fileRemoved(FileRemovedEvent arg0) { + super.fileRemoved(arg0); + } + @Override + public void fileToRemove(FileToRemoveEvent arg0) { + super.fileToRemove(arg0); + } + @Override + public void fileUpdated(FileUpdatedEvent arg0) { + super.fileUpdated(arg0); + } + @Override + public void messageSent(MessageEvent arg0) { + super.messageSent(arg0); + } + @Override + public void messageSent(BinaryMessageEvent arg0) { + super.messageSent(arg0); + } + @Override + public void moduleExpanded(ModuleExpansionEvent arg0) { + super.moduleExpanded(arg0); + } + }; + + // �`�F�b�N�A�E�g +// CheckoutCommand checkoutCommand = new CheckoutCommand(); +//// checkoutCommand.setModule("plugins"); // ���W���[����(jEdit) +// checkoutCommand.setModule("JHotDraw"); // ���W���[����(JHotDraw) +// try { +// client.getEventManager().addCVSListener(adapter); +// client.executeCommand(checkoutCommand, new GlobalOptions()); +// } catch (CommandException | AuthenticationException e) { +// e.printStackTrace(); +// } + + // ���O + RlogCommand rlogCommand = new RlogCommand(); +// rlogCommand.setModule("plugins"); // ���W���[����(jEdit) + rlogCommand.setModule("JHotDraw"); // ���W���[����(JHotDraw) + try { + client.getEventManager().addCVSListener(adapter); + client.executeCommand(rlogCommand, new GlobalOptions()); + } catch (CommandException | AuthenticationException e) { + e.printStackTrace(); + } + + closeConnection(c); + } + + private static Client openConnection(PServerConnection c) { + c.setUserName("anonymous"); + c.setEncodedPassword(StandardScrambler.getInstance().scramble("")); + try { + c.open(); + return new Client(c, new StandardAdminHandler()); + } catch (CommandAbortedException | AuthenticationException e) { + e.printStackTrace(); + } + return null; + } + + private static void closeConnection(PServerConnection c) { + try { + c.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +}