protected SVNRepository getRepository(
        SCMSourceOwner context,
        SVNURL repoURL,
        StandardCredentials credentials,
        Map<String, Credentials> additionalCredentials,
        ISVNSession session)
        throws SVNException {
      SVNRepository repository = SVNRepositoryFactory.create(repoURL, session);

      ISVNAuthenticationManager sam =
          SubversionSCM.createSvnAuthenticationManager(
              new CredentialsSVNAuthenticationProviderImpl(credentials, additionalCredentials));
      sam =
          new FilterSVNAuthenticationManager(sam) {
            // If there's no time out, the blocking read operation may hang forever, because TCP
            // itself
            // has no timeout. So always use some time out. If the underlying implementation gives
            // us some
            // value (which may come from ~/.subversion), honor that, as long as it sets some
            // timeout value.
            @Override
            public int getReadTimeout(SVNRepository repository) {
              int r = super.getReadTimeout(repository);
              if (r <= 0) r = SubversionSCM.DEFAULT_TIMEOUT;
              return r;
            }
          };
      repository.setTunnelProvider(SubversionSCM.createDefaultSVNOptions());
      repository.setAuthenticationManager(sam);

      return repository;
    }
  /**
   * Returns a list of Subversion dirs to be displayed in {@code
   * ListSubversionTagsParameterDefinition/index.jelly}.
   *
   * <p>This method plainly reuses settings that must have been preivously defined when configuring
   * the Subversion SCM.
   *
   * <p>This method never returns {@code null}. In case an error happens, the returned list contains
   * an error message surrounded by &lt; and &gt;.
   */
  public List<String> getTags() {
    AbstractProject context = null;
    List<AbstractProject> jobs = Hudson.getInstance().getItems(AbstractProject.class);

    // which project is this parameter bound to? (I should take time to move
    // this code to Hudson core one day)
    for (AbstractProject project : jobs) {
      ParametersDefinitionProperty property =
          (ParametersDefinitionProperty) project.getProperty(ParametersDefinitionProperty.class);
      if (property != null) {
        List<ParameterDefinition> parameterDefinitions = property.getParameterDefinitions();
        if (parameterDefinitions != null) {
          for (ParameterDefinition pd : parameterDefinitions) {
            if (pd instanceof ListSubversionTagsParameterDefinition
                && ((ListSubversionTagsParameterDefinition) pd).compareTo(this) == 0) {
              context = project;
              break;
            }
          }
        }
      }
    }

    SimpleSVNDirEntryHandler dirEntryHandler = new SimpleSVNDirEntryHandler(tagsFilter);
    List<String> dirs = new ArrayList<String>();

    try {
      ISVNAuthenticationProvider authProvider =
          getDescriptor().createAuthenticationProvider(context);
      ISVNAuthenticationManager authManager =
          SubversionSCM.createSvnAuthenticationManager(authProvider);
      SVNURL repoURL = SVNURL.parseURIDecoded(getTagsDir());

      SVNRepository repo = SVNRepositoryFactory.create(repoURL);
      repo.setAuthenticationManager(authManager);
      SVNLogClient logClient = new SVNLogClient(authManager, null);

      if (isSVNRepositoryProjectRoot(repo)) {
        dirs = this.getSVNRootRepoDirectories(logClient, repoURL);
      } else {
        logClient.doList(
            repoURL, SVNRevision.HEAD, SVNRevision.HEAD, false, false, dirEntryHandler);
        dirs = dirEntryHandler.getDirs(isReverseByDate(), isReverseByName());
      }
    } catch (SVNException e) {
      // logs are not translated (IMO, this is a bad idea to translate logs)
      LOGGER.log(
          Level.SEVERE,
          "An SVN exception occurred while listing the directory entries at " + getTagsDir(),
          e);
      return new ArrayList() {
        {
          add(
              "&lt;"
                  + ResourceBundleHolder.get(ListSubversionTagsParameterDefinition.class)
                      .format("SVNException")
                  + "&gt;");
        }
      };
    }

    // SVNKit's doList() method returns also the parent dir, so we need to remove it
    if (dirs != null) {
      removeParentDir(dirs);
    } else {
      LOGGER.log(
          Level.INFO,
          "No directory entries were found for the following SVN repository: {0}",
          getTagsDir());
      return new ArrayList() {
        {
          add(
              "&lt;"
                  + ResourceBundleHolder.get(ListSubversionTagsParameterDefinition.class)
                      .format("NoDirectoryEntriesFound")
                  + "&gt;");
        }
      };
    }

    // Conform list to the maxTags option.
    Integer max = (isInt(this.maxTags) ? Integer.parseInt(this.maxTags) : null);
    if ((max != null) && (dirs.size() > max)) {
      dirs = dirs.subList(0, max);
    }

    return dirs;
  }