Package com.google.devtools.moe.client.codebase

Examples of com.google.devtools.moe.client.codebase.Codebase


    AppContext.RUN.fileSystem = fileSystem;

    File shellRun = new File("/shell_run_foo");
    File codebaseFile = new File("/codebase");

    Codebase codebase = new Codebase(codebaseFile,
                                     "internal",
                                     null /* CodebaseExpression is not needed here. */);


    expect(fileSystem.getTemporaryDirectory("shell_run_")).andReturn(shellRun);
View Full Code Here


* @author dbentley@google.com (Daniel Bentley)
*/
public class PatchCodebaseDifferenceRendererTest extends TestCase {
 
  private static Codebase makeCodebase(String name) throws Exception {
    return new Codebase(new File("/" + name), "public",
                        new RepositoryExpression(name));
  }
View Full Code Here

                        new RepositoryExpression(name));
  }

  public void testRender() throws Exception {

    Codebase c1 = makeCodebase("c1");
    Codebase c2 = makeCodebase("c2");

    ImmutableSet.Builder<FileDifference> diffs = ImmutableSet.builder();

    diffs.add(new FileDifference(
        "foo", new File("/c1/foo"), new File("/c2/foo"),
View Full Code Here

  }


  public void testEdit() throws Exception {
    File codebaseFile = new File("/codebase/");
    Codebase codebase = new Codebase(codebaseFile,
                                     "internal",
                                     null /* CodebaseExpression is not needed here. */);

    File oldSubFile = new File("/codebase/moe.txt");
    File renameRun = new File("/rename_run_foo");
View Full Code Here

    InverseRenamingEditor inverseRenamey = new InverseRenamingEditor(
        new RenamingEditor(
            "renamey", ImmutableMap.of("internal_root", "public_root"), false /*useRegex*/));

    Codebase input = new Codebase(new File("/input"), "public", new RepositoryExpression("input"));
    Codebase destination =
        new Codebase(new File("/destination"), "public", new RepositoryExpression("destination"));

    expect(mockFs.getTemporaryDirectory("inverse_rename_run_")).andReturn(new File("/output"));

    expect(mockFs.findFiles(new File("/input"))).andReturn(ImmutableSet.of(
        new File("/input/toplevel.txt"),
        new File("/input/public_root/1.txt"),
        new File("/input/public_root/new.txt"),
        new File("/input/public_root/inner1/inner2/innernew.txt")));

    expect(mockFs.findFiles(new File("/destination"))).andReturn(ImmutableSet.of(
        new File("/destination/internal_root/1.txt")));

    expectCopy(mockFs, "/input/toplevel.txt", "/output/toplevel.txt");
    expectCopy(mockFs, "/input/public_root/1.txt", "/output/internal_root/1.txt");
    expectCopy(mockFs, "/input/public_root/new.txt", "/output/internal_root/new.txt");
    expectCopy(mockFs, "/input/public_root/inner1/inner2/innernew.txt",
                       "/output/internal_root/inner1/inner2/innernew.txt");

    control.replay();
    Codebase inverseRenamed = inverseRenamey.inverseEdit(
        input, null /*referenceFrom*/, destination, context, ImmutableMap.<String, String>of());
    assertEquals(new File("/output"), inverseRenamed.getPath());
    control.verify();
  }
View Full Code Here

    expect(fileSystem.findFiles(f("/codebase"))).andReturn(ImmutableSet.<File>of());
    expect(fileSystem.findFiles(f("/writer"))).andReturn(
        ImmutableSet.<File>of(f("/writer/.svn/")));

    control.replay();
    Codebase c = new Codebase(f("/codebase"), "public",
                              e("public", ImmutableMap.<String, String>of()));
    SvnWriter e = new SvnWriter(mockConfig, null, f("/writer"));
    DraftRevision r = e.putCodebase(c);
    control.verify();
    assertEquals("/writer", r.getLocation());
View Full Code Here

    control.verify();
    assertEquals("/writer", r.getLocation());
  }

  public void testWrongProjectSpace() throws Exception {
    Codebase c = new Codebase(f("/codebase"), "internal",
                              e("internal", ImmutableMap.<String, String>of()));
    SvnWriter e = new SvnWriter(mockConfig, null, f("/writer"));
    try {
      DraftRevision r = e.putCodebase(c);
      fail();
View Full Code Here

    expect(fileSystem.isExecutable(f("/codebase/foo"))).andReturn(false);
    expect(fileSystem.isExecutable(f("/writer/foo"))).andReturn(false);
    expectSvnCommand(ImmutableList.of("rm", "foo"), "/writer", "", cmd);
    control.replay();
    Codebase c = new Codebase(f("/codebase"), "public",
                              e("public", ImmutableMap.<String, String>of()));
    SvnWriter e = new SvnWriter(mockConfig, null, f("/writer"));
    e.putFile("foo", c);
    control.verify();
  }
View Full Code Here

    } catch (IOException e) {
      throw new MoeProblem(e.getMessage());
    } catch (CommandRunner.CommandException e) {
      throw new MoeProblem(e.getMessage());
    }
    return new Codebase(expandedDir, input.getProjectSpace(), input.getExpression());
  }
View Full Code Here

   * Diff codebases at HEADs of fromRepository and toRepository, adding an Equivalence to db if
   * equivalent at HEADs.
   */
  private static void updateHeadEquivalence(String fromRepository, String toRepository,
                                            Db db, ProjectContext context) {
    Codebase to, from;
    try {
      to = new RepositoryExpression(toRepository).createCodebase(context);
      from = new RepositoryExpression(fromRepository)
          .translateTo(to.getProjectSpace())
          .createCodebase(context);
    } catch (CodebaseCreationError e) {
      AppContext.RUN.ui.error(e, "Could not generate codebase");
      return;
    }

    Ui.Task t = AppContext.RUN.ui.pushTask(
        "diff_codebases",
        String.format("Diff codebases '%s' and '%s'", from.toString(), to.toString()));
    if (!CodebaseDifference.diffCodebases(from, to).areDifferent()) {
      RevisionHistory fromHistory = context.repositories.get(fromRepository).revisionHistory;
      RevisionHistory toHistory = context.repositories.get(toRepository).revisionHistory;

      // TODO(user): Pull highest revision from the created codebases, not over again (in case
View Full Code Here

TOP

Related Classes of com.google.devtools.moe.client.codebase.Codebase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.