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

Examples of com.google.devtools.moe.client.database.EquivalenceMatcher.EquivalenceMatchResult


   */
  public static List<Migration> determineMigrations(
      ProjectContext context, MigrationConfig migrationConfig, Db db) {

    Repository fromRepo = context.repositories.get(migrationConfig.getFromRepository());
    EquivalenceMatchResult equivMatch = fromRepo.revisionHistory.findRevisions(
        null,  // Start at head.
        new EquivalenceMatcher(migrationConfig.getToRepository(), db));

    // TODO(user): Decide whether to migrate linear or graph history here. Once DVCS Writers
    // support writing a graph of Revisions, we'll need to opt for linear or graph history based
    // on the MigrationConfig (e.g. whether or not the destination repo is linear-only).
    List<Revision> revisionsSinceEquivalence =
        Lists.reverse(equivMatch.getRevisionsSinceEquivalence().getLinearHistory());

    if (revisionsSinceEquivalence.isEmpty()) {
      AppContext.RUN.ui.info("No revisions found since last equivalence for migration '"
          + 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


    List<Revision> matching = ImmutableList.of(new Revision("1002", "repo1"));
    RevisionGraph nonMatching = RevisionGraph.builder(matching)
        .addRevision(startingRev, new RevisionMetadata("id", "author", "date", "desc", matching))
        .build();

    EquivalenceMatchResult result = equivalenceMatcher.makeResult(nonMatching, matching);
    assertEquals(nonMatching, result.getRevisionsSinceEquivalence());

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

    control.replay();

    FileDb database = FileDb.makeDbFromDbText(testDb1);
    SvnRevisionHistory history = new SvnRevisionHistory("repo2", "http://foo/svn/trunk/");

    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

    control.replay();

    FileDb database = FileDb.makeDbFromDbText(testDb2);
    SvnRevisionHistory history = new SvnRevisionHistory("repo2", "http://foo/svn/trunk/");

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

    control.verify();
   
    assertEquals(0, result.getEquivalences().size());
  }
View Full Code Here

   */
  private static void updateCompletedMigrations(
      String fromRepository, String toRepository, Db db, ProjectContext context, boolean inverse) {

    RevisionHistory toHistory = context.repositories.get(toRepository).revisionHistory;
    EquivalenceMatchResult equivMatch = toHistory.findRevisions(
        null /*revision*/,
        new EquivalenceMatcher(fromRepository, db));

    List<Revision> linearToRevs = equivMatch.getRevisionsSinceEquivalence().getLinearHistory();
    AppContext.RUN.ui.info(String.format(
        "Found %d revisions in %s since equivalence (%s): %s",
        linearToRevs.size(),
        toRepository,
        equivMatch.getEquivalences(),
        Joiner.on(", ").join(linearToRevs)));

    for (Revision toRev : linearToRevs) {
      String fromRevId = getMigratedRevId(toHistory.getMetadata(toRev));
      if (fromRevId != null) {
View Full Code Here

    FileDb database = FileDb.makeDbFromDbText(testDb1);

    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

    control.replay();

    FileDb database = FileDb.makeDbFromDbText(testDb2);

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

    assertEquals(0, result.getEquivalences().size());

    control.verify();
  }
View Full Code Here

    FileDb database = FileDb.makeDbFromDbText(testDb1);

    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));

    control.verify();
  }
View Full Code Here

    control.replay();

    FileDb database = FileDb.makeDbFromDbText(testDb2);
    GitRevisionHistory history = new GitRevisionHistory(Suppliers.ofInstance(mockRepo));
   
    EquivalenceMatchResult result = history.findRevisions(
        new Revision("4", "repo2"), new EquivalenceMatcher("repo1", database));

    assertEquals(0, result.getEquivalences().size());

    control.verify();
  }
View Full Code Here

TOP

Related Classes of com.google.devtools.moe.client.database.EquivalenceMatcher.EquivalenceMatchResult

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.