Package org.eclipse.jgit.api

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


    git.rm().addFilepattern("0").call();
    writeTrashFile("0/0", "modified");
    git.add().addFilepattern("0/0").call();
    try {
      git.merge().setStrategy(strategy).include(masterCommit).call();
      Assert.fail("Didn't get the expected exception");
    } catch (CheckoutConflictException e) {
      assertEquals(1, e.getConflictingPaths().size());
      assertEquals("0/0", e.getConflictingPaths().get(0));
    }
View Full Code Here


    writeTrashFile("1", "1\n2\n3side2");
    git.commit().setAll(true)
        .setMessage("modified 1 on side again").call();

    MergeResult result = git.merge().setStrategy(strategy)
        .include(masterCommit).call();
    assertEquals(MergeStatus.MERGED, result.getMergeStatus());
    result.getNewHead();
    git.checkout().setName("master").call();
    result = git.merge().setStrategy(strategy).include(sideCommit).call();
View Full Code Here

    MergeResult result = git.merge().setStrategy(strategy)
        .include(masterCommit).call();
    assertEquals(MergeStatus.MERGED, result.getMergeStatus());
    result.getNewHead();
    git.checkout().setName("master").call();
    result = git.merge().setStrategy(strategy).include(sideCommit).call();
    assertEquals(MergeStatus.MERGED, result.getMergeStatus());

    // we have two branches which are criss-cross merged. Try to merge the
    // tips. This should succeed with RecursiveMerge and fail with
    // ResolveMerge
View Full Code Here

    writeTrashFile("d/1", "side");
    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.CONFLICTING, mergeRes.getMergeStatus());
    assertEquals(
        "[d/1, mode:100644, stage:1, content:orig][d/1, mode:100644, stage:2, content:side][d/1, mode:100644, stage:3, content:master]",
        indexState(CONTENT));
View Full Code Here

            "", //
            "\tuntracked", //
            "" //
        }, execute("git status")); //
    // Merge test branch into master
    git.merge().include(testBranch.getId()).call();
    // Test unmerged status
    assertArrayOfLinesEquals(new String[] { // git status output
        "On branch master", //
            "Unmerged paths:", //
            "", //
View Full Code Here

    assertArrayOfLinesEquals(new String[] { // git status output
            "?? untracked", //
            "" //
        }, execute("git status --porcelain")); //
    // Merge test branch into master
    git.merge().include(testBranch.getId()).call();
    // Test unmerged status
    assertArrayOfLinesEquals(new String[] { // git status output
            "UU unmerged", //
            "?? untracked", //
            "" //
View Full Code Here

  private boolean merge(HttpServletRequest request, HttpServletResponse response, Repository db, String commitToMerge, boolean squash)
      throws ServletException, JSONException {
    try {
      ObjectId objectId = db.resolve(commitToMerge);
      Git git = new Git(db);
      MergeResult mergeResult = git.merge().setSquash(squash).include(objectId).call();
      JSONObject result = new JSONObject();
      result.put(GitConstants.KEY_RESULT, mergeResult.getMergeStatus().name());
      if (mergeResult.getFailingPaths() != null && !mergeResult.getFailingPaths().isEmpty())
        result.put(GitConstants.KEY_FAILING_PATHS, mergeResult.getFailingPaths());
      OrionServlet.writeJSONResponse(request, response, result, JsonURIUnqualificationStrategy.ALL_NO_GIT);
View Full Code Here

      public void run(IProgressMonitor mymonitor) throws CoreException {
        IProject[] validProjects = ProjectUtil.getValidOpenProjects(repository);
        mymonitor.beginTask(NLS.bind(CoreText.MergeOperation_ProgressMerge, refName), 3);
        Git git = new Git(repository);
        mymonitor.worked(1);
        MergeCommand merge = git.merge();
        try {
          Ref ref = repository.getRef(refName);
          if (ref != null)
            merge.include(ref);
          else
View Full Code Here

    ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ1)
        .getFolder(FOLDER).getFile(FILE2)
        .setContents(bis, false, false, null);
    bis.close();
    git.commit().setAll(true).setMessage("To be merged").call();
    git.merge().include(masterId).call();
    String menuLabel = util
        .getPluginLocalizedValue("CompareWithPreviousAction.label");
    SWTBotShell selectDialog = openCompareWithDialog(menuLabel, UIText.CommitSelectDialog_WindowTitle);
    assertEquals(2, selectDialog.bot().table().rowCount());
    selectDialog.close();
View Full Code Here

    git.checkout().setName("master").call();
    touch(PROJ1, "folder/test2.txt", "master");
    git.commit().setAll(true).setMessage("Master commit")
        .setCommitter(masterCommitter).call();

    git.merge().include(sideCommit).call();

    String contentAfterMerge = getTestFileContent();
    assertEquals("side", contentAfterMerge);

    String menuLabel = util
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.