Package com.google.devtools.moe.client.parser

Examples of com.google.devtools.moe.client.parser.RepositoryExpression


        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.
        Expression referenceToCodebase = new RepositoryExpression(migrationConfig.getToRepository())
              .withOption("localroot", toWriter.getRoot().getAbsolutePath());

        Ui.Task oneMigrationTask = AppContext.RUN.ui.pushTask(
            "perform_individual_migration",
            String.format("Performing individual migration '%s'", m.toString()));
View Full Code Here


        AppContext.RUN.ui.error(e, "Couldn't create DB");
        return 1;
      }
    }

    RepositoryExpression repoEx;
    try {
      repoEx = Parser.parseRepositoryExpression(options.fromRepository);
    } catch (ParseError e) {
      AppContext.RUN.ui.error(e, "Couldn't parse " + options.fromRepository);
      return 1;
    }

    Repository r = context.repositories.get(repoEx.getRepositoryName());
    if (r == null) {
      AppContext.RUN.ui.error("No repository" + repoEx.getRepositoryName() + ".");
      return 1;
    }

    RevisionHistory rh = r.revisionHistory;
    if (rh == null) {
      AppContext.RUN.ui.error("Repository " + r.name + " does not support revision history.");
      return 1;
    }

    Revision rev = rh.findHighestRevision(repoEx.getOption("revision"));

    List<Equivalence> lastEquivs = LastEquivalenceLogic.lastEquivalence(
        options.withRepository, rev, db, rh);

    if (lastEquivs.isEmpty()) {
View Full Code Here

    // Create the codebase instance.
    File codebasePath = getCodebasePath(new File(source));
    String projectSpace = options.containsKey(PROJECT_SPACE_OPTION)
                          ? options.get(PROJECT_SPACE_OPTION)
                          : "public";
    RepositoryExpression expression = new RepositoryExpression(new Term("file", options));
    return new Codebase(codebasePath, projectSpace, expression);
  }
View Full Code Here


    return new Codebase(
        new File("/dummy/codebase/" + name + "/" + revId),
        projectSpace,
        new RepositoryExpression(new Term(name, ImmutableMap.<String, String>of())));
  }
View Full Code Here

    } catch (InvalidProject e) {
      AppContext.RUN.ui.error(e, "Couldn't create project");
      return 1;
    }

    RepositoryExpression repoEx;
    try {
      repoEx = Parser.parseRepositoryExpression(options.repository);
    } catch (ParseError e) {
      AppContext.RUN.ui.error(e, "Couldn't parse " + options.repository);
      return 1;
    }

    Repository r = context.repositories.get(repoEx.getRepositoryName());
    if (r == null) {
      AppContext.RUN.ui.error("No repository " + repoEx.getRepositoryName());
      return 1;
    }

    RevisionHistory rh = r.revisionHistory;
    if (rh == null) {
      AppContext.RUN.ui.error("Repository " + r.name + " does not support revision history.");
      return 1;
    }

    Revision rev = rh.findHighestRevision(repoEx.getOption("revision"));
    if (rev == null) {
      return 1;
    }

    AppContext.RUN.ui.info("Highest revision in repository \"" + r.name + "\": " + rev.revId);
View Full Code Here

    } catch (InvalidProject e) {
      AppContext.RUN.ui.error(e, "Error creating project");
      return 1;
    }

    RepositoryExpression repoEx;
    try {
      repoEx = Parser.parseRepositoryExpression(options.fromRepository);
    } catch (ParseError e) {
      AppContext.RUN.ui.error(e, "Couldn't parse " + options.fromRepository);
      return 1;
View Full Code Here

      db = FileDb.makeDbFromFile(dbFile.getAbsolutePath());
    } else {
      db = new FileDb(new DbStorage());
    }

    RepositoryExpression repoEx1 = null, repoEx2 = null;
    try {
      repoEx1 = Parser.parseRepositoryExpression(options.repo1);
      repoEx2 = Parser.parseRepositoryExpression(options.repo2);
    } catch (ParseError e) {
      AppContext.RUN.ui.error(
          e, "Couldn't parse " + (repoEx1 == null ? options.repo1 : options.repo2));
      return 1;
    }

    if (repoEx1.getOption("revision") == null || repoEx2.getOption("revision") == null) {
      throw new MoeProblem("You must specify a revision in each repo, e.g. 'internal(revision=2)'");
    }

    // Sanity check: make sure the given repos and revisions exist.
    Repository repo1 = context.repositories.get(repoEx1.getRepositoryName());
    Repository repo2 = context.repositories.get(repoEx2.getRepositoryName());
    if (repo1 == null || repo2 == null) {
      AppContext.RUN.ui.error(
          "Unknown repository: " +
          (repo1 == null ? repoEx1.getRepositoryName() : repoEx2.getRepositoryName()));
      return 1;
    }

    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);
View Full Code Here

    } catch (InvalidProject e) {
      AppContext.RUN.ui.error(e, "Error creating project");
      return 1;
    }

    RepositoryExpression repoEx;
    try {
      repoEx = Parser.parseRepositoryExpression(options.repositoryExpression);
    } catch (ParseError e) {
      AppContext.RUN.ui.error(
          e, "Couldn't parse " + options.repositoryExpression);
View Full Code Here

    this.originalCodebase = originalCodebase;
    this.modifiedCodebase = modifiedCodebase;
    this.destinationCodebase = destinationCodebase;

    File mergedDir = AppContext.RUN.fileSystem.getTemporaryDirectory("merged_codebase_");
    RepositoryExpression mergedExpression = new RepositoryExpression(
        new Term("merged", ImmutableMap.<String, String>of()));
    this.mergedCodebase = new Codebase(mergedDir, "merged", mergedExpression);

    mergedFiles = Sets.newHashSet();
    failedToMergeFiles = Sets.newHashSet();
View Full Code Here

TOP

Related Classes of com.google.devtools.moe.client.parser.RepositoryExpression

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.