Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.WorkDirCheckout


  }

  private void checkoutBranch(String branchName) throws Exception  {
    File workDir = db.getWorkTree();
    if (workDir != null) {
      WorkDirCheckout workDirCheckout = new WorkDirCheckout(db,
          workDir, db.mapCommit(Constants.HEAD).getTree(),
          db.getIndex(), db.mapCommit(branchName).getTree());
      workDirCheckout.setFailOnConflict(true);
      try {
        workDirCheckout.checkout();
      } catch (CheckoutConflictException e) {
        throw new JGitInternalException(
            "Couldn't check out because of conflicts", e);
      }
    }
View Full Code Here


    u.setNewObjectId(commit.getCommitId());
    u.forceUpdate();

    final GitIndex index = new GitIndex(db);
    final Tree tree = commit.getTree();
    final WorkDirCheckout co;

    co = new WorkDirCheckout(db, db.getWorkTree(), index, tree);
    co.checkout();
    index.write();
  }
View Full Code Here

      RevCommit newHeadCommit) throws IOException, CheckoutConflictException {
    GitIndex index = repo.getIndex();

    File workDir = repo.getWorkTree();
    if (workDir != null) {
      WorkDirCheckout workDirCheckout = new WorkDirCheckout(repo,
          workDir, headCommit.asCommit(revWalk).getTree(), index,
          newHeadCommit.asCommit(revWalk).getTree());
      workDirCheckout.setFailOnConflict(true);
      try {
        workDirCheckout.checkout();
      } catch (org.eclipse.jgit.errors.CheckoutConflictException e) {
        throw new CheckoutConflictException(
            JGitText.get().couldNotCheckOutBecauseOfConflicts,
            workDirCheckout.getConflicts(), e);
      }
      index.write();
    }
  }
View Full Code Here

        final GitIndex index = new GitIndex(repo);
        final Commit mapCommit = repo.mapCommit(branch.getObjectId());
        final Tree tree = mapCommit.getTree();
        final RefUpdate u;
        final WorkDirCheckout co;

        u = repo.updateRef(Constants.HEAD);
        u.setNewObjectId(mapCommit.getCommitId());
        u.forceUpdate();

        // checking out files
        co = new WorkDirCheckout(repo, repo.getWorkDir(), index, tree);
        co.checkout();
        // writing index
        index.write();
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.lib.WorkDirCheckout

Copyright © 2018 www.massapicom. 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.