{"thread":{"id":"19820","subject":"[EGIT PATCH1/2] fix-CommitTimeRevFilter-by-adding-a-Between-filter","startedAt":"2009-06-15T21:35:16Z","lastAt":"2009-06-15T21:35:16Z","messageCount":1,"participants":["Mark Struberg"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"116359","messageId":"79030.47302.qm@web27808.mail.ukl.yahoo.com","threadId":"19820","inReplyTo":null,"subject":"[EGIT PATCH1/2] fix-CommitTimeRevFilter-by-adding-a-Between-filter","fromName":"Mark Struberg","fromEmail":"struberg@yahoo.de","sentAt":"2009-06-15T21:35:16Z","receivedAt":"2009-06-15T21:35:16Z","isPatch":false,"sender":{"key":"struberg@yahoo.de","avatar":"https://gravatar.com/avatar/119742c3e8dbc8db35a92bdff0581aec8d364d415f770e60431cba262daa974f?d=mp&s=160"},"body":"\n>From 0a5e2d469972791cdc2e1db00602142980050af8 Mon Sep 17 00:00:00 2001\nFrom: Mark Struberg <struberg@yahoo.de>\nDate: Mon, 15 Jun 2009 01:25:25 +0200\nSubject: [PATCH] fix CommitTimeRevFilter by adding a Between filter subclass\n\n---\n .../jgit/revwalk/filter/CommitTimeRevFilter.java   |   29 ++++++++++++++++++++\n 1 files changed, 29 insertions(+), 0 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/filter/CommitTimeRevFilter.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/filter/CommitTimeRevFilter.java\nindex a3751b8..0aaa78d 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/filter/CommitTimeRevFilter.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/filter/CommitTimeRevFilter.java\n@@ -70,6 +70,18 @@ public static final RevFilter after(final Date ts) {\n \t\treturn new After(ts.getTime());\n \t}\n \n+\t/**\n+\t * Create a new filter to select commits after or equal a given date/time <code>since</code> \n+\t * and before or equal a given date/time <code>until</code>.\n+\t * \n+\t * @param since the point in time to cut on.\n+\t * @param until the point in time to cut off.\n+\t * @return a new filter to select commits between the given date/times.\n+\t */\n+\tpublic static final RevFilter between(final Date since, final Date until) {\n+\t\treturn new Between(since.getTime(), until.getTime());\n+\t}\n+\n \tfinal int when;\n \n \tCommitTimeRevFilter(final long ts) {\n@@ -117,4 +129,21 @@ public boolean include(final RevWalk walker, final RevCommit cmit)\n \t\t\treturn true;\n \t\t}\n \t}\n+\n+\tprivate static class Between extends CommitTimeRevFilter {\n+\t\tprivate final int until;\n+\n+\t\tBetween(final long since, final long until) {\n+\t\t\tsuper(since);\n+\t\t\tthis.until = (int) (until / 1000); \n+\t\t}\n+\n+\t\t@Override\n+\t\tpublic boolean include(final RevWalk walker, final RevCommit cmit)\n+\t\t\t\tthrows StopWalkException, MissingObjectException,\n+\t\t\t\tIncorrectObjectTypeException, IOException {\n+\t\t\treturn cmit.getCommitTime() <= until && cmit.getCommitTime() >= when;\n+\t\t}\n+\t}\n+\n }\n-- \n1.6.0.6\n\n\n\n      \n"}]}