Package org.eclipse.jgit.api

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


    writeTrashFile("d/1", "master");
    RevCommit masterCommit = git.commit().setAll(true)
        .setMessage("modified d/1 on master").call();

    git.checkout().setCreateBranch(true).setStartPoint(first)
        .setName("side").call();
    writeTrashFile("d/1", "side");
    git.commit().setAll(true).setMessage("modified d/1 on side").call();

    git.rm().addFilepattern("d/1").call();
View Full Code Here


    FileEntry entry = new FileTreeIterator.FileEntry(new File(
        db.getWorkTree(), "a"), db.getFS());
    assertEquals(FileMode.SYMLINK, entry.getMode());

    git.checkout().setName(branch_1.getName()).call();

    entry = new FileTreeIterator.FileEntry(new File(db.getWorkTree(), "a"),
        db.getFS());
    assertEquals(FileMode.REGULAR_FILE, entry.getMode());
  }
View Full Code Here

    FileEntry entry = new FileTreeIterator.FileEntry(new File(
        db.getWorkTree(), "a"), db.getFS());
    assertEquals(FileMode.REGULAR_FILE, entry.getMode());

    git.checkout().setName(branch_1.getName()).call();

    entry = new FileTreeIterator.FileEntry(new File(db.getWorkTree(), "a"),
        db.getFS());
    assertEquals(FileMode.SYMLINK, entry.getMode());
  }
View Full Code Here

    FileEntry entry = new FileTreeIterator.FileEntry(new File(
        db.getWorkTree(), "a"), db.getFS());
    assertEquals(FileMode.SYMLINK, entry.getMode());

    git.checkout().setName(branch_1.getName()).call();

    entry = new FileTreeIterator.FileEntry(new File(db.getWorkTree(), "a"),
        db.getFS());
    assertEquals(FileMode.TREE, entry.getMode());
  }
View Full Code Here

    FileEntry entry = new FileTreeIterator.FileEntry(new File(
        db.getWorkTree(), "a"), db.getFS());
    assertEquals(FileMode.TREE, entry.getMode());

    git.checkout().setName(branch_1.getName()).call();

    entry = new FileTreeIterator.FileEntry(new File(db.getWorkTree(), "a"),
        db.getFS());
    assertEquals(FileMode.SYMLINK, entry.getMode());
  }
View Full Code Here

    Ref branch_1 = git.branchCreate().setName("branch_1").call();
    FileUtils.createSymLink(new File(db.getWorkTree(), "a"), "b");
    git.add().addFilepattern("a").call();
    RevCommit commit2 = git.commit().setMessage("add symlink a").call();

    git.checkout().setName(branch_1.getName()).call();

    TreeWalk tw = new TreeWalk(db);
    tw.addTree(commit1.getTree());
    tw.addTree(commit2.getTree());
    List<DiffEntry> scan = DiffEntry.scan(tw);
View Full Code Here

        .call();
    Ref branch_1 = git.branchCreate().setName("branch_1").call();
    git.rm().addFilepattern("a").call();
    RevCommit commit2 = git.commit().setMessage("delete symlink a").call();

    git.checkout().setName(branch_1.getName()).call();

    TreeWalk tw = new TreeWalk(db);
    tw.addTree(commit1.getTree());
    tw.addTree(commit2.getTree());
    List<DiffEntry> scan = DiffEntry.scan(tw);
View Full Code Here

    writeTrashFile("target", "someData");
    FileUtils.createSymLink(new File(db.getWorkTree(), "link"), "target");
    git.add().addFilepattern("target").addFilepattern("link").call();
    git.commit().setMessage("add target").call();
    assertEquals(4, db.getWorkTree().list().length); // self-check
    git.checkout().setName(base.name()).call();
    assertEquals(2, db.getWorkTree().list().length); // self-check
    git.checkout().setName("master").call();
    assertEquals(4, db.getWorkTree().list().length);
    String data = read(new File(db.getWorkTree(), "target"));
    assertEquals(8, new File(db.getWorkTree(), "target").length());
View Full Code Here

    git.add().addFilepattern("target").addFilepattern("link").call();
    git.commit().setMessage("add target").call();
    assertEquals(4, db.getWorkTree().list().length); // self-check
    git.checkout().setName(base.name()).call();
    assertEquals(2, db.getWorkTree().list().length); // self-check
    git.checkout().setName("master").call();
    assertEquals(4, db.getWorkTree().list().length);
    String data = read(new File(db.getWorkTree(), "target"));
    assertEquals(8, new File(db.getWorkTree(), "target").length());
    assertEquals("someData", data);
    data = read(new File(db.getWorkTree(), "link"));
View Full Code Here

    writeTrashFile("target", "someData");
    FileUtils.createSymLink(new File(db.getWorkTree(), "tlink"), "target");
    git.add().addFilepattern("target").addFilepattern("tlink").call();
    git.commit().setMessage("add target").call();
    assertEquals(4, db.getWorkTree().list().length); // self-check
    git.checkout().setName(base.name()).call();
    assertEquals(2, db.getWorkTree().list().length); // self-check
    git.checkout().setName("master").call();
    assertEquals(4, db.getWorkTree().list().length);
    String data = read(new File(db.getWorkTree(), "target"));
    assertEquals(8, new File(db.getWorkTree(), "target").length());
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.