Package org.opensolaris.opengrok.util

Examples of org.opensolaris.opengrok.util.Executor


     * @throws HistoryException if an error happens when parsing the history
     */
    History parse(File file, String changeset) throws HistoryException {
        isDir = file.isDirectory();
        try {
            Executor executor = repository.getHistoryLogExecutor(file, changeset);
            int status = executor.exec(true, this);

            if (status != 0) {
                throw new HistoryException("Failed to get history for: \"" +
                                           file.getAbsolutePath() +
                                           "\" Exit code: " + status);
View Full Code Here


        initSaxParser();
        handler = new Handler(repos.getDirectoryName(), repos.reposPath,
                RuntimeEnvironment.getInstance().getSourceRootPath().length(),
                repos.getDateFormat());

        Executor executor = repos.getHistoryLogExecutor(file, sinceRevision);
        int status = executor.exec(true, this);

        if (status != 0) {
            throw new HistoryException("Failed to get history for: \"" +
                    file.getAbsolutePath() + "\" Exit code: " + status);
        }
View Full Code Here

     * @return object representing the file's history
     */
    History parse(File file, Repository repos) throws HistoryException {
        repository = (CVSRepository) repos;
        try {
            Executor executor = repository.getHistoryLogExecutor(file);
            int status = executor.exec(true, this);

            if (status != 0) {
                throw new HistoryException("Failed to get history for: \"" +
                                           file.getAbsolutePath() + "\" Exit code: " + status);
            }
View Full Code Here

        if (test) {
            RuntimeEnvironment env = RuntimeEnvironment.getInstance();
            env.setSourceRoot(repository.getSourceRoot());
            env.setDataRoot(repository.getDataRoot());
            Executor executor;

            executor = new Executor(new String[]{"mkdir", "-p", repository.getSourceRoot() + "/testBug11896"});
            executor.exec(true);

            executor = new Executor(new String[]{"mkfifo", repository.getSourceRoot() + "/testBug11896/FIFO"});
            executor.exec(true);

            if (env.validateExuberantCtags()) {
                Project project = new Project();
                project.setPath("/testBug11896");
                IndexDatabase idb = new IndexDatabase(project);
View Full Code Here

     */
    private void importHgChangeset(File reposRoot, String changesetFile) {
        String[] cmdargs = {
            MercurialRepository.CMD_FALLBACK, "import", changesetFile
        };
        Executor exec = new Executor(Arrays.asList(cmdargs), reposRoot);
        int exitCode = exec.exec();
        if (exitCode != 0) {
            fail("hg import failed." +
                    "\nexit code: " + exitCode +
                    "\nstdout:\n" + exec.getOutputString() +
                    "\nstderr:\n" + exec.getErrorString());
        }
    }
View Full Code Here

     */
    private void importHgChangeset(File reposRoot, String changesetFile) {
        String[] cmdargs = {
            MercurialRepository.CMD_FALLBACK, "import", changesetFile
        };
        Executor exec = new Executor(Arrays.asList(cmdargs), reposRoot);
        int exitCode = exec.exec();
        if (exitCode != 0) {
            fail("hg import failed." +
                    "\nexit code: " + exitCode +
                    "\nstdout:\n" + exec.getOutputString() +
                    "\nstderr:\n" + exec.getErrorString());
        }
    }
View Full Code Here

        } else {
            try {
                /*
                 * Errors will be logged, so not bothering to add to the output.
                 */
                Executor executor = repository.getHistoryLogExecutor(file);
                executor.exec(true, this);

                /*
                 * Try again because there was no 'keep' history.
                 */
                if (!foundHistory) {
                    executor = repository.getHistoryLogExecutor(file);
                    executor.exec(true, this);
                }
            } catch (IOException e) {
                throw new HistoryException(
                        "Failed to get history for: \""
                        + file.getAbsolutePath() + "\"" + e);
View Full Code Here

            cmd.add(rev.trim());
        }

        cmd.add(path);

        Executor executor = new Executor(cmd, file.getParentFile());
        executor.exec();
        try (BufferedReader reader = new BufferedReader(executor.getOutputReader())) {
            String line;
            int lineno = 0;
            try {
                while ((line = reader.readLine()) != null) {
                    ++lineno;
View Full Code Here

            cmd.add("keep")// get a list of all 'real' file versions
        }

        cmd.add(path);

        return new Executor(cmd, file.getParentFile());
    }
View Full Code Here

         */
        cmd.add(this.cmd);
        cmd.add("stat");
        cmd.add("-fe");
        cmd.add(basename);
        Executor executor = new Executor(cmd, directory);
        executor.exec();

        String elementID = null;

        try (BufferedReader info = new BufferedReader(executor.getOutputReader())) {
            String line = info.readLine();
            String[] statInfo = line.split("\\s+");
            elementID = statInfo[1].substring(2); // skip over 'e:'

        } catch (IOException e) {
            OpenGrokLogger.getLogger().log(Level.SEVERE,
                    "Could not obtain status for " + basename);
        }

        if (elementID != null) {
            /*
             * ------------------------------------------ This really gets the
             * contents of the file.
            *------------------------------------------
             */
            cmd.clear();
            cmd.add(this.cmd);
            cmd.add("cat");
            cmd.add("-v");
            cmd.add(rev.trim());
            cmd.add("-e");
            cmd.add(elementID);

            executor = new Executor(cmd, directory);
            executor.exec();

            inputStream =
                    new ByteArrayInputStream(executor.getOutputString().getBytes());
        }

        return inputStream;
    }
View Full Code Here

TOP

Related Classes of org.opensolaris.opengrok.util.Executor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.