void beginResult(RevWalk rw) throws MissingObjectException, IOException { rw.parseBody(sourceCommit); }
private Date tagDate(Ref tag) throws IOException { RevTag t = w.parseTag(tag.getObjectId()); w.parseBody(t); return t.getTaggerIdent().getWhen(); } };
/** * Ensure the body of the given object has been parsed. * * @param <T> * type of object, e.g. {@link RevTag} or {@link RevCommit}. * @param object * reference to the (possibly unparsed) object to force body * parsing of. * @return {@code object} * @throws Exception */ public <T extends RevObject> T parseBody(final T object) throws Exception { pool.parseBody(object); return object; }
/** * Ensure the body of the given object has been parsed. * * @param <T> * type of object, e.g. {@link RevTag} or {@link RevCommit}. * @param object * reference to the (possibly unparsed) object to force body * parsing of. * @return {@code object} * @throws Exception */ public <T extends RevObject> T parseBody(final T object) throws Exception { pool.parseBody(object); return object; }
void beginResult(RevWalk rw) throws MissingObjectException, IOException { rw.parseBody(sourceCommit); }
/** * Ensure the body of the given object has been parsed. * * @param <T> * type of object, e.g. {@link org.eclipse.jgit.revwalk.RevTag} * or {@link org.eclipse.jgit.revwalk.RevCommit}. * @param object * reference to the (possibly unparsed) object to force body * parsing of. * @return {@code object} * @throws Exception */ public <T extends RevObject> T parseBody(T object) throws Exception { pool.parseBody(object); return object; }
void beginResult(RevWalk rw) throws MissingObjectException, IOException { rw.parseBody(sourceCommit); }
public void parseBody() throws IOException { if (getRawBuffer() == null) walk.parseBody(this); } }
private Date tagDate(Ref tag) throws IOException { RevTag t = w.parseTag(tag.getObjectId()); w.parseBody(t); return t.getTaggerIdent().getWhen(); } };
@Override public void loadTag(GitTag tag) throws GitRepositoryException { if (tag.isLoaded()) { return; } assert revWalk != null; JGitTag jgitTag = (JGitTag) tag; try { revWalk.parseBody(jgitTag.tag); jgitTag.taggerIdent = jgitTag.tag.getTaggerIdent(); } catch (IOException e) { throw new GitRepositoryException("Failed to load tag meta data.", e); } finally { jgitTag.tag.disposeBody(); } }
private RepositoryCommit getCommit(Repository repository, ObjectId objectId) { RevWalk walk = new RevWalk(repository); try { RevCommit commit = walk.parseCommit(objectId); for (RevCommit parent : commit.getParents()) walk.parseBody(parent); return new RepositoryCommit(repository, commit); } catch (IOException e) { Activator.showError(NLS.bind( UIText.GitProjectPropertyPage_UnableToGetCommit, objectId.name()), e); } finally { walk.release(); } return null; } /**
/** * Get commit from memento and repository * * @param memento * @param repository * @return rev commit */ protected RevCommit getCommit(IMemento memento, Repository repository) { String id = memento.getString(COMMIT); if (id == null) return null; RevWalk walk = new RevWalk(repository); try { RevCommit commit = walk.parseCommit(ObjectId.fromString(id)); for (RevCommit parent : commit.getParents()) walk.parseBody(parent); return commit; } catch (IOException e) { return null; } finally { walk.release(); } }
private static RevCommit walkToBase(final Repository repository, final ObjectId... commits) { final RevWalk walk = new RevWalk(repository); walk.setRevFilter(MERGE_BASE); try { for (int i = 0; i < commits.length; i++) walk.markStart(walk.parseCommit(commits[i])); final RevCommit base = walk.next(); if (base != null) walk.parseBody(base); return base; } catch (IOException e) { throw new GitException(e, repository); } finally { walk.close(); } }
/** * Get file diffs * * @return non-null but possibly empty array of {@link FileDiff} instances. */ public FileDiff[] getDiffs() { if (diffs == null) { RevWalk revWalk = new RevWalk(repository); TreeWalk treewalk = new TreeWalk(revWalk.getObjectReader()); treewalk.setRecursive(true); treewalk.setFilter(TreeFilter.ANY_DIFF); try { for (RevCommit parent : commit.getParents()) revWalk.parseBody(parent); diffs = FileDiff.compute(repository, treewalk, commit, TreeFilter.ALL); } catch (IOException e) { diffs = new FileDiff[0]; } finally { revWalk.release(); treewalk.release(); } } return diffs; }
final FileMode entmode = tw.getFileMode(0); 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 FileMode entmode = tw.getFileMode( 0 ); 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();
private CommitBuilder amend(RevCommit old, CommitBuilder b) throws Exception { pool.parseBody(old); b.author(old.getAuthorIdent()); b.committer(old.getCommitterIdent()); b.message(old.getFullMessage()); // Use the committer name from the old commit, but update it after ticking // the clock in CommitBuilder#create(). b.updateCommitterTime = true; // Reset parents to original parents. b.noParents(); for (int i = 0; i < old.getParentCount(); i++) b.parent(old.getParent(i)); // Reset tree to original tree; resetting parents reset tree contents to the // first parent. b.tree.clear(); try (TreeWalk tw = new TreeWalk(db)) { tw.reset(old.getTree()); tw.setRecursive(true); while (tw.next()) { b.edit(new PathEdit(tw.getPathString()) { @Override public void apply(DirCacheEntry ent) { ent.setFileMode(tw.getFileMode(0)); ent.setObjectId(tw.getObjectId(0)); } }); } } return b; }
private CommitBuilder amend(RevCommit old, CommitBuilder b) throws Exception { pool.parseBody(old); b.author(old.getAuthorIdent()); b.committer(old.getCommitterIdent()); b.message(old.getFullMessage()); // Use the committer name from the old commit, but update it after ticking // the clock in CommitBuilder#create(). b.updateCommitterTime = true; // Reset parents to original parents. b.noParents(); for (int i = 0; i < old.getParentCount(); i++) b.parent(old.getParent(i)); // Reset tree to original tree; resetting parents reset tree contents to the // first parent. b.tree.clear(); try (TreeWalk tw = new TreeWalk(db)) { tw.reset(old.getTree()); tw.setRecursive(true); while (tw.next()) { b.edit(new PathEdit(tw.getPathString()) { @Override public void apply(DirCacheEntry ent) { ent.setFileMode(tw.getFileMode(0)); ent.setObjectId(tw.getObjectId(0)); } }); } } return b; }
if (null != base) walk.parseBody(base);
if (null != base) walk.parseBody(base);