Package org.eclipse.jgit.dircache

Examples of org.eclipse.jgit.dircache.DirCache.editor()


  private void resetIndexForPaths(RevCommit commit) {
    DirCache dc = null;
    final DirCacheEditor edit;
    try {
      dc = repo.lockDirCache();
      edit = dc.editor();

      final TreeWalk tw = new TreeWalk(repo);
      tw.addTree(new DirCacheIterator(dc));
      tw.addTree(commit.getTree());
      tw.setFilter(PathFilterGroup.createFromStrings(filepaths));
View Full Code Here


  protected CheckoutCommand checkoutPaths() throws IOException,
      RefNotFoundException {
    RevWalk revWalk = new RevWalk(repo);
    DirCache dc = repo.lockDirCache();
    try {
      DirCacheEditor editor = dc.editor();
      TreeWalk startWalk = new TreeWalk(revWalk.getObjectReader());
      startWalk.setRecursive(true);
      startWalk.setFilter(PathFilterGroup.createFromStrings(paths));
      boolean checkoutIndex = startCommit == null && startPoint == null;
      if (!checkoutIndex)
View Full Code Here

      List<String> files = new LinkedList<String>();
      while (treeWalk.next())
        files.add(treeWalk.getPathString());

      if (startCommit != null || startPoint != null) {
        DirCacheEditor editor = dc.editor();
        TreeWalk startWalk = new TreeWalk(revWalk.getObjectReader());
        startWalk.setRecursive(true);
        startWalk.setFilter(treeWalk.getFilter());
        startWalk.addTree(revWalk.parseCommit(getStartPoint())
            .getTree());
View Full Code Here

  private void resetIndexForPaths(RevCommit commit) {
    DirCache dc = null;
    final DirCacheEditor edit;
    try {
      dc = repo.lockDirCache();
      edit = dc.editor();

      final TreeWalk tw = new TreeWalk(repo);
      tw.addTree(new DirCacheIterator(dc));
      tw.addTree(commit.getTree());
      tw.setFilter(PathFilterGroup.createFromStrings(filepaths));
View Full Code Here

      final ObjectId currentCommitId =
          pdb.getRef(subscriber.get()).getObjectId();

      DirCache dc = readTree(pdb, pdb.getRef(subscriber.get()));
      DirCacheEditor ed = dc.editor();
      for (final Map.Entry<Branch.NameKey, ObjectId> me : modules.entrySet()) {
        ed.add(new PathEdit(paths.get(me.getKey())) {
          public void apply(DirCacheEntry ent) {
            ent.setFileMode(FileMode.GITLINK);
            ent.setObjectId(me.getValue().copy());
View Full Code Here

    DirCache dc1 = DirCache.newInCore();
    DirCache dc2 = DirCache.newInCore();
    DirCacheEditor ed1 = dc1.editor();
    ed1.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("a"), 1, false));
    ed1.finish();
    DirCacheEditor ed2 = dc2.editor();
    ed2.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("a"), 1, false));
    ed2.finish();

    TreeWalk tw = new TreeWalk(db);
    tw.setRecursive(true);
View Full Code Here

    DirCache dc1 = DirCache.newInCore();
    DirCache dc2 = DirCache.newInCore();
    DirCacheEditor ed1 = dc1.editor();
    ed1.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("a"), 1, false));
    ed1.finish();
    DirCacheEditor ed2 = dc2.editor();
    ed2.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("a"), 1, true));
    ed2.finish();

    TreeWalk tw = new TreeWalk(db);
    tw.setRecursive(true);
View Full Code Here

    DirCache dc1 = DirCache.newInCore();
    DirCache dc2 = DirCache.newInCore();
    DirCacheEditor ed1 = dc1.editor();
    ed1.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("a"), 1, true));
    ed1.finish();
    DirCacheEditor ed2 = dc2.editor();
    ed2.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("b"), 1, true));
    ed2.finish();

    TreeWalk tw = new TreeWalk(db);
    tw.setRecursive(true);
View Full Code Here

    }
  }

  TreeWalk fakeWalk(final String path) throws IOException {
    DirCache dc = DirCache.newInCore();
    DirCacheEditor dce = dc.editor();
    dce.add(new DirCacheEditor.PathEdit(path) {

      public void apply(DirCacheEntry ent) {
        ent.setFileMode(FileMode.REGULAR_FILE);
      }
View Full Code Here

    writeTrashFile("file.txt", "content");
    git.add().addFilepattern("file.txt").call();
    final RevCommit id = git.commit().setMessage("create file").call();
    final String path = "sub";
    DirCache cache = db.lockDirCache();
    DirCacheEditor editor = cache.editor();
    editor.add(new PathEdit(path) {

      public void apply(DirCacheEntry ent) {
        ent.setFileMode(FileMode.GITLINK);
        ent.setObjectId(id);
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.