maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [2/2] git commit: add some debugging but still does not work locally on osx
Date Wed, 17 Jul 2013 11:16:08 GMT
add some debugging but still does not work locally on osx


Project: http://git-wip-us.apache.org/repos/asf/maven-scm/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-scm/commit/665256d0
Tree: http://git-wip-us.apache.org/repos/asf/maven-scm/tree/665256d0
Diff: http://git-wip-us.apache.org/repos/asf/maven-scm/diff/665256d0

Branch: refs/heads/master
Commit: 665256d0534307b093b228b4117f8435fffdb17a
Parents: e734139
Author: Olivier Lamy <olamy@apache.org>
Authored: Wed Jul 17 21:15:55 2013 +1000
Committer: Olivier Lamy <olamy@apache.org>
Committed: Wed Jul 17 21:15:55 2013 +1000

----------------------------------------------------------------------
 .../provider/git/jgit/command/JGitUtils.java    | 25 ++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-scm/blob/665256d0/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/JGitUtils.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/JGitUtils.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/JGitUtils.java
index aca1388..dabcf02 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/JGitUtils.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/JGitUtils.java
@@ -21,6 +21,7 @@ import org.eclipse.jgit.diff.RawTextComparator;
 import org.eclipse.jgit.errors.CorruptObjectException;
 import org.eclipse.jgit.errors.IncorrectObjectTypeException;
 import org.eclipse.jgit.errors.MissingObjectException;
+import org.eclipse.jgit.errors.StopWalkException;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.ProgressMonitor;
@@ -31,7 +32,9 @@ import org.eclipse.jgit.revwalk.RevCommit;
 import org.eclipse.jgit.revwalk.RevFlag;
 import org.eclipse.jgit.revwalk.RevSort;
 import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.jgit.revwalk.RevWalkUtils;
 import org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter;
+import org.eclipse.jgit.revwalk.filter.RevFilter;
 import org.eclipse.jgit.transport.CredentialsProvider;
 import org.eclipse.jgit.transport.PushResult;
 import org.eclipse.jgit.transport.RefSpec;
@@ -321,9 +324,10 @@ public class JGitUtils
      * @throws IncorrectObjectTypeException
      */
     public static List<RevCommit> getRevCommits( Repository repo, RevSort[] sortings,
String fromRev, String toRev,
-                                                 Date fromDate, Date toDate, int maxLines
)
+                                                 final Date fromDate, final Date toDate,
int maxLines )
         throws IOException, MissingObjectException, IncorrectObjectTypeException
     {
+
         List<RevCommit> revs = new ArrayList<RevCommit>();
         RevWalk walk = new RevWalk( repo );
 
@@ -342,7 +346,24 @@ public class JGitUtils
 
         if ( fromDate != null && toDate != null )
         {
-            walk.setRevFilter( CommitTimeRevFilter.between( fromDate, toDate ) );
+            //walk.setRevFilter( CommitTimeRevFilter.between( fromDate, toDate ) );
+            walk.setRevFilter( new RevFilter()
+            {
+                @Override
+                public boolean include( RevWalk walker, RevCommit cmit )
+                    throws StopWalkException, MissingObjectException, IncorrectObjectTypeException,
IOException
+                {
+                    int cmtTime = cmit.getCommitTime();
+
+                    return ( cmtTime >= (  fromDate.getTime() / 1000  ) ) && (
cmtTime <= ( toDate.getTime() / 1000) );
+                }
+
+                @Override
+                public RevFilter clone()
+                {
+                    return this;
+                }
+            } );
         }
         else
         {


Mime
View raw message