Esempio n. 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);
  }
Esempio n. 2
0
  @Override
  public DraftRevision putCodebase(Codebase c, RevisionMetadata rm) throws WritingError {
    DraftRevision dr = putCodebase(c);
    // Generate a shell script to commit repo with author and description
    String script =
        String.format(
            "svn update%n"
                + "svn commit -m \"%s\"%n"
                + "svn propset -r HEAD svn:author \"%s\" --revprop",
            rm.description, rm.author);
    Utils.makeShellScript(script, rootDirectory.getAbsolutePath() + "/svn_commit.sh");

    AppContext.RUN.ui.info(
        String.format(
            "To submit, run: cd %s && ./svn_commit.sh && cd -", rootDirectory.getAbsolutePath()));
    return dr;
  }