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.io.SVNRepositoryFactory;
22:
23: /**
24: * @version 1.1.1
25: * @author TMate Software Ltd.
26: * @since 1.1.1
27: */
28: public class SVNAdminCreateCommand extends SVNCommand {
29:
30: public void run(InputStream in, PrintStream out, PrintStream err)
31: throws SVNException {
32: run(out, err);
33: }
34:
35: public void run(PrintStream out, PrintStream err)
36: throws SVNException {
37: String fsType = (String) getCommandLine().getArgumentValue(
38: SVNArgument.FS_TYPE);
39: if (fsType != null && !"fsfs".equals(fsType)) {
40: SVNCommand.println(out, "Unsupported repository type '"
41: + fsType + "'");
42: System.exit(1);
43: }
44:
45: boolean isOldFormat = getCommandLine().hasArgument(
46: SVNArgument.PRE_14_COMPATIBLE);
47: if (!getCommandLine().hasPaths()) {
48: SVNCommand.println(out,
49: "jsvnadmin: Repository argument required");
50: System.exit(1);
51: }
52:
53: String absolutePath = getCommandLine().getPathAt(0);
54: SVNRepositoryFactory.createLocalRepository(new File(
55: absolutePath), null, false, false, isOldFormat);
56: }
57:
58: }
|