@Override public boolean include(RevWalk walker, RevCommit cmit) throws StopWalkException, MissingObjectException, IncorrectObjectTypeException, IOException { return cmit.getCommitTime() <= when; }
@Override public boolean include(RevWalk walker, RevCommit cmit) throws StopWalkException, MissingObjectException, IncorrectObjectTypeException, IOException { // Since the walker sorts commits by commit time we can be // reasonably certain there is nothing remaining worth our // scanning if this commit is before the point in question. // if (cmit.getCommitTime() < when) throw StopWalkException.INSTANCE; return true; }
@Override public boolean include(RevWalk walker, RevCommit cmit) throws StopWalkException, MissingObjectException, IncorrectObjectTypeException, IOException { return cmit.getCommitTime() <= until && cmit.getCommitTime() >= when; }
@Override int getTime() { // Invert the timestamp so newer dates sort older. return -sourceCommit.getCommitTime(); }
private boolean isRecentCommit(RevCommit revCommit) { return revCommit.getCommitTime() > inactiveBranchTimestamp; }
int getTime() { return sourceCommit.getCommitTime(); }
@Override public int compare(RevCommit a, RevCommit b) { return Integer.signum(b.getCommitTime() - a.getCommitTime()); } };
private static PersonIdent mockAuthor(List<RevCommit> parents) { String name = RecursiveMerger.class.getSimpleName(); int time = 0; for (RevCommit p : parents) time = Math.max(time, p.getCommitTime()); return new PersonIdent( name, name + "@JGit", //$NON-NLS-1$ new Date((time + 1) * 1000L), TimeZone.getTimeZone("GMT+0000")); //$NON-NLS-1$ } }
private static PersonIdent tmpAuthor(List<RevCommit> commits) { // Construct a predictable author using most recent commit time. int t = 0; for (int i = 0; i < commits.size();) { t = Math.max(t, commits.get(i).getCommitTime()); } String name = "Ketch Stage"; //$NON-NLS-1$ String email = "tmp@tmp"; //$NON-NLS-1$ return new PersonIdent(name, email, t * 1000L, 0); }
@Override public String getCommitTime() throws GitCommitIdExecutionException { long timeSinceEpoch = evalCommit.getCommitTime(); Date commitDate = new Date(timeSinceEpoch * 1000); // git is "by sec" and java is "by ms" SimpleDateFormat smf = getSimpleDateFormatWithTimeZone(); return smf.format(commitDate); }
@Override public void putEntry(ZipOutputStream out, ObjectId tree, String path, FileMode mode, ObjectLoader loader) throws IOException { // loader is null for directories... if (loader != null) { ZipEntry entry = new ZipEntry(path); if (tree instanceof RevCommit) { long t = ((RevCommit) tree).getCommitTime() * 1000L; entry.setTime(t); } out.putNextEntry(entry); out.write(loader.getBytes()); out.closeEntry(); } }
@Override public void putEntry(ZipOutputStream out, ObjectId tree, String path, FileMode mode, ObjectLoader loader) throws IOException { // loader is null for directories... if (loader != null) { ZipEntry entry = new ZipEntry(path); if (tree instanceof RevCommit) { long t = ((RevCommit) tree).getCommitTime() * 1000L; entry.setTime(t); } out.putNextEntry(entry); out.write(loader.getBytes()); out.closeEntry(); } }
private int minCommitTime() throws IOException { int min = Integer.MAX_VALUE; for (ObjectId id : revs) { RevObject o = walk.parseAny(id); while (o instanceof RevTag) { o = ((RevTag) o).getObject(); walk.parseHeaders(o); } if (o instanceof RevCommit) { RevCommit c = (RevCommit) o; if (c.getCommitTime() < min) min = c.getCommitTime(); } } return min; }
public static ArrayMemory valueOf(RevCommit value) { ArrayMemory memory = valueOf((RevObject) value); memory.refOfIndex("commitTime").assign(value.getCommitTime()); memory.refOfIndex("encoding").assign(value.getEncodingName()); memory.refOfIndex("shortMessage").assign(value.getShortMessage()); memory.refOfIndex("fullMessage").assign(value.getFullMessage()); ArrayMemory parents = new ArrayMemory(); for (RevCommit revCommit : value.getParents()) { parents.add(valueOf((RevObject)revCommit)); } memory.refOfIndex("parents").assign(parents); PersonIdent authorIdent = value.getAuthorIdent(); memory.refOfIndex("author").assign(authorIdent == null ? Memory.NULL : valueOf(authorIdent)); PersonIdent committerIdent = value.getCommitterIdent(); memory.refOfIndex("committer").assign(committerIdent == null ? Memory.NULL : valueOf(committerIdent)); return memory; }
private static RevTree getTree(Repository repository) throws IOException { ObjectId lastCommitId = repository.resolve(Constants.HEAD); // a RevWalk allows to walk over commits based on some filtering try (RevWalk revWalk = new RevWalk(repository)) { RevCommit commit = revWalk.parseCommit(lastCommitId); System.out.println("Time of commit (seconds since epoch): " + commit.getCommitTime()); // and using commit's tree find the path RevTree tree = commit.getTree(); System.out.println("Having tree: " + tree); return tree; } }
private int maxTimeWanted(Collection<Ref> wants) { int maxTime = 0; for (Ref r : wants) { try { final RevObject obj = walk.parseAny(r.getObjectId()); if (obj instanceof RevCommit) { final int cTime = ((RevCommit) obj).getCommitTime(); if (maxTime < cTime) maxTime = cTime; } } catch (IOException error) { // We don't have it, but we want to fetch (thus fixing error). } } return maxTime; }
private static RevTree getTree(Repository repository) throws IOException { ObjectId lastCommitId = repository.resolve(Constants.HEAD); // a RevWalk allows to walk over commits based on some filtering try (RevWalk revWalk = new RevWalk(repository)) { RevCommit commit = revWalk.parseCommit(lastCommitId); System.out.println("Time of commit (seconds since epoch): " + commit.getCommitTime()); // and using commit's tree find the path RevTree tree = commit.getTree(); System.out.println("Having tree: " + tree); return tree; } }
long timeof(RevObject o) { if (o instanceof RevCommit) return ((RevCommit) o).getCommitTime(); if (o instanceof RevTag) { RevTag tag = (RevTag) o; try { parseBody(tag); } catch (IOException e) { return 0; } PersonIdent who = tag.getTaggerIdent(); return who != null ? who.getWhen().getTime() : 0; } return 0; }
private void processCommit(RevObject obj) throws TransportException { final RevCommit commit = (RevCommit) obj; markLocalCommitsComplete(commit.getCommitTime()); needs(commit.getTree()); for (RevCommit p : commit.getParents()) needs(p); obj.add(COMPLETE); }
private void markLocalCommitsComplete(int until) throws TransportException { try { for (;;) { final RevCommit c = localCommitQueue.peek(); if (c == null || c.getCommitTime() < until) return; localCommitQueue.next(); markTreeComplete(c.getTree()); for (RevCommit p : c.getParents()) pushLocalCommit(p); } } catch (IOException err) { throw new TransportException(JGitText.get().localObjectsIncomplete, err); } }