Package org.eclipse.jgit.dircache

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


    ObjectInserter oi = db.newObjectInserter();
    final ObjectId linkid = oi.insert(Constants.OBJ_BLOB, NORMALIZED_BYTES,
        0, NORMALIZED_BYTES.length);
    oi.release();
    DirCache dc = db.lockDirCache();
    DirCacheEditor dce = dc.editor();
    dce.add(new DirCacheEditor.PathEdit("link") {
      @Override
      public void apply(DirCacheEntry ent) {
        ent.setFileMode(FileMode.SYMLINK);
        ent.setObjectId(linkid);
View Full Code Here


      stashHeadIter.reset(reader, stashHeadTree);
      CanonicalTreeParser headIter = new CanonicalTreeParser();
      headIter.reset(reader, headTree);

      DirCache cache = repo.lockDirCache();
      DirCacheEditor editor = cache.editor();
      try {
        DirCacheIterator indexIter = new DirCacheIterator(cache);
        FileTreeIterator workingIter = new FileTreeIterator(repo);

        TreeWalk treeWalk = new TreeWalk(reader);
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

  private void resetIndex(RevCommit commit) throws IOException {
    DirCache dc = repo.lockDirCache();
    TreeWalk walk = null;
    try {
      DirCacheEditor editor = dc.editor();

      walk = new TreeWalk(repo);
      walk.addTree(commit.getTree());
      walk.addTree(new DirCacheIterator(dc));
      walk.setRecursive(true);
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);
      if (!checkoutAllPaths)
        startWalk.setFilter(PathFilterGroup.createFromStrings(paths));
      boolean checkoutIndex = startCommit == null && startPoint == null;
View Full Code Here

            headCommit.getShortMessage()));
        ObjectId indexCommit = inserter.insert(builder);

        // Commit working tree changes
        if (!wtEdits.isEmpty() || !wtDeletes.isEmpty()) {
          DirCacheEditor editor = cache.editor();
          for (PathEdit edit : wtEdits)
            editor.add(edit);
          for (String path : wtDeletes)
            editor.add(new DeletePath(path));
          editor.finish();
View Full Code Here

  private static void setIndexEntryContents(final Repository repository,
      final String gitPath, final byte[] newContent) {
    DirCache cache = null;
    try {
      cache = repository.lockDirCache();
      DirCacheEditor editor = cache.editor();
      if (newContent.length == 0) {
        editor.add(new DirCacheEditor.DeletePath(gitPath));
      } else {
        int length;
        byte[] content;
View Full Code Here

        tree.failed(new Status(IStatus.WARNING, Activator.getPluginId(),
            CoreText.MoveDeleteHook_unmergedFileError));
        return I_AM_DONE;
      }

      final DirCacheEditor sEdit = sCache.editor();
      sEdit.add(new DirCacheEditor.DeletePath(sEnt));
      if (dstm != null && dstm.getRepository() == srcm.getRepository()) {
        final String dPath = srcm.getRepoRelativePath(dstf);
        sEdit.add(new DirCacheEditor.PathEdit(dPath) {
          @Override
View Full Code Here

      if (sEnt.length == 0) {
        sCache.unlock();
        return MoveResult.UNTRACKED;
      }

      final DirCacheEditor sEdit = sCache.editor();
      sEdit.add(new DirCacheEditor.DeleteTree(sPath));
      final int sPathLen = sPath.length() == 0 ? sPath.length() : sPath
          .length() + 1;
      for (final DirCacheEntry se : sEnt) {
        if (!se.isMerged())
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);
      if (!checkoutAllPaths)
        startWalk.setFilter(PathFilterGroup.createFromStrings(paths));
      boolean checkoutIndex = startCommit == null && startPoint == null;
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.