Package com.google.devtools.moe.client

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


              localCloneTempDir.getAbsolutePath()),
          "" /*workingDirectory*/);
      clonedLocally = true;
      this.revId = "HEAD";
    } catch (CommandException e) {
      throw new MoeProblem(
          "Could not clone from git repo at " + repositoryUrl + ": " + e.stderr);
    }
  }
View Full Code Here


      if (!headCommitId.equals(revId)) {
        runGitCommand("checkout", revId, "-b", "moe_writing_branch_from_" + revId);
      }
      this.revId = revId;
    } catch (CommandException e) {
      throw new MoeProblem(
          "Could not update git repo at " + localCloneTempDir + ": " + e.stderr);
    }
  }
View Full Code Here

              "-C",
              archiveLocation.getAbsolutePath()),
          "");
   
    } catch (CommandException e) {
      throw new MoeProblem(
          "Could not archive git clone at " +
            localCloneTempDir.getAbsolutePath() + ": " + e.stderr);
    } catch (IOException e) {
      throw new MoeProblem(
          "IOException archiving clone at " +
              localCloneTempDir.getAbsolutePath() +
              " to revision " + revId + ": " + e);
    }
    return archiveLocation;
View Full Code Here

    for (String filename : filesToUpdate) {
      try {
        putFile(filename, incomingChangeCodebase);
      } catch (CommandException e) {
        throw new MoeProblem("problem occurred while running '" + e.cmd + "': " + e.stderr);
      }
    }

    return new DvcsDraftRevision(revClone);
  }
View Full Code Here

    File dest = new File(getRoot().getAbsolutePath(), relativeFilename);
    boolean srcExists = fs.exists(src);
    boolean destExists = fs.exists(dest);

    if (!srcExists && !destExists) {
      throw new MoeProblem(
          String.format("Neither src nor dests exists. Unreachable code:\n%s\n%s\n%s",
                        relativeFilename, src, dest));
    }

    if (!srcExists) {
      removeFile(relativeFilename);
      return;
    }

    try {
      fs.makeDirsForFile(dest);
      fs.copyFile(src, dest);
    } catch (IOException e) {
      throw new MoeProblem(e.getMessage());
    }

    if (destExists) {
      modifyFile(relativeFilename);
    } else {
View Full Code Here

            workList.addLast(parent);
          }
        }

        if (visited.size() > MAX_REVISIONS_TO_SEARCH) {
          throw new MoeProblem(String.format(
              "Couldn't find a matching revision for matcher (%s) in repo %s within %d revisions.",
              matcher,
              revision.repositoryName,
              MAX_REVISIONS_TO_SEARCH));
        }
View Full Code Here

    String hashID;
    GitClonedRepository headClone = headCloneSupplier.get();
    try {
      hashID = headClone.runGitCommand("log", "--max-count=1", "--format=%H", revId);
    } catch (CommandException e) {
      throw new MoeProblem(
          String.format(
              "Failed git log run: %d %s %s",
              e.returnStatus,
              e.stdout,
              e.stderr));
View Full Code Here

   */
  public static List<Revision> fromRepositoryExpression(
      RepositoryExpression repoEx, ProjectContext context) {
    Repository repo = context.repositories.get(repoEx.getRepositoryName());
    if (repo == null) {
      throw new MoeProblem("No repository " + repoEx.getRepositoryName());
    }
    if (Strings.isNullOrEmpty(repoEx.getOption("revision"))) {
      throw new MoeProblem(
          "Repository expression must have a 'revision' option, e.g. internal(revision=3,4,5).");
    }

    RevisionHistory rh = repo.revisionHistory;
    ImmutableList.Builder<Revision> revBuilder = ImmutableList.builder();
View Full Code Here

   */
  @Override
  public RevisionMetadata getMetadata(Revision revision) {
    GitClonedRepository headClone = headCloneSupplier.get();
    if (!headClone.getRepositoryName().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, headClone.getRepositoryName()));
    }

    // Format: hash, author, date, parents, full commit message (subject and body)
    String format = Joiner.on(LOG_DELIMITER).join("%H", "%an", "%ad", "%P", "%B");

    String log;
    try {
      log = headClone.runGitCommand(
          "log",
          // Ensure one revision only, to be safe.
          "--max-count=1",
          "--format=" + format,
          revision.revId);
    } catch (CommandException e) {
      throw new MoeProblem(
          String.format("Failed git run: %d %s %s", e.returnStatus, e.stdout, e.stderr));
    }

    return parseMetadata(log);
  }
View Full Code Here

              // TODO(dbentley): allow configuring the scrubber config
              "--config_data", (scrubberConfig == null) ? "{}" : scrubberConfig.toString(),
              input.getPath().getAbsolutePath()),
          SCRUBBER_BINARY_SUPPLIER.get().getParentFile().getPath());
    } catch (CommandRunner.CommandException e) {
      throw new MoeProblem(e.getMessage());
    }
    File expandedDir = null;
    try {
      expandedDir = Utils.expandTar(outputTar);
    } 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

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.