Example usage for org.eclipse.jgit.revwalk RevObject add

List of usage examples for org.eclipse.jgit.revwalk RevObject add

Introduction

In this page you can find the example usage for org.eclipse.jgit.revwalk RevObject add.

Prototype

public final void add(RevFlagSet set) 

Source Link

Document

Add a set of flags to this object.

Usage

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 a  2s .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 processBlob(final RevObject obj) throws TransportException {
    try {/*w  w w  .j  a v  a  2  s.  c om*/
        if (reader.has(obj, Constants.OBJ_BLOB))
            obj.add(COMPLETE);
        else
            throw new TransportException(MessageFormat.format(JGitText.get().cannotReadBlob, obj.name()),
                    new MissingObjectException(obj, Constants.TYPE_BLOB));
    } catch (IOException error) {
        throw new TransportException(MessageFormat.format(JGitText.get().cannotReadBlob, obj.name()), error);
    }
}

From source file:it.com.atlassian.labs.speakeasy.util.jgit.WalkFetchConnection.java

License:Eclipse Distribution License

private void processTree(final RevObject obj) throws TransportException {
    try {/*w w  w.  j a  va  2  s.  c om*/
        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);
}

From source file:it.com.atlassian.labs.speakeasy.util.jgit.WalkFetchConnection.java

License:Eclipse Distribution License

private void processCommit(final RevObject obj) throws TransportException {
    final RevCommit commit = (RevCommit) obj;
    markLocalCommitsComplete(commit.getCommitTime());
    needs(commit.getTree());//  w w w .  jav  a  2s .co  m
    for (final RevCommit p : commit.getParents())
        needs(p);
    obj.add(COMPLETE);
}

From source file:it.com.atlassian.labs.speakeasy.util.jgit.WalkFetchConnection.java

License:Eclipse Distribution License

private void processTag(final RevObject obj) {
    final RevTag tag = (RevTag) obj;
    needs(tag.getObject());/*from  ww w  . j a v a2  s.c o  m*/
    obj.add(COMPLETE);
}

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;//ww w .j a  v a2  s . co  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 markLocalObjComplete(RevObject obj) throws IOException {
    while (obj.getType() == Constants.OBJ_TAG) {
        obj.add(COMPLETE);
        obj = ((RevTag) obj).getObject();
        revWalk.parseHeaders(obj);//from   w  w w.  j  a v  a2s .co  m
    }

    switch (obj.getType()) {
    case Constants.OBJ_BLOB:
        obj.add(COMPLETE);
        break;
    case Constants.OBJ_COMMIT:
        pushLocalCommit((RevCommit) obj);
        break;
    case Constants.OBJ_TREE:
        markTreeComplete((RevTree) obj);
        break;
    }
}

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   ww w  .  j a v  a  2s . co  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()));
        }
    }
}

From source file:org.eclipse.egit.ui.internal.history.FindResults.java

License:Open Source License

/**
 * Adds a history table item index (<code>matchIx</code>) to the find
 * results matches list./*from w  ww .j a  va  2  s . c  om*/
 *
 * @param matchIx
 *            the history table item index that matches a find pattern.
 * @param revObj
 *            The RevObject that will have the highlight tag set.
 */
public synchronized void add(int matchIx, RevObject revObj) {
    matchesMap.put(Integer.valueOf(matchIx), Integer.valueOf(++matchesCount));
    revObjList.add(revObj);
    revObj.add(highlight);
    keysArray = null;
}