git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>,
	Marek Zawirski <marek.zawirski@gmail.com>
Cc: git@vger.kernel.org
Subject: [EGIT PATCH 08/11] Expose the current entry's length, last modified in WorkingTreeIterator
Date: Sun, 10 Aug 2008 01:46:23 -0700	[thread overview]
Message-ID: <1218357986-19671-9-git-send-email-spearce@spearce.org> (raw)
In-Reply-To: <1218357986-19671-8-git-send-email-spearce@spearce.org>

We need the last modified time available to us in application level
code so we can pull the current WorkingTreeIterator from TreeWalk
and then grab the last modified time off it to compare against the
index file.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../spearce/jgit/treewalk/WorkingTreeIterator.java |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java
index cb4a089..05d9282 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java
@@ -259,6 +259,25 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
 		pathLen = pathOffset + nameLen;
 	}
 
+	/**
+	 * Get the byte length of this entry.
+	 * 
+	 * @return size of this file, in bytes.
+	 */
+	public long getEntryLength() {
+		return current().getLength();
+	}
+
+	/**
+	 * Get the last modified time of this entry.
+	 * 
+	 * @return last modified time of this file, in milliseconds since the epoch
+	 *         (Jan 1, 1970 UTC).
+	 */
+	public long getEntryLastModified() {
+		return current().getLastModified();
+	}
+
 	private static final Comparator<Entry> ENTRY_CMP = new Comparator<Entry>() {
 		public int compare(final Entry o1, final Entry o2) {
 			final byte[] a = o1.encodedName;
-- 
1.6.0.rc2.219.g1250ab

  reply	other threads:[~2008-08-10  8:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-10  8:46 [EGIT PATCH 00/11] Misc. cleanups and improvements Shawn O. Pearce
2008-08-10  8:46 ` [EGIT PATCH 01/11] Fix RawParseUtils.endOfParagraph to work on all corner cases Shawn O. Pearce
2008-08-10  8:46   ` [EGIT PATCH 02/11] Add test case for the RevCommit parsing code Shawn O. Pearce
2008-08-10  8:46     ` [EGIT PATCH 03/11] Notify AbstractTreeIterator implementations of skipped tree entries Shawn O. Pearce
2008-08-10  8:46       ` [EGIT PATCH 04/11] Allow AbstractTreeIterator subclasses to supply their own path array Shawn O. Pearce
2008-08-10  8:46         ` [EGIT PATCH 05/11] Allow WorkingTreeIterators to define their prefix path when created Shawn O. Pearce
2008-08-10  8:46           ` [EGIT PATCH 06/11] Add getTree to TreeWalk for locating the current iterator instance Shawn O. Pearce
2008-08-10  8:46             ` [EGIT PATCH 07/11] Allow WorkingTreeIterator to track last modified time for entries Shawn O. Pearce
2008-08-10  8:46               ` Shawn O. Pearce [this message]
2008-08-10  8:46                 ` [EGIT PATCH 09/11] Expose idBuffer,idOffset in AbstractTreeIterator to applications Shawn O. Pearce
2008-08-10  8:46                   ` [EGIT PATCH 10/11] Add a TreeWalk iterator implementation for IContainer Shawn O. Pearce
2008-08-10  8:46                     ` [EGIT PATCH 11/11] Teach NB how to encode/decode an unsigned 16 bit integer Shawn O. Pearce
2008-08-13 20:41                     ` [EGIT PATCH 10/11] Add a TreeWalk iterator implementation for IContainer Robin Rosenberg
2008-08-14  4:19                       ` Shawn O. Pearce
2008-08-14  5:20                         ` Robin Rosenberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1218357986-19671-9-git-send-email-spearce@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=marek.zawirski@gmail.com \
    --cc=robin.rosenberg@dewire.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).