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.ISVNChangedDirectoriesHandler;
23: import org.tmatesoft.svn.core.wc.admin.SVNLookClient;
24:
25: /**
26: * @version 1.1.1
27: * @author TMate Software Ltd.
28: * @since 1.1.1
29: */
30: public class SVNLookDirsChangedCommand extends SVNCommand implements
31: ISVNChangedDirectoriesHandler {
32: private PrintStream myOut;
33:
34: public void run(PrintStream out, PrintStream err)
35: throws SVNException {
36: if (!getCommandLine().hasPaths()) {
37: SVNCommand.println(err,
38: "jsvnlook: Repository argument required");
39: System.exit(1);
40: }
41: File reposRoot = new File(getCommandLine().getPathAt(0));
42: myOut = out;
43: SVNRevision revision = SVNRevision.HEAD;
44: SVNLookClient lookClient = getClientManager().getLookClient();
45: if (getCommandLine().hasArgument(SVNArgument.TRANSACTION)) {
46: String transactionName = (String) getCommandLine()
47: .getArgumentValue(SVNArgument.TRANSACTION);
48: lookClient.doGetChangedDirectories(reposRoot,
49: transactionName, this );
50: return;
51: } else if (getCommandLine().hasArgument(SVNArgument.REVISION)) {
52: revision = SVNRevision.parse((String) getCommandLine()
53: .getArgumentValue(SVNArgument.REVISION));
54: }
55: lookClient.doGetChangedDirectories(reposRoot, revision, this );
56: }
57:
58: public void run(InputStream in, PrintStream out, PrintStream err)
59: throws SVNException {
60: run(out, err);
61: }
62:
63: public void handleDir(String path) throws SVNException {
64: if (path.startsWith("/")) {
65: path = path.substring(1);
66: }
67: if (!path.endsWith("/")) {
68: path += "/";
69: }
70: SVNCommand.println(myOut, path);
71: }
72:
73: }
|