Package com.google.devtools.moe.client.database

Examples of com.google.devtools.moe.client.database.Equivalence


          + migrationConfig.getName() + "'");
      return ImmutableList.of();
    }

    // TODO(user): Figure out how to report all equivalences.
    Equivalence lastEq = equivMatch.getEquivalences().get(0);
    AppContext.RUN.ui.info(String.format("Found %d revisions in %s since equivalence (%s): %s",
        revisionsSinceEquivalence.size(),
        migrationConfig.getFromRepository(),
        lastEq,
        Joiner.on(", ").join(revisionsSinceEquivalence)));
View Full Code Here


    EquivalenceMatchResult result = history.findRevisions(
        new Revision("4", "repo2"), new EquivalenceMatcher("repo1", database));

    control.verify();

    Equivalence expectedEq = new Equivalence(new Revision("1002", "repo1"),
                                             new Revision("2", "repo2"));
   
    assertEquals(1, result.getEquivalences().size());
    assertEquals(expectedEq, result.getEquivalences().get(0));
  }
View Full Code Here

    assertEquals(0, d.perform());
    control.verify();

    // expected db at end of call to bookkeep
    DbStorage dbStorage = new DbStorage();
    dbStorage.addEquivalence(new Equivalence(new Revision("1", "int"), new Revision("1", "pub")));
    dbStorage.addMigration(new SubmittedMigration(
        new Revision("migrated_from", "int"), new Revision("migrated_to", "pub")));
    FileDb expectedDb = new FileDb(dbStorage);

    assertEquals(expectedDb.toJsonString(), fileSystem.fileToString(DB_FILE));
View Full Code Here

    assertEquals(0, d.perform());
    control.verify();

    // expected db at end of call to bookkeep
    DbStorage dbStorage = new DbStorage();
    dbStorage.addEquivalence(new Equivalence(
        new Revision("migrated_from", "int"), new Revision("migrated_to", "pub")));
    dbStorage.addMigration(new SubmittedMigration(
        new Revision("migrated_from", "int"), new Revision("migrated_to", "pub")));
    FileDb expectedDb = new FileDb(dbStorage);
View Full Code Here

      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
      // head has moved forward meanwhile).
      db.noteEquivalence(new Equivalence(fromHistory.findHighestRevision(null),
                                         toHistory.findHighestRevision(null)));
    }
    AppContext.RUN.ui.popTask(t, "");
  }
View Full Code Here

    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()) {
      Equivalence newEquiv = new Equivalence(fromRev, toRev);
      db.noteEquivalence(newEquiv);
      AppContext.RUN.ui.info("Codebases are identical, noted new equivalence: " + newEquiv);
    }
    AppContext.RUN.ui.popTask(t, "");
  }
View Full Code Here

      if (migrations.isEmpty()) {
        AppContext.RUN.ui.info("No pending revisions to migrate for " + migrationName);
        continue;
      }

      Equivalence lastEq = migrations.get(0).sinceEquivalence;
      // toRe represents toRepo at the revision of last equivalence with fromRepo.
      RepositoryExpression toRe = new RepositoryExpression(migrationConfig.getToRepository());
      if (lastEq != null) {
        toRe = toRe.atRevision(
            lastEq.getRevisionForRepository(migrationConfig.getToRepository()).revId);
      }

      Writer toWriter;
      try {
        toWriter = toRe.createWriter(context);
      } catch (WritingError e) {
        throw new MoeProblem("Couldn't create local repo " + toRe + ": " + e);
      }

      DraftRevision dr = null;
      Revision lastMigratedRevision = null;
      if (lastEq != null) {
        lastMigratedRevision = lastEq.getRevisionForRepository(migrationConfig.getFromRepository());
      }

      for (Migration m : migrations) {
        // For each migration, the reference to-codebase for inverse translation is the Writer,
        // since it contains the latest changes (i.e. previous migrations) to the to-repository.
View Full Code Here

    }

    Revision realRev1 = repo1.revisionHistory.findHighestRevision(repoEx1.getOption("revision"));
    Revision realRev2 = repo2.revisionHistory.findHighestRevision(repoEx2.getOption("revision"));

    Equivalence newEq = new Equivalence(realRev1, realRev2);
    db.noteEquivalence(newEq);
    db.writeToLocation(options.dbLocation);

    AppContext.RUN.ui.info("Noted equivalence: " + newEq);
View Full Code Here

    HgRevisionHistory history = new HgRevisionHistory(Suppliers.ofInstance(mockRepo));

    EquivalenceMatchResult result =
        history.findRevisions(null, new EquivalenceMatcher("repo1", database));

    Equivalence expectedEq = new Equivalence(new Revision("1002", "repo1"),
                                             new Revision("2", "repo2"));
    assertEquals(ImmutableList.of(expectedEq), result.getEquivalences());

    control.verify();
  }
View Full Code Here

    GitRevisionHistory history = new GitRevisionHistory(Suppliers.ofInstance(mockRepo));

    EquivalenceMatchResult result = history.findRevisions(
        new Revision("4", "repo2"), new EquivalenceMatcher("repo1", database));
   
    Equivalence expectedEq = new Equivalence(new Revision("1002", "repo1"),
                                             new Revision("2", "repo2"));

    assertEquals(1, result.getEquivalences().size());
    assertEquals(expectedEq, result.getEquivalences().get(0));
View Full Code Here

TOP

Related Classes of com.google.devtools.moe.client.database.Equivalence

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.