Package org.eclipse.jgit.api

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


    assertNotNull(git.commit().setMessage("edit file").call());

    LockFile lf = new LockFile(db.getIndexFile(), db.getFS());
    assertTrue(lf.lock());
    try {
      git.checkout().setName(commit1.name()).call();
      fail("JGitInternalException not thrown");
    } catch (JGitInternalException e) {
      assertTrue(e.getCause() instanceof LockFailedException);
      lf.unlock();
      git.checkout().setName(commit1.name()).call();
View Full Code Here


      git.checkout().setName(commit1.name()).call();
      fail("JGitInternalException not thrown");
    } catch (JGitInternalException e) {
      assertTrue(e.getCause() instanceof LockFailedException);
      lf.unlock();
      git.checkout().setName(commit1.name()).call();
    }
  }
}
View Full Code Here

    TestRepository<Repository> db_t = new TestRepository<Repository>(db);
    BranchBuilder master = db_t.branch("master");
    master.commit().add("f", "1").message("m0").create();
    assertFalse(new File(db.getWorkTree(), "f").exists());
    git.checkout().setName("master").call();
    assertTrue(new File(db.getWorkTree(), "f").exists());
  }

  private DirCacheCheckout resetHard(RevCommit commit)
      throws NoWorkTreeException,
View Full Code Here

    writeTrashFile(fname, "b");
    git.add().addFilepattern(fname).call();
    git.commit().setMessage("modify file").call();

    // Switch branches
    git.checkout().setName("side").call();
    git.rm().addFilepattern(fname).call();
    writeTrashFile(".gitignore", fname);
    git.add().addFilepattern(".gitignore").call();
    git.commit().setMessage("delete and ignore file").call();
View Full Code Here

    RevCommit masterCommit = git.commit()
        .setMessage("modified a.txt, deleted b.txt").setAll(true)
        .call();

    // switch back to a side branch
    git.checkout().setCreateBranch(true).setStartPoint(first)
        .setName("side").call();
    writeTrashFile("c.txt", "side");
    git.add().addFilepattern("c.txt").call();
    git.commit().setMessage("added c.txt").call();
View Full Code Here

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

    // Checkout a side branch. This should touch only "0", "2 and "3"
    fsTick(indexFile);
    git.checkout().setCreateBranch(true).setStartPoint(firstCommit)
        .setName("side").call();
    checkConsistentLastModified("0", "1", "2", "3", "4");
    checkModificationTimeStampOrder("1", "4", "*" + lastTs4, "<*"
        + lastTsIndex, "<0", "2", "3", ".git/index");
    lastTsIndex = indexFile.lastModified();
View Full Code Here

    DirCache dc = db.readDirCache();
    DirCacheEntry entry = dc.getEntry(path);

    long masterLastMod = entry.getLastModified();

    git.checkout().setCreateBranch(true).setName("side").call();

    Thread.sleep(10);
    String path2 = "file2";
    writeTrashFile(path2, "side content");
    git.add().addFilepattern(path2).call();
View Full Code Here

    long sideLastMode = entry.getLastModified();

    Thread.sleep(2000);

    writeTrashFile(path, "uncommitted content");
    git.checkout().setName("master").call();

    dc = db.readDirCache();
    entry = dc.getEntry(path);

    assertTrue("shall have equal mod time!", masterLastMod == sideLastMode);
View Full Code Here

        .message("s2(merge)").create();
    RevCommit m2 = master.commit().parent(s1).add("s", "s1")
        .message("m2(merge)").create();

    Git git = Git.wrap(db);
    git.checkout().setName("master").call();
    modifyWorktree(worktreeState, "m", "side");
    modifyWorktree(worktreeState, "s", "side");
    modifyIndex(indexState, "m", "side");
    modifyIndex(indexState, "s", "side");
View Full Code Here

        .parent(s1)
        .add("f", "1-master\n2\n3-res(master)\n4\n5\n6\n7\n8\n9-side\n")
        .message("m2(merge)").create();

    Git git = Git.wrap(db);
    git.checkout().setName("master").call();
    modifyWorktree(worktreeState, "f", "side");
    modifyIndex(indexState, "f", "side");

    ResolveMerger merger = (ResolveMerger) strategy.newMerger(db,
        worktreeState == WorktreeState.Bare);
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.