Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.Repository.open()


                    .length()) {
                  treeWalk.enterSubtree();
                }
              } else {
                ObjectId objId = treeWalk.getObjectId(0);
                ObjectLoader loader = repo.open(objId);
                long size = loader.getSize();
                listEntry(treeWalk.getNameString(), "file", Long.toString(size), treeWalk.getPathString(), projectName, head.getName(), git, contents);
              }
            } while (treeWalk.next());
            String response = JSONUtil.write(contents);
View Full Code Here


        if (!treeWalk.next()){
          throw new IllegalStateException("No file found");
        }
       
        ObjectId objId = treeWalk.getObjectId(0);
        ObjectLoader loader = repo.open(objId);
        resp.setHeader("Cache-Control", "no-cache");
        resp.setHeader("ETag", "\"" + tree.getId().getName() + "\"");
        resp.setContentType("application/octet-stream");
        loader.copyTo(out);
        walk.release();
View Full Code Here

            parents.add(0, listEntry(treeWalk.getNameString(), 0, true, 0, locationWalk, null));
            treeWalk.enterSubtree();
          }
        } else {
          ObjectId objId = treeWalk.getObjectId(0);
          ObjectLoader loader = repo.open(objId);
          long size = loader.getSize();
          if (treeWalk.getPathLength() == pattern.length()) {
            if ("meta".equals(meta)) { //$NON-NLS-1$
              result = listEntry(treeWalk.getNameString(), 0, false, 0, locationWalk, treeWalk.getNameString());
            } else {
View Full Code Here

      throw new CompileException("Cannot open repository " + project, e);
    } catch (IOException e) {
      throw new CompileException("Cannot open repository " + project, e);
    }
    try {
      ObjectLoader ldr = git.open(rulesId, Constants.OBJ_BLOB);
      byte[] raw = ldr.getCachedBytes(SRC_LIMIT);
      return RawParseUtils.decode(raw);
    } catch (LargeObjectException e) {
      throw new CompileException("rules of " + project + " are too large", e);
    } catch (RuntimeException e) {
View Full Code Here

      if (!id.equals(lastBlob)) {
        if (GitTraceLocation.QUICKDIFF.isActive())
          GitTraceLocation.getTrace().trace(
              GitTraceLocation.QUICKDIFF.getLocation(),
              "(GitDocument) compareTo: " + baseline); //$NON-NLS-1$
        ObjectLoader loader = repository.open(id, Constants.OBJ_BLOB);
        byte[] bytes = loader.getBytes();
        String charset;
        charset = CompareCoreUtils.getResourceEncoding(resource);
        // Finally we could consider validating the content with respect
        // to the content. We don't do that here.
View Full Code Here

        System.out.println("Listing " + call.size() + " notes");
        for (Note note : call) {
            System.out.println("Note: " + note + " " + note.getName() + " " + note.getData().getName() + "\nContent: ");

            // displaying the contents of the note is done via a simple blob-read
            ObjectLoader loader = repository.open(note.getData());
            loader.copyTo(System.out);
        }

        repository.close();
    }
View Full Code Here

        {
            System.out.println("---------------------------");
            System.out.append("name: ").println(treeWalk.getNameString());
            System.out.append("path: ").println(treeWalk.getPathString());

            ObjectLoader loader = repository.open(treeWalk.getObjectId(0));

            System.out.append("directory: ").println(loader.getType()
                    == Constants.OBJ_TREE);
            System.out.append("size: ").println(loader.getSize());
        }
View Full Code Here

        any = walk.parseAny(annotatedTag.getObjectId());
        System.out.println("Tag: " + any);

        // finally try to print out the tag-content
        System.out.println("\nTag-Content: \n");
        ObjectLoader loader = repository.open(annotatedTag.getObjectId());
        loader.copyTo(System.out);

        walk.dispose();

        repository.close();
View Full Code Here

        // the Ref holds an ObjectId for any type of object (tree, commit, blob, tree)
        Ref head = repository.getRef("refs/heads/master");
        System.out.println("Ref of refs/heads/master: " + head);

        System.out.println("\nPrint contents of head of master branch, i.e. the latest commit information");
        ObjectLoader loader = repository.open(head.getObjectId());
        loader.copyTo(System.out);

        System.out.println("\nPrint contents of tree of head of master branch, i.e. the latest binary tree information");

        // a commit points to a tree
View Full Code Here

        // a commit points to a tree
        RevWalk walk = new RevWalk(repository);
        RevCommit commit = walk.parseCommit(head.getObjectId());
        RevTree tree = walk.parseTree(commit.getTree().getId());
        System.out.println("Found Tree: " + tree);
        loader = repository.open(tree.getId());
        loader.copyTo(System.out);

        walk.dispose();

        repository.close();
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.