public static ArrayMemory valueOf(ReflogEntry value) { ArrayMemory memory = new ArrayMemory(); memory.refOfIndex("newId").assign(valueOf(value.getNewId())); memory.refOfIndex("oldId").assign(valueOf(value.getOldId())); memory.refOfIndex("who").assign(value.getWho() == null ? Memory.NULL : valueOf(value.getWho())); memory.refOfIndex("comment").assign(value.getComment()); return memory; }
/** * Write the given entry to the ref's log. * * @param refName * a {@link java.lang.String} object. * @param entry * a {@link org.eclipse.jgit.lib.ReflogEntry} object. * @return this writer * @throws java.io.IOException */ public ReflogWriter log(String refName, ReflogEntry entry) throws IOException { return log(refName, entry.getOldId(), entry.getNewId(), entry.getWho(), entry.getComment()); }
/** * @param ref * the ref which log should be inspected * @param minTime only reflog entries not older then this time are processed * @return the {@link ObjectId}s contained in the reflog * @throws IOException */ private Set<ObjectId> listRefLogObjects(Ref ref, long minTime) throws IOException { ReflogReader reflogReader = repo.getReflogReader(ref.getName()); if (reflogReader == null) { return Collections.emptySet(); } List<ReflogEntry> rlEntries = reflogReader .getReverseEntries(); if (rlEntries == null || rlEntries.isEmpty()) return Collections.emptySet(); Set<ObjectId> ret = new HashSet<>(); for (ReflogEntry e : rlEntries) { if (e.getWho().getWhen().getTime() < minTime) break; ObjectId newId = e.getNewId(); if (newId != null && !ObjectId.zeroId().equals(newId)) ret.add(newId); ObjectId oldId = e.getOldId(); if (oldId != null && !ObjectId.zeroId().equals(oldId)) ret.add(oldId); } return ret; }
updateIndex, who, log.getOldId(), log.getNewId(), log.getComment());
/** * Write the given {@link ReflogEntry} entry to the ref's log * * @param refName * * @param entry * @return this writer * @throws IOException */ public ReflogWriter log(final String refName, final ReflogEntry entry) throws IOException { return log(refName, entry.getOldId(), entry.getNewId(), entry.getWho(), entry.getComment()); }
/** * @param ref * the ref which log should be inspected * @param minTime only reflog entries not older then this time are processed * @return the {@link ObjectId}s contained in the reflog * @throws IOException */ private Set<ObjectId> listRefLogObjects(Ref ref, long minTime) throws IOException { ReflogReader reflogReader = repo.getReflogReader(ref.getName()); if (reflogReader == null) { return Collections.emptySet(); } List<ReflogEntry> rlEntries = reflogReader .getReverseEntries(); if (rlEntries == null || rlEntries.isEmpty()) return Collections.emptySet(); Set<ObjectId> ret = new HashSet<>(); for (ReflogEntry e : rlEntries) { if (e.getWho().getWhen().getTime() < minTime) break; ObjectId newId = e.getNewId(); if (newId != null && !ObjectId.zeroId().equals(newId)) ret.add(newId); ObjectId oldId = e.getOldId(); if (oldId != null && !ObjectId.zeroId().equals(oldId)) ret.add(oldId); } return ret; }
/** * @param ref * the ref which log should be inspected * @param minTime only reflog entries not older then this time are processed * @return the {@link ObjectId}s contained in the reflog * @throws IOException */ private Set<ObjectId> listRefLogObjects(Ref ref, long minTime) throws IOException { ReflogReader reflogReader = repo.getReflogReader(ref.getName()); if (reflogReader == null) { return Collections.emptySet(); } List<ReflogEntry> rlEntries = reflogReader .getReverseEntries(); if (rlEntries == null || rlEntries.isEmpty()) return Collections.<ObjectId> emptySet(); Set<ObjectId> ret = new HashSet<ObjectId>(); for (ReflogEntry e : rlEntries) { if (e.getWho().getWhen().getTime() < minTime) break; ObjectId newId = e.getNewId(); if (newId != null && !ObjectId.zeroId().equals(newId)) ret.add(newId); ObjectId oldId = e.getOldId(); if (oldId != null && !ObjectId.zeroId().equals(oldId)) ret.add(oldId); } return ret; }
/** * Write the given entry to the ref's log. * * @param refName * a {@link java.lang.String} object. * @param entry * a {@link org.eclipse.jgit.lib.ReflogEntry} object. * @return this writer * @throws java.io.IOException */ public ReflogWriter log(String refName, ReflogEntry entry) throws IOException { return log(refName, entry.getOldId(), entry.getNewId(), entry.getWho(), entry.getComment()); }
updateIndex, who, log.getOldId(), log.getNewId(), log.getComment());
private void handleOpen(ISelection selection, boolean activateOnOpen) { if (selection instanceof IStructuredSelection) if (selection.isEmpty()) return; Repository repo = getRepository(); if (repo == null) return; RevWalk walk = new RevWalk(repo); try { for (Object element : ((IStructuredSelection)selection).toArray()) { ReflogEntry entry = (ReflogEntry) element; ObjectId id = entry.getNewId(); if (id == null || id.equals(ObjectId.zeroId())) id = entry.getOldId(); if (id != null && !id.equals(ObjectId.zeroId())) CommitEditor.openQuiet(new RepositoryCommit(repo, walk.parseCommit(id)), activateOnOpen); } } catch (IOException e) { Activator.logError(UIText.ReflogView_ErrorOnOpenCommit, e); } finally { walk.release(); } } };