Beispiel #1
0
  public void findProjectRoots(String name, String path, List<SVNProjectRoot> list)
      throws SVNException {

    Collection<SVNDirEntry> entries = new ArrayList<>();
    SVNDirEntry directory =
        repository.getDir(path, DEFAULT_HEAD_REVISION, false, (Collection<SVNDirEntry>) entries);
    logger.debug("Inspecting directory " + path);

    if (isProjectRoot(directory, entries)) {
      logger.debug("Found project root at {} now looking for branches and tags", path);

      Set<SVNDirEntry> branches = new HashSet<>();
      String branchesPath = path + "/branches";
      SVNNodeKind branchesNode = repository.checkPath(branchesPath, -1);
      if (branchesNode == SVNNodeKind.DIR) {
        repository.getDir(branchesPath, -1, false, branches);
      }
      Set<String> branchNames = branches.stream().map(d -> d.getName()).collect(Collectors.toSet());
      logger.debug("Found {} branches: {}", branchNames.size(), branchNames);

      Set<SVNDirEntry> tags = new HashSet<>();
      String tagsPath = path + "/tags";
      SVNNodeKind tagsNode = repository.checkPath(tagsPath, -1);
      if (tagsNode == SVNNodeKind.DIR) {
        repository.getDir(tagsPath, -1, false, tags);
      }
      Set<String> tagNames = tags.stream().map(d -> d.getName()).collect(Collectors.toSet());
      logger.debug("Found {} tags: {}", tagNames.size(), tagNames);

      list.add(
          new SVNProjectRoot(
              name, path, directory.getURL().toDecodedString(), branchNames, tagNames));
      return;
    }

    for (SVNDirEntry entry : entries) {
      if (entry.getKind() == SVNNodeKind.DIR) {
        String dirPath =
            isRootPath(path) ? pathRelativeToRoot(path, entry) : pathRelativeToParent(path, entry);
        logger.debug("Moving into directory " + dirPath);
        findProjectRoots(entry.getName(), dirPath, list);
      }
    }
  }
Beispiel #2
0
 public void handleDirEntry(SVNDirEntry dirEntry) throws SVNException {
   getOperation().receive(SvnTarget.fromURL(dirEntry.getURL()), dirEntry);
 }