List of usage examples for org.eclipse.jgit.revwalk RevObject has
public final boolean has(RevFlag flag)
From source file:it.com.atlassian.labs.speakeasy.util.jgit.WalkFetchConnection.java
License:Eclipse Distribution License
private void queueWants(final Collection<Ref> want) throws TransportException { final HashSet<ObjectId> inWorkQueue = new HashSet<ObjectId>(); for (final Ref r : want) { final ObjectId id = r.getObjectId(); try {//from w w w . j a v a2s . co m final RevObject obj = revWalk.parseAny(id); if (obj.has(COMPLETE)) continue; if (inWorkQueue.add(id)) { obj.add(IN_WORK_QUEUE); workQueue.add(obj); } } catch (MissingObjectException e) { if (inWorkQueue.add(id)) workQueue.add(id); } catch (IOException e) { throw new TransportException(MessageFormat.format(JGitText.get().cannotRead, id.name()), e); } } }
From source file:it.com.atlassian.labs.speakeasy.util.jgit.WalkFetchConnection.java
License:Eclipse Distribution License
private void process(final ObjectId id) throws TransportException { final RevObject obj; try {// w w w.j a v a 2s .c om if (id instanceof RevObject) { obj = (RevObject) id; if (obj.has(COMPLETE)) return; revWalk.parseHeaders(obj); } else { obj = revWalk.parseAny(id); if (obj.has(COMPLETE)) return; } } catch (IOException e) { throw new TransportException(MessageFormat.format(JGitText.get().cannotRead, id.name()), e); } switch (obj.getType()) { case Constants.OBJ_BLOB: processBlob(obj); break; case Constants.OBJ_TREE: processTree(obj); break; case Constants.OBJ_COMMIT: processCommit(obj); break; case Constants.OBJ_TAG: processTag(obj); break; default: throw new TransportException(MessageFormat.format(JGitText.get().unknownObjectType, id.name())); } // If we had any prior errors fetching this object they are // now resolved, as the object was parsed successfully. // fetchErrors.remove(id); }
From source file:it.com.atlassian.labs.speakeasy.util.jgit.WalkFetchConnection.java
License:Eclipse Distribution License
private void needs(final RevObject obj) { if (obj.has(COMPLETE)) return;//from w ww.j av a 2 s. c o m if (!obj.has(IN_WORK_QUEUE)) { obj.add(IN_WORK_QUEUE); workQueue.add(obj); } }
From source file:it.com.atlassian.labs.speakeasy.util.jgit.WalkFetchConnection.java
License:Eclipse Distribution License
private void markTreeComplete(final RevTree tree) throws IOException { if (tree.has(COMPLETE)) return;/*from w w w . j a va2 s . c o m*/ tree.add(COMPLETE); treeWalk.reset(tree); while (treeWalk.next()) { final FileMode mode = treeWalk.getFileMode(0); final int sType = mode.getObjectType(); switch (sType) { case Constants.OBJ_BLOB: treeWalk.getObjectId(idBuffer, 0); revWalk.lookupAny(idBuffer, sType).add(COMPLETE); continue; case Constants.OBJ_TREE: { treeWalk.getObjectId(idBuffer, 0); final RevObject o = revWalk.lookupAny(idBuffer, sType); if (!o.has(COMPLETE)) { o.add(COMPLETE); treeWalk.enterSubtree(); } continue; } default: if (FileMode.GITLINK.equals(mode)) continue; treeWalk.getObjectId(idBuffer, 0); throw new CorruptObjectException(MessageFormat.format(JGitText.get().corruptObjectInvalidMode3, mode, idBuffer.name(), treeWalk.getPathString(), tree.name())); } } }