protected ListScmResult executeListCommand()

in maven-scm-providers/maven-scm-provider-local/src/main/java/org/apache/maven/scm/provider/local/command/list/LocalListCommand.java [42:83]


    protected ListScmResult executeListCommand(
            ScmProviderRepository repo, ScmFileSet fileSet, boolean recursive, ScmVersion version) throws ScmException {
        if (version != null) {
            throw new ScmException("The local scm doesn't support tags.");
        }

        LocalScmProviderRepository repository = (LocalScmProviderRepository) repo;

        File root = new File(repository.getRoot());

        String module = repository.getModule();

        File source = new File(root, module);

        if (!root.exists()) {
            throw new ScmException("The base directory doesn't exist (" + root.getAbsolutePath() + ").");
        }

        if (!source.exists()) {
            throw new ScmException("The module directory doesn't exist (" + source.getAbsolutePath() + ").");
        }

        if (logger.isInfoEnabled()) {
            logger.info("Listing files of '" + source.getAbsolutePath() + "'.");
        }

        try {
            if (fileSet.getFileList() == null || fileSet.getFileList().isEmpty()) {
                return new LocalListScmResult(null, getFiles(source, source, recursive));
            } else {
                List<ScmFile> files = new ArrayList<>();

                for (File file : fileSet.getFileList()) {
                    files.addAll(getFiles(source, new File(source, file.getPath()), recursive));
                }

                return new LocalListScmResult(null, files);
            }
        } catch (Exception e) {
            return new ListScmResult(null, "The svn command failed.", e.getMessage(), false);
        }
    }