01: /*
02: * ====================================================================
03: * Copyright (c) 2004-2008 TMate Software Ltd. All rights reserved.
04: *
05: * This software is licensed as described in the file COPYING, which
06: * you should have received as part of this distribution. The terms
07: * are also available at http://svnkit.com/license.html.
08: * If newer versions of this license are posted there, you may use a
09: * newer version instead, at your option.
10: * ====================================================================
11: */
12: package org.tmatesoft.svn.cli.command;
13:
14: import java.io.File;
15: import java.io.InputStream;
16: import java.io.PrintStream;
17:
18: import org.tmatesoft.svn.cli.SVNArgument;
19: import org.tmatesoft.svn.cli.SVNCommand;
20: import org.tmatesoft.svn.core.SVNException;
21: import org.tmatesoft.svn.core.wc.SVNRevision;
22: import org.tmatesoft.svn.core.wc.admin.SVNLookClient;
23:
24: /**
25: * @version 1.1.1
26: * @author TMate Software Ltd.
27: * @since 1.1.1
28: */
29: public class SVNLookLogCommand extends SVNCommand {
30:
31: public void run(PrintStream out, PrintStream err)
32: throws SVNException {
33: if (!getCommandLine().hasPaths()) {
34: SVNCommand.println(err,
35: "jsvnlook: Repository argument required");
36: System.exit(1);
37: }
38: File reposRoot = new File(getCommandLine().getPathAt(0));
39: SVNRevision revision = SVNRevision.HEAD;
40: SVNLookClient lookClient = getClientManager().getLookClient();
41:
42: if (getCommandLine().hasArgument(SVNArgument.TRANSACTION)) {
43: String transactionName = (String) getCommandLine()
44: .getArgumentValue(SVNArgument.TRANSACTION);
45: String log = lookClient
46: .doGetLog(reposRoot, transactionName);
47: SVNCommand.println(out, log != null ? log : "");
48: return;
49: } else if (getCommandLine().hasArgument(SVNArgument.REVISION)) {
50: revision = SVNRevision.parse((String) getCommandLine()
51: .getArgumentValue(SVNArgument.REVISION));
52: }
53: String log = lookClient.doGetLog(reposRoot, revision);
54: SVNCommand.println(out, log != null ? log : "");
55: }
56:
57: public void run(InputStream in, PrintStream out, PrintStream err)
58: throws SVNException {
59: run(out, err);
60: }
61:
62: }
|