Пример #1
0
  // TODO(user): Handle separate_revisions! (an 'svn commit' per exported change)
  @Override
  public DraftRevision putCodebase(Codebase c) throws WritingError {
    c.checkProjectSpace(config.getProjectSpace());

    // Filter out files that either start with .svn or have .svn after a slash, plus the repo
    // config's ignore_file_res.
    List<String> ignoreFilePatterns =
        ImmutableList.<String>builder()
            .addAll(config.getIgnoreFileRes())
            .add("(^|.*/)\\.svn(/.*|$)")
            .build();

    Set<String> codebaseFiles = c.getRelativeFilenames();
    Set<String> writerFiles =
        Utils.filterByRegEx(
            Utils.makeFilenamesRelative(
                AppContext.RUN.fileSystem.findFiles(rootDirectory), rootDirectory),
            ignoreFilePatterns);
    Set<String> union = Sets.union(codebaseFiles, writerFiles);

    for (String filename : union) {
      putFile(filename, c);
    }

    return new SvnDraftRevision(rootDirectory);
  }
Пример #2
0
 @Override
 public Repository create(String name, RepositoryConfig config) throws InvalidProject {
   if (name.equals("file")) {
     throw new InvalidProject("Invalid repository name (reserved keyword): \"" + name + "\"");
   }
   Repository.Factory factoryForConfig = serviceFactories.get(config.getType());
   if (factoryForConfig == null) {
     throw new InvalidProject("Invalid repository type: \"" + config.getType() + "\"");
   }
   return factoryForConfig.create(name, config);
 }
Пример #3
0
 public void checkOut() {
   try {
     SvnRepository.runSvnCommand(
         ImmutableList.of(
             "co", "-r", revision.revId, config.getUrl(), rootDirectory.getAbsolutePath()),
         "");
   } catch (CommandRunner.CommandException e) {
     throw new MoeProblem("Could not check out from svn: " + e.stderr);
   }
 }