Package org.eclipse.jgit.api.RebaseCommand

Examples of org.eclipse.jgit.api.RebaseCommand.InteractiveHandler


    git.add().addFilepattern("file2").call();
    git.commit().setMessage("Add file2\nnew line").call();
    assertTrue(new File(db.getWorkTree(), "file2").exists());

    git.rebase().setUpstream("HEAD~1")
        .runInteractively(new InteractiveHandler() {

          public void prepareSteps(List<RebaseTodoLine> steps) {
            try {
              steps.get(0).setAction(Action.EDIT);
            } catch (IllegalTodoFileModification e) {
View Full Code Here


    writeTrashFile(FILE1, FILE1 + "b");
    git.add().addFilepattern(FILE1).call();
    git.commit().setMessage("Change file1").call();

    RebaseResult result = git.rebase().setUpstream("HEAD~2")
        .runInteractively(new InteractiveHandler() {

          public void prepareSteps(List<RebaseTodoLine> steps) {
            steps.remove(0);
            try {
              steps.get(0).setAction(Action.EDIT);
View Full Code Here

    writeTrashFile(FILE1, FILE1 + "b");
    git.add().addFilepattern(FILE1).call();
    git.commit().setMessage("Change file1").call();

    RebaseResult result = git.rebase().setUpstream("HEAD~2")
        .runInteractively(new InteractiveHandler() {

          public void prepareSteps(List<RebaseTodoLine> steps) {
            steps.remove(0);
            try {
              steps.get(0).setAction(Action.REWORD);
            } catch (IllegalTodoFileModification e) {
              fail("unexpected exception: " + e);
            }
          }

          public String modifyCommitMessage(String commit) {
            return "rewritten commit message";
          }
        }).call();
    assertEquals(Status.STOPPED, result.getStatus());
    git.add().addFilepattern(FILE1).call();
    result = git.rebase().runInteractively(new InteractiveHandler() {

      public void prepareSteps(List<RebaseTodoLine> steps) {
        steps.remove(0);
        try {
          steps.get(0).setAction(Action.REWORD);
View Full Code Here

    writeTrashFile(FILE1, FILE1 + "b");
    git.add().addFilepattern(FILE1).call();
    git.commit().setMessage("Change file1").call();

    RebaseResult result = git.rebase().setUpstream("HEAD~3")
        .runInteractively(new InteractiveHandler() {

          public void prepareSteps(List<RebaseTodoLine> steps) {
            try {
              steps.get(0).setAction(Action.PICK);
              steps.remove(1);
              steps.get(1).setAction(Action.SQUASH);
            } catch (IllegalTodoFileModification e) {
              fail("unexpected exception: " + e);
            }
          }

          public String modifyCommitMessage(String commit) {
            return "squashed message";
          }
        }).call();
    assertEquals(Status.STOPPED, result.getStatus());
    git.add().addFilepattern(FILE1).call();
    result = git.rebase().runInteractively(new InteractiveHandler() {

      public void prepareSteps(List<RebaseTodoLine> steps) {
        try {
          steps.get(0).setAction(Action.PICK);
          steps.remove(1);
View Full Code Here

    git.add().addFilepattern(FILE1).call();
    git.add().addFilepattern("file3").call();
    git.commit().setMessage("Change file1, add file3").call();

    RebaseResult result = git.rebase().setUpstream("HEAD~3")
        .runInteractively(new InteractiveHandler() {

          public void prepareSteps(List<RebaseTodoLine> steps) {
            try {
              steps.get(0).setAction(Action.PICK);
              steps.remove(1);
              steps.get(1).setAction(Action.FIXUP);
            } catch (IllegalTodoFileModification e) {
              fail("unexpected exception: " + e);
            }
          }

          public String modifyCommitMessage(String commit) {
            return commit;
          }
        }).call();
    assertEquals(Status.STOPPED, result.getStatus());
    git.add().addFilepattern(FILE1).call();
    result = git.rebase().runInteractively(new InteractiveHandler() {

      public void prepareSteps(List<RebaseTodoLine> steps) {
        try {
          steps.get(0).setAction(Action.PICK);
          steps.remove(1);
View Full Code Here

    // do not commit
    writeTrashFile("file0", "modified file0");

    // start rebase
    RebaseResult result = git.rebase().setUpstream("HEAD~2")
        .runInteractively(new InteractiveHandler() {

          public void prepareSteps(List<RebaseTodoLine> steps) {
            try {
              steps.get(0).setAction(Action.EDIT);
              steps.get(1).setAction(Action.PICK);
View Full Code Here

  }

  @Override
  protected RebaseOperation createRebaseOperation(Repository repository)
      throws ExecutionException {
    InteractiveHandler handler = interactive ? RebaseInteractiveHandler.INSTANCE
        : null;
    RebaseOperation operation = new RebaseOperation(repository, ref,
        handler);
    operation.setPreserveMerges(preserveMerges);
    return operation;
View Full Code Here

        pm.subTask(MessageFormat.format(
            CoreText.CherryPickOperation_cherryPicking,
            Integer.valueOf(commits.size())));

        InteractiveHandler handler = new InteractiveHandler() {
          public void prepareSteps(List<RebaseTodoLine> steps) {
            for (RebaseTodoLine step : steps) {
              try {
                step.setAction(RebaseTodoLine.Action.PICK);
              } catch (IllegalTodoFileModification e) {
View Full Code Here

    } catch (GitAPIException e) {
      Activator.logError(e.getMessage(), e);
      return null;
    }

    InteractiveHandler messageHandler = new InteractiveHandler() {
      public void prepareSteps(List<RebaseTodoLine> steps) {
        // not used
      }

      public String modifyCommitMessage(String oldMessage) {
View Full Code Here

        pm.subTask(MessageFormat.format(
            CoreText.EditCommitOperation_editing,
            commit.name()));

        InteractiveHandler handler = new InteractiveHandler() {
          public void prepareSteps(List<RebaseTodoLine> steps) {
            for (RebaseTodoLine step : steps) {
              if (step.getCommit().prefixCompare(commit) == 0) {
                try {
                  step.setAction(RebaseTodoLine.Action.EDIT);
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.api.RebaseCommand.InteractiveHandler

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.