Package com.google.devtools.moe.client

Examples of com.google.devtools.moe.client.MoeProblem


              ImmutableList.of(new Revision(parentId, name))));
        }
      }
      return resultBuilder.build();
    } catch (Exception e) {
      throw new MoeProblem("Could not parse xml log: " + log + e.getMessage());
    }
  }
View Full Code Here


        // Erase leading path separators, e.g. when the rule "dir" -> "" maps
        // "dir/filename.txt" to "/filename.txt".
        return SEP_CHAR_MATCHER.trimLeadingFrom(renamed);
      }
    }
    throw new MoeProblem(String.format(
        "Cannot find a rename mapping that covers file %s. "
        + "Every file needs an applicable renaming rule.", inputFilename));
  }
View Full Code Here

    try {
      copyDirectoryAndRename(input.getPath().getAbsoluteFile(),
                             input.getPath().getAbsoluteFile(),
                             tempDir.getAbsoluteFile());
    } catch (IOException e) {
      throw new MoeProblem(e.getMessage());
    }
    return new Codebase(tempDir, input.getProjectSpace(), input.getExpression());
  }
View Full Code Here

    return new Codebase(tempDir, input.getProjectSpace(), input.getExpression());
  }

  public static RenamingEditor makeRenamingEditor(String editorName, EditorConfig config) {
    if (config.getMappings() == null) {
      throw new MoeProblem(String.format("No mappings object found in the config for editor %s",
          editorName));
    }
    return new RenamingEditor(editorName,
                              RenamingEditor.parseJsonMap(config.getMappings()),
                              config.getUseRegex());
View Full Code Here

  public Codebase edit(Codebase input, ProjectContext context, Map<String, String> options) {
    File tempDir = AppContext.RUN.fileSystem.getTemporaryDirectory("shell_run_");
    try {
     Utils.copyDirectory(input.getPath(), tempDir);
    } catch (IOException e) {
      throw new MoeProblem(e.getMessage());
    } catch (CommandRunner.CommandException e) {
      throw new MoeProblem(e.getMessage());
    }
    try {
      AppContext.RUN.cmd.runCommand("bash", ImmutableList.of("-c", this.commandString),
          tempDir.getAbsolutePath());
    } catch (CommandRunner.CommandException e) {
      throw new MoeProblem(e.getMessage());
    }
    return new Codebase(tempDir, input.getProjectSpace(), input.getExpression());
  }
View Full Code Here

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

    }

    @Override
    public RevisionMetadata getMetadata(Revision revision) throws MoeProblem {
      if (!name.equals(revision.repositoryName)) {
        throw new MoeProblem (
            String.format("Could not get metadata: Revision %s is in repository %s instead of %s",
                          revision.revId, revision.repositoryName, name));
      }
      return new RevisionMetadata(revision.revId, "author", "date",
                                  revision.revId.equals("migrated_to") ?
View Full Code Here

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

  @Override
  public void writeToLocation(String dbLocation) {
    try {
      AppContext.RUN.fileSystem.write(toJsonString(), new File(dbLocation));
    } catch (IOException e) {
      throw new MoeProblem(e.getMessage());
    }
  }
View Full Code Here

    try {
      String dbText = AppContext.RUN.fileSystem.fileToString(new File(path));
      try {
        return makeDbFromDbText(dbText);
      } catch (InvalidProject e) {
        throw new MoeProblem(e.getMessage());
      }
    } catch (IOException e) {
      throw new MoeProblem(e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.devtools.moe.client.MoeProblem

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.