Package org.eclipse.jgit.dircache

Examples of org.eclipse.jgit.dircache.DirCacheBuilder.commit()


    for (int stage : stages) {
      DirCacheEntry entry = createEntry("a", FileMode.REGULAR_FILE,
          stage, "content");
      builder.add(entry);
    }
    builder.commit();

    IndexDiff diff = new IndexDiff(db, Constants.HEAD,
        new FileTreeIterator(db));
    diff.diff();
View Full Code Here


    addUnmergedEntry("unmerged1", builder);
    addUnmergedEntry("unmerged2", builder);
    DirCacheEntry other = new DirCacheEntry("other");
    other.setFileMode(FileMode.REGULAR_FILE);
    builder.add(other);
    builder.commit();

    writeTrashFile("unmerged1", "unmerged1 data");
    writeTrashFile("unmerged2", "unmerged2 data");
    writeTrashFile("other", "other data");
View Full Code Here

        }

        builder.add(entry);
      }

      builder.commit();
    } finally {
      dc.unlock();
      if (walk != null)
        walk.release();
    }
View Full Code Here

    e.setFileMode(fileMode);
    e.setObjectId(objectId);

    final DirCacheBuilder dirCacheBuilder = repository.lockDirCache().builder();
    dirCacheBuilder.add(e);
    dirCacheBuilder.commit();
  }

  private static StringBuilder buildSubmoduleSection(final String name,
      final String path, final String url, final String branch) {
    final StringBuilder sb = new StringBuilder();
View Full Code Here

      dce.setLength((int) fIt.getEntryLength());
      dce.setObjectId(fIt.getEntryObjectId());
      builder.add(dce);
      fIt.next(1);
    }
    builder.commit();
  }

  private File addToWorkDir(String path, String content) throws IOException {
    File f = new File(db.getWorkTree(), path);
    FileOutputStream fos = new FileOutputStream(f);
View Full Code Here

    writer.print("our content");
    writer.close();
    addEntryToBuilder("a.txt", file, newObjectInserter, builder, 2)
        .getObjectId();

    builder.commit();

    assertEquals(
        "[a.txt, mode:100644, stage:1, sha1:6b584e8ece562ebffc15d38808cd6b98fc3d97ea]" +
        "[a.txt, mode:100644, stage:2, sha1:b9f89ff733bdaf49e02711535867bb821f9db55e]" +
        "[a.txt, mode:100644, stage:3, sha1:4f41554f6e0045ef53848fc0c3f33b6a9abc24a9]" +
View Full Code Here

        // the file or symlink named by the tree entry.
        delete(path);
      }
    }

    edit.commit();
  }

  private void delete(File p) {
    while (p != null && !p.equals(root) && p.delete())
      p = p.getParentFile();
View Full Code Here

              builder.add(c.getDirCacheEntry());
            }
          }
        }
      }
      builder.commit();
      setCallable(false);
    } catch (IOException e) {
      throw new JGitInternalException(
          JGitText.get().exceptionCaughtDuringExecutionOfAddCommand, e);
    } finally {
View Full Code Here

              builder.add(c.getDirCacheEntry());
          }
        }
      }
      inserter.flush();
      builder.commit();
      setCallable(false);
    } catch (IOException e) {
      throw new JGitInternalException(
          JGitText.get().exceptionCaughtDuringExecutionOfAddCommand, e);
    } finally {
View Full Code Here

          // Deleting a blob is simply a matter of removing
          // the file or symlink named by the tree entry.
          delete(path);
        }
      }
      builder.commit();
      setCallable(false);
    } catch (IOException e) {
      throw new JGitInternalException(
          JGitText.get().exceptionCaughtDuringExecutionOfRmCommand, e);
    } finally {
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.