Package org.eclipse.jgit.api

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


    Git git = new Git(db);
    writeTrashFile("b", "Hello world b");
    writeTrashFile("a", "b");
    git.add().addFilepattern(".").call();
    git.commit().setMessage("add file b & file a").call();
    Ref branch_1 = git.branchCreate().setName("branch_1").call();
    git.rm().addFilepattern("a").call();
    git.commit().setMessage("delete file a").call();

    FileUtils.mkdirs(new File(db.getWorkTree(), "a"));
    writeTrashFile("a/c", "Hello world c");
View Full Code Here


    writeTrashFile("a/c", "Hello world c");
    writeTrashFile("b", "Hello world b");
    git.add().addFilepattern(".").call();
    RevCommit commit1 = git.commit().setMessage("add folder a & file b")
        .call();
    Ref branch_1 = git.branchCreate().setName("branch_1").call();
    git.rm().addFilepattern("a").call();
    RevCommit commit2 = git.commit().setMessage("delete folder a").call();

    TreeWalk tw = new TreeWalk(db);
    tw.addTree(commit1.getTree());
View Full Code Here

    FileUtils.mkdirs(new File(db.getWorkTree(), "a"));
    writeTrashFile("a/c", "Hello world c");
    writeTrashFile("b", "Hello world b");
    git.add().addFilepattern(".").call();
    git.commit().setMessage("add folder a & file b").call();
    Ref branch_1 = git.branchCreate().setName("branch_1").call();
    git.rm().addFilepattern("a").call();
    File fileA = new File(db.getWorkTree(), "a");
    writeTrashFile("a", "b");
    git.add().addFilepattern("a").call();
    git.commit().setMessage("add file a").call();
View Full Code Here

    Git git = new Git(db);
    writeTrashFile("a", "Hello world a");
    writeTrashFile("b", "Hello world b");
    git.add().addFilepattern(".").call();
    git.commit().setMessage("add files a & b").call();
    Ref branch_1 = git.branchCreate().setName("branch_1").call();
    writeTrashFile("a", "b");
    git.add().addFilepattern("a").call();
    git.commit().setMessage("add file a").call();

    FileEntry entry = new FileTreeIterator.FileEntry(new File(
View Full Code Here

    Git git = new Git(db);
    writeTrashFile("b", "Hello world b");
    writeTrashFile("a", "b");
    git.add().addFilepattern(".").call();
    git.commit().setMessage("add file b & file a").call();
    Ref branch_1 = git.branchCreate().setName("branch_1").call();
    git.rm().addFilepattern("a").call();
    writeTrashFile("a", "Hello world a");
    git.add().addFilepattern("a").call();
    git.commit().setMessage("add file a").call();
View Full Code Here

  public void testCheckoutPath() throws Exception {
    Git git = new Git(db);
    writeTrashFile("a", "Hello world a");
    git.add().addFilepattern(".").call();
    git.commit().setMessage("commit file a").call();
    git.branchCreate().setName("branch_1").call();
    git.checkout().setName("branch_1").call();
    File b = writeTrashFile("b", "Hello world b");
    git.add().addFilepattern("b").call();
    git.commit().setMessage("commit file b").call();
    File a = writeTrashFile("a", "New Hello world a");
View Full Code Here

    // dummy commit to start off a new branch on origin
    createFile(testFile.toURI(), "origin-test");
    Git git = new Git(db);
    git.add().addFilepattern(".").call();
    git.commit().setMessage("test commit").call();
    git.branchCreate().setName("test").setStartPoint(Constants.HEAD).call();

    createWorkspace(SimpleMetaStore.DEFAULT_WORKSPACE_NAME);
    IPath[] clonePaths = createTestProjects(workspaceLocation);

    for (IPath clonePath : clonePaths) {
View Full Code Here

      File branchFile = new File(dotGitDir.getParentFile(), "branch.txt");
      branchFile.createNewFile();
      createFile(branchFile.toURI(), "secondary-branch");
      git2.add().addFilepattern(".").call();
      git2.commit().setMessage("branch commit").call();
      git2.branchCreate().setName("branch").setStartPoint(Constants.HEAD).call();

      // create remote
      response = addRemote(remotesLocation, "secondary", dotGitDir.getParentFile().toURI().toURL().toString());
      String secondaryRemoteLocation = response.getHeaderField(ProtocolConstants.HEADER_LOCATION);
      assertNotNull(secondaryRemoteLocation);
View Full Code Here

            //if no local master exists, but a remote does, check it out
            if (!GitHelper.localBranchExists(git, context.getMaster()) && GitHelper.remoteBranchExists(git, context.getMaster(), reporter))
            {
                reporter.debugText(SHORT_NAME,"creating new local master branch from origin master");
                git.branchCreate()
                   .setName(context.getMaster())
                   .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM)
                   .setStartPoint("origin/" + context.getMaster())
                   .call();
            }
View Full Code Here

            if (!GitHelper.localBranchExists(git, context.getDevelop()))
            {
                if (GitHelper.remoteBranchExists(git, context.getDevelop(), reporter))
                {
                    reporter.debugText(SHORT_NAME,"creating new local develop branch from origin develop");
                    git.branchCreate()
                       .setName(context.getDevelop())
                       .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM)
                       .setStartPoint("origin/" + context.getDevelop())
                       .call();
                }
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.