Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.Git.merge()


      throw die(MessageFormat.format(
          CLIText.get().refDoesNotExistOrNoCommit, ref));

    Ref oldHead = db.getRef(Constants.HEAD);
    Git git = new Git(db);
    MergeCommand mergeCmd = git.merge().setStrategy(mergeStrategy)
        .setSquash(squash).setFastForward(ff).setCommit(!noCommit);
    if (srcRef != null)
      mergeCmd.include(srcRef);
    else
      mergeCmd.include(src);
View Full Code Here


    w.close();
    git.add().addFilepattern(file.getName()).call();
    git.commit().setMessage(file.getName() + " test").call();

    // merge the tip of the mergetest branch into master with --no-ff
    MergeResult mergeResult = git.merge().setFastForward(FastForwardMode.NO_FF).include(mergeTip.getId()).call();
    assertEquals(MergeResult.MergeStatus.MERGED, mergeResult.getMergeStatus());

    // push the merged master to the origin
    Iterable<PushResult> results = git.push().setCredentialsProvider(cp).setRemote("origin").call();
View Full Code Here

   * @return result
   * @throws Exception
   */
  protected MergeResult merge(String ref) throws Exception {
    Git git = Git.open(testRepo);
    return git.merge().setStrategy(MergeStrategy.RESOLVE)
        .include(CommitUtils.getCommit(git.getRepository(), ref))
        .call();
  }

  /**
 
View Full Code Here

      throw die(MessageFormat.format(
          CLIText.get().refDoesNotExistOrNoCommit, ref));

    Ref oldHead = db.getRef(Constants.HEAD);
    Git git = new Git(db);
    MergeCommand mergeCmd = git.merge().setStrategy(mergeStrategy)
        .setSquash(squash).setFastForward(ff).setCommit(!noCommit);
    if (srcRef != null)
      mergeCmd.include(srcRef);
    else
      mergeCmd.include(src);
View Full Code Here

    resetHard(topic);
    assertIndex(mkmap("f", "f()\nside", "G/i", "i()"));
    assertWorkDir(mkmap("f", "f()\nside", "G/i", "i()", "untracked",
        "untracked"));

    assertEquals(MergeStatus.CONFLICTING, git.merge().include(master)
        .call().getMergeStatus());
    assertEquals(
        "[D/g, mode:100644, stage:1][D/g, mode:100644, stage:3][E/h, mode:100644][G/i, mode:100644][f, mode:100644, stage:1][f, mode:100644, stage:2][f, mode:100644, stage:3]",
        indexState(0));
View Full Code Here

    // we have two branches which are criss-cross merged. Try to merge the
    // tips. This should succeed with RecursiveMerge and fail with
    // ResolveMerge
    try {
      MergeResult mergeResult = git.merge().setStrategy(strategy)
          .include(git.getRepository().getRef("refs/heads/side"))
          .call();
      assertEquals(MergeStrategy.RECURSIVE, strategy);
      assertEquals(MergeResult.MergeStatus.MERGED,
          mergeResult.getMergeStatus());
View Full Code Here

    git.commit().setMessage("added c.txt").call();

    // Get a handle to the the file so on windows it can't be deleted.
    FileInputStream fis = new FileInputStream(new File(db.getWorkTree(),
        "b.txt"));
    MergeResult mergeRes = git.merge().setStrategy(strategy)
        .include(masterCommit).call();
    if (mergeRes.getMergeStatus().equals(MergeStatus.FAILED)) {
      // probably windows
      assertEquals(1, mergeRes.getFailingPaths().size());
      assertEquals(MergeFailureReason.COULD_NOT_DELETE, mergeRes
View Full Code Here

        + lastTsIndex, "<1", "2", "3", "<.git/index");
    lastTsIndex = indexFile.lastModified();

    // merge master and side. Should only touch "0," "2" and "3"
    fsTick(indexFile);
    git.merge().setStrategy(strategy).include(masterCommit).call();
    checkConsistentLastModified("0", "1", "2", "4");
    checkModificationTimeStampOrder("4", "*" + lastTs4, "<1", "<*"
        + lastTsIndex, "<0", "2", "3", ".git/index");
    assertEquals(
        "[0, mode:100644, content:master]" //
View Full Code Here

    writeTrashFile("d/1", "1\n2\n3side");
    git.commit().setAll(true).setMessage("modified d/1 on side").call();

    git.rm().addFilepattern("d/1").call();
    git.rm().addFilepattern("d").call();
    MergeResult mergeRes = git.merge().setStrategy(strategy)
        .include(masterCommit).call();
    assertEquals(MergeStatus.MERGED, mergeRes.getMergeStatus());
    assertEquals("[d/1, mode:100644, content:1master\n2\n3side\n]",
        indexState(CONTENT));
  }
View Full Code Here

        .call();

    // Untracked directory e shall not conflict with merged e/1
    writeTrashFile("e/2", "d two");

    MergeResult mergeRes = git.merge().setStrategy(strategy)
        .include(masterCommit).call();
    assertEquals(MergeStatus.MERGED, mergeRes.getMergeStatus());
    assertEquals(
        "[d/1, mode:100644, content:1][e/1, mode:100644, content:4][f/1, mode:100644, content:5]",
        indexState(CONTENT));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.