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.SVNCancelException;
21: import org.tmatesoft.svn.core.SVNException;
22: import org.tmatesoft.svn.core.wc.SVNEvent;
23: import org.tmatesoft.svn.core.wc.SVNRevision;
24: import org.tmatesoft.svn.core.wc.admin.ISVNAdminEventHandler;
25: import org.tmatesoft.svn.core.wc.admin.SVNAdminClient;
26: import org.tmatesoft.svn.core.wc.admin.SVNAdminEvent;
27: import org.tmatesoft.svn.core.wc.admin.SVNAdminEventAction;
28:
29: /**
30: * @version 1.1.1
31: * @author TMate Software Ltd.
32: * @since 1.1.1
33: */
34: public class SVNAdminVerifyCommand extends SVNCommand implements
35: ISVNAdminEventHandler {
36: private boolean myIsQuiet;
37: private PrintStream myOut;
38:
39: public void run(InputStream in, PrintStream out, PrintStream err)
40: throws SVNException {
41: run(out, err);
42: }
43:
44: public void run(PrintStream out, PrintStream err)
45: throws SVNException {
46: if (!getCommandLine().hasPaths()) {
47: SVNCommand.println(out,
48: "jsvnadmin: Repository argument required");
49: System.exit(1);
50: }
51: File reposRoot = new File(getCommandLine().getPathAt(0));
52:
53: SVNRevision[] revRange = getStartEndRevisions();
54: SVNRevision rStart = revRange[0];
55: SVNRevision rEnd = revRange[1];
56:
57: myIsQuiet = getCommandLine().hasArgument(SVNArgument.QUIET);
58: myOut = err;
59:
60: SVNAdminClient adminClient = getClientManager()
61: .getAdminClient();
62: adminClient.setEventHandler(this );
63: adminClient.doVerify(reposRoot, rStart, rEnd);
64: }
65:
66: public void handleAdminEvent(SVNAdminEvent event, double progress)
67: throws SVNException {
68: if (!myIsQuiet
69: && event != null
70: && event.getAction() == SVNAdminEventAction.REVISION_DUMPED) {
71: myOut.println(event.getMessage());
72: }
73: }
74:
75: public void handleEvent(SVNEvent event, double progress)
76: throws SVNException {
77: }
78:
79: public void checkCancelled() throws SVNCancelException {
80: }
81: }
|