List of usage examples for org.eclipse.jgit.lib Constants OBJ_TAG
int OBJ_TAG
To view the source code for org.eclipse.jgit.lib Constants OBJ_TAG.
Click Source Link
From source file:com.google.gitiles.RevisionServlet.java
License:Open Source License
static List<RevObject> listObjects(RevWalk walk, ObjectId id) throws MissingObjectException, IOException { List<RevObject> objects = Lists.newArrayListWithExpectedSize(1); while (true) { RevObject cur = walk.parseAny(id); objects.add(cur);//from w ww . j av a 2 s.c o m if (cur.getType() == Constants.OBJ_TAG) { id = ((RevTag) cur).getObject(); } else { break; } } return objects; }
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 o m*/ 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 markLocalObjComplete(RevObject obj) throws IOException { while (obj.getType() == Constants.OBJ_TAG) { obj.add(COMPLETE);/*w ww. j a va2s. c o m*/ obj = ((RevTag) obj).getObject(); revWalk.parseHeaders(obj); } 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:net.erdfelt.android.sdkfido.git.internal.GitInfo.java
License:Apache License
public static String asObjectType(int objectType) { switch (objectType) { case Constants.OBJ_BAD: return "BAD"; case Constants.OBJ_BLOB: return "BLOB"; case Constants.OBJ_COMMIT: return "COMMIT"; case Constants.OBJ_EXT: return "EXT(future)"; case Constants.OBJ_OFS_DELTA: return "OFS_DELTA(offset_delta)"; case Constants.OBJ_REF_DELTA: return "REF_DELTA(reference_delta)"; case Constants.OBJ_TAG: return "TAG"; case Constants.OBJ_TREE: return "TREE"; case Constants.OBJ_TYPE_5: return "TYPE_S(future)"; default:/*from ww w . java 2s . c o m*/ return "[" + objectType + "]"; } }
From source file:net.erdfelt.android.sdkfido.git.internal.GitInfo.java
License:Apache License
public static String getObjectName(Repository repo, ObjectId objectId) { try {/*from ww w .j a va2 s.c o m*/ ObjectLoader loader = repo.open(objectId); StringBuilder ret = new StringBuilder(); if (loader.isLarge()) { ret.append("LARGE! "); } switch (loader.getType()) { case Constants.OBJ_BAD: ret.append("BAD "); break; case Constants.OBJ_BLOB: ret.append("BLOB "); break; case Constants.OBJ_COMMIT: ret.append("COMMIT "); break; case Constants.OBJ_EXT: ret.append("EXT "); break; case Constants.OBJ_OFS_DELTA: ret.append("OFS_DELTA "); break; case Constants.OBJ_REF_DELTA: ret.append("REF_DELTA "); break; case Constants.OBJ_TAG: ret.append("TAG "); break; case Constants.OBJ_TREE: ret.append("TREE "); break; case Constants.OBJ_TYPE_5: ret.append("TYPE_5 "); break; default: ret.append("UNKNOWN[").append(loader.getType()).append("] "); break; } ret.append(String.format("Size=%,d", loader.getSize())); return ret.toString(); } catch (MissingObjectException e) { LOG.log(Level.WARNING, "Unable to open objectId: " + objectId, e); return "<missing object>"; } catch (IOException e) { LOG.log(Level.WARNING, "Unable to open objectId: " + objectId, e); return "<unable to open object>"; } }
From source file:org.eclipse.egit.ui.internal.components.RefContentProposal.java
License:Open Source License
public String getDescription() { if (objectId == null) return null; ObjectReader reader = db.newObjectReader(); try {//from www . j av a 2 s .co m final ObjectLoader loader = reader.open(objectId); final StringBuilder sb = new StringBuilder(); sb.append(refName); sb.append('\n'); sb.append(reader.abbreviate(objectId).name()); sb.append(" - "); //$NON-NLS-1$ switch (loader.getType()) { case Constants.OBJ_COMMIT: RevCommit c = new RevWalk(db).parseCommit(objectId); appendObjectSummary(sb, UIText.RefContentProposal_commit, c.getAuthorIdent(), c.getFullMessage()); break; case Constants.OBJ_TAG: RevWalk walk = new RevWalk(db); RevTag t = walk.parseTag(objectId); appendObjectSummary(sb, UIText.RefContentProposal_tag, t.getTaggerIdent(), t.getFullMessage()); break; case Constants.OBJ_TREE: sb.append(UIText.RefContentProposal_tree); break; case Constants.OBJ_BLOB: sb.append(UIText.RefContentProposal_blob); break; default: sb.append(UIText.RefContentProposal_unknownObject); } return sb.toString(); } catch (IOException e) { Activator.logError(NLS.bind(UIText.RefContentProposal_errorReadingObject, objectId), e); return null; } finally { reader.release(); } }
From source file:org.thiesen.ant.git.GitInfo.java
License:Open Source License
private GitInfo(final String currentBranch, final String lastCommit, final boolean workingCopyDirty, final boolean lastTagDirty, final CustomTag lastTag, final String lastCommitShort, final Date lastCommitDate) { super();/* w w w . ja v a 2 s .c om*/ _currentBranch = currentBranch; _lastCommit = lastCommit; _lastCommitShort = lastCommitShort; _lastCommitDate = lastCommitDate; _workingCopyDirty = workingCopyDirty; _lastTagDirty = lastTagDirty; _lastTag = lastTag; if (lastTag != null) { final RevObject object = lastTag.getObject(); if (object.getType() == Constants.OBJ_TAG) { final RevTag tag = (RevTag) object; final PersonIdent author = tag.getTaggerIdent(); if (author != null) { _lastTagAuthorName = StringUtils.defaultString(author.getName()); _lastTagAuthorEmail = StringUtils.defaultString(author.getEmailAddress()); } else { _lastTagAuthorName = ""; _lastTagAuthorEmail = ""; } } else { _lastTagAuthorName = ""; _lastTagAuthorEmail = ""; } } else { _lastTagAuthorName = ""; _lastTagAuthorEmail = ""; } _displayString = makeDisplayString(currentBranch, lastCommit, workingCopyDirty, lastTag, lastTagDirty, getLastTagAuthorName()); }
From source file:org.thiesen.ant.git.GitInfoExtractor.java
License:Open Source License
private static RevObject lookupAnyTag(final Repository r, final AnyObjectId id) throws MissingObjectException, IncorrectObjectTypeException, IOException { final RevWalk walk = new RevWalk(r); try {/*from w ww.java2s . c o m*/ final RevObject obj = walk.parseAny(id); if (obj != null && obj.getType() == Constants.OBJ_TAG) { return walk.parseTag(id); } return walk.parseCommit(id); } finally { walk.dispose(); } }
From source file:org.webcat.core.git.GitTreeIterator.java
License:Open Source License
/** * Creates a new {@code GitTreeIterator} for the specified tree or commit * object.//from w w w . j av a 2 s.c o m * * @param repository the repository * @param treeOrCommitId the id of the tree or commit object * @param recursive true if the iterator should be recursive, otherwise * false */ public GitTreeIterator(GitRepository repository, ObjectId treeOrCommitId, boolean recursive) { this.repository = repository; this.recursive = recursive; int type = repository.typeOfObject(treeOrCommitId); if (type == Constants.OBJ_TREE) { initializeFromTree(treeOrCommitId); } else if (type == Constants.OBJ_COMMIT || type == Constants.OBJ_TAG) { initializeFromCommit(treeOrCommitId); } else { treeWalk = null; } }