Package org.eclipse.jgit.api

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


    try {
      Git git = new Git(db);
      String originalBranch = git.getRepository().getFullBranch();
      if (git.getRepository().getRef(branch) == null)
        git.branchCreate().setName(branch).call();
      git.checkout().setName(branch).call();
      writeTrashFile(filename, contents);
      git.add().addFilepattern(filename).call();
      RevCommit commit = git.commit()
          .setMessage(branch + ": " + filename).call();
      if (originalBranch != null)
View Full Code Here


      writeTrashFile(filename, contents);
      git.add().addFilepattern(filename).call();
      RevCommit commit = git.commit()
          .setMessage(branch + ": " + filename).call();
      if (originalBranch != null)
        git.checkout().setName(originalBranch).call();
      return commit;
    } catch (IOException e) {
      throw new RuntimeException(e);
    } catch (GitAPIException e) {
      throw new RuntimeException(e);
View Full Code Here

                       .setName(context.getDevelop())
                       .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.NOTRACK)
                       .call();
                }
            }
            git.checkout().setName(context.getDevelop()).call();

            //setup prefixes
            for (String prefixName : gfConfig.getPrefixNames())
            {
                if (!gfConfig.hasPrefixConfigured(prefixName) || force)
View Full Code Here

            Set<String> localBranchNames = JGitBranchCommand.getShortLocalBranchNames( git );
            if ( version instanceof ScmTag )
            {
                getLogger().info( "checkout tag [" + branch + "] at " + fileSet.getBasedir() );
                git.checkout().setName( branch ).call();
            }
            else if ( localBranchNames.contains( branch ) )
            {
                getLogger().info( "checkout [" + branch + "] at " + fileSet.getBasedir() );
                git.checkout().setName( branch ).call();
View Full Code Here

                git.checkout().setName( branch ).call();
            }
            else if ( localBranchNames.contains( branch ) )
            {
                getLogger().info( "checkout [" + branch + "] at " + fileSet.getBasedir() );
                git.checkout().setName( branch ).call();
            }
            else
            {
                getLogger().info( "checkout remote branch [" + branch + "] at " + fileSet.getBasedir() );
                git.checkout().setName( branch ).setCreateBranch( true ).setStartPoint( Constants.DEFAULT_REMOTE_NAME
View Full Code Here

                git.checkout().setName( branch ).call();
            }
            else
            {
                getLogger().info( "checkout remote branch [" + branch + "] at " + fileSet.getBasedir() );
                git.checkout().setName( branch ).setCreateBranch( true ).setStartPoint( Constants.DEFAULT_REMOTE_NAME
                                                                                            + "/" + branch ).call();
            }

            RevWalk revWalk = new RevWalk( git.getRepository() );
            RevCommit commit = revWalk.parseCommit( git.getRepository().resolve( Constants.HEAD ) );
View Full Code Here

            projectMetadata.setCurrentBranch(branchMetadata);

            Git git = historyService.projectGitRepository(projectMetadata);
            try {
                git.checkout()
                        .setName(branchName)
                        .call();
            } finally {
                git.close();
            }
View Full Code Here

    GitBlitSuite.close(clone.call());

    Git git = Git.open(local);

    // checkout a mergetest branch
    git.checkout().setCreateBranch(true).setName("mergetest").call();

    // change identity
    git.getRepository().getConfig().setString("user", null, "name", "mergetest");
    git.getRepository().getConfig().setString("user", null, "email", "mergetest@merge.com");
    git.getRepository().getConfig().save();
View Full Code Here

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

    // return to master
    git.checkout().setName("master").call();

    // restore identity
    if (expectedSuccess) {
      git.getRepository().getConfig().setString("user", null, "name", user.username);
      git.getRepository().getConfig().setString("user", null, "email", user.emailAddress);
View Full Code Here

   * @return branch ref
   * @throws Exception
   */
  protected Ref checkout(File repo, String name) throws Exception {
    Git git = Git.open(repo);
    Ref ref = git.checkout().setName(name).call();
    assertNotNull(ref);
    return ref;
  }

  /**
 
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.