public static ArrayMemory valueOf(RevObject value) { ArrayMemory memory = new ArrayMemory(); memory.refOfIndex("id").assign(valueOf(value.getId())); memory.refOfIndex("type").assign(value.getType()); return memory; }
/** * Remove all entries from a map which key is the id of an object referenced * by the given ObjectWalk * * @param id2File * @param w * @throws MissingObjectException * @throws IncorrectObjectTypeException * @throws IOException */ private void removeReferenced(Map<ObjectId, File> id2File, ObjectWalk w) throws MissingObjectException, IncorrectObjectTypeException, IOException { RevObject ro = w.next(); while (ro != null) { checkCancelled(); if (id2File.remove(ro.getId()) != null && id2File.isEmpty()) { return; } ro = w.next(); } ro = w.nextObject(); while (ro != null) { checkCancelled(); if (id2File.remove(ro.getId()) != null && id2File.isEmpty()) { return; } ro = w.nextObject(); } }
private void processTree(RevObject obj) throws TransportException { try { treeWalk.reset(obj); while (treeWalk.next()) { final FileMode mode = treeWalk.getFileMode(0); final int sType = mode.getObjectType(); switch (sType) { case Constants.OBJ_BLOB: case Constants.OBJ_TREE: treeWalk.getObjectId(idBuffer, 0); needs(revWalk.lookupAny(idBuffer, sType)); continue; default: if (FileMode.GITLINK.equals(mode)) continue; treeWalk.getObjectId(idBuffer, 0); throw new CorruptObjectException(MessageFormat.format(JGitText.get().invalidModeFor , mode, idBuffer.name(), treeWalk.getPathString(), obj.getId().name())); } } } catch (IOException ioe) { throw new TransportException(MessageFormat.format(JGitText.get().cannotReadTree, obj.name()), ioe); } obj.add(COMPLETE); }
private static long getObjectSize(ObjectReader r, RevObject obj) throws IOException { return r.getObjectSize(obj.getId(), Constants.OBJ_BLOB); }
/** * Returns {@code true} if the object is a new object. The method will also * return {@code true}, if the pack parser does not return a list with new * object ids. * * * @param object rev object * * @return {@code true} if the object is new */ public boolean isNew(RevObject object) { ensureAfterWasCalled(); return newObjectIds.isEmpty() || newObjectIds.contains(object.getId()); }
/** * Remove all entries from a map which key is the id of an object referenced * by the given ObjectWalk * * @param id2File * @param w * @throws MissingObjectException * @throws IncorrectObjectTypeException * @throws IOException */ private void removeReferenced(Map<ObjectId, File> id2File, ObjectWalk w) throws MissingObjectException, IncorrectObjectTypeException, IOException { RevObject ro = w.next(); while (ro != null) { if (id2File.remove(ro.getId()) != null) if (id2File.isEmpty()) return; ro = w.next(); } ro = w.nextObject(); while (ro != null) { if (id2File.remove(ro.getId()) != null) if (id2File.isEmpty()) return; ro = w.nextObject(); } }
private Map<String, List<RevTag>> createCommitIDToTagsMap(Repository repository, RevWalk revWalk) throws IOException { Map<String, Ref> allTags = repository.getTags(); Map<String, List<RevTag>> revTags = new HashMap<String, List<RevTag>>(); for (Ref ref : allTags.values()) { try { RevTag revTag = revWalk.parseTag(ref.getObjectId()); String commitID = revTag.getObject().getId().getName(); if (!revTags.containsKey(commitID)) { revTags.put(commitID, new ArrayList<RevTag>()); } revTags.get(commitID).add(revTag); } catch (IncorrectObjectTypeException e) { log.debug("Light-weight tags not supported. Skipping " + ref.getName()); } } return revTags; }
/** * Remove all entries from a map which key is the id of an object referenced * by the given ObjectWalk * * @param id2File * @param w * @throws MissingObjectException * @throws IncorrectObjectTypeException * @throws IOException */ private void removeReferenced(Map<ObjectId, File> id2File, ObjectWalk w) throws MissingObjectException, IncorrectObjectTypeException, IOException { RevObject ro = w.next(); while (ro != null) { checkCancelled(); if (id2File.remove(ro.getId()) != null && id2File.isEmpty()) { return; } ro = w.next(); } ro = w.nextObject(); while (ro != null) { checkCancelled(); if (id2File.remove(ro.getId()) != null && id2File.isEmpty()) { return; } ro = w.nextObject(); } }
@Override protected void show(final ObjectWalk ow, final RevObject obj) throws Exception { if (obj.has(RevFlag.UNINTERESTING)) outw.print('-'); obj.getId().copyTo(outbuffer, outw); final String path = ow.getPathString(); if (path != null) { outw.print(' '); outw.print(path); } else if (obj instanceof RevTree) outw.print(' '); outw.println(); } }
private void processTree(final RevObject obj) throws TransportException { try { treeWalk.reset(obj); while (treeWalk.next()) { final FileMode mode = treeWalk.getFileMode(0); final int sType = mode.getObjectType(); switch (sType) { case Constants.OBJ_BLOB: case Constants.OBJ_TREE: treeWalk.getObjectId(idBuffer, 0); needs(revWalk.lookupAny(idBuffer, sType)); continue; default: if (FileMode.GITLINK.equals(mode)) continue; treeWalk.getObjectId(idBuffer, 0); throw new CorruptObjectException(MessageFormat.format(JGitText.get().invalidModeFor , mode, idBuffer.name(), treeWalk.getPathString(), obj.getId().name())); } } } catch (IOException ioe) { throw new TransportException(MessageFormat.format(JGitText.get().cannotReadTree, obj.name()), ioe); } obj.add(COMPLETE); }
revCommit = walk.parseCommit(revObject.getId());
private void processTree(RevObject obj) throws TransportException { try { treeWalk.reset(obj); while (treeWalk.next()) { final FileMode mode = treeWalk.getFileMode(0); final int sType = mode.getObjectType(); switch (sType) { case Constants.OBJ_BLOB: case Constants.OBJ_TREE: treeWalk.getObjectId(idBuffer, 0); needs(revWalk.lookupAny(idBuffer, sType)); continue; default: if (FileMode.GITLINK.equals(mode)) continue; treeWalk.getObjectId(idBuffer, 0); throw new CorruptObjectException(MessageFormat.format(JGitText.get().invalidModeFor , mode, idBuffer.name(), treeWalk.getPathString(), obj.getId().name())); } } } catch (IOException ioe) { throw new TransportException(MessageFormat.format(JGitText.get().cannotReadTree, obj.name()), ioe); } obj.add(COMPLETE); }
RevObject object = walk.peel(t); if (object != null) { RevCommit c = walk.parseCommit(object.getId()); String date = GitPatchRepository.FULL_DATE.format(new Date(c.getCommitTime() * 1000L)); message += " (" + date + ")";
RevObject object = walk.peel(t); if (object != null) { RevCommit c = walk.parseCommit(object.getId()); String date = GitPatchRepository.FULL_DATE.format(new Date(c.getCommitTime() * 1000L)); message += " (" + date + ")";
final RevObject ro = rw.lookupAny(entid, entmode.getObjectType()); rw.parseBody(ro); final ObjectLoader ldr = git.getRepository().open(ro.getId(), Constants.OBJ_BLOB); return ldr.openStream();
final RevObject ro = rw.lookupAny( entid, entmode.getObjectType() ); rw.parseBody( ro ); final ObjectLoader ldr = git.getRepository().open( ro.getId(), Constants.OBJ_BLOB ); return ldr.openStream();