Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2015-06-09 12:17:30 -0400
committerAlexander Kurtakov2015-07-13 04:23:51 -0400
commit69d1b35e3e0fca4a0523075be7c14e4ce9fa4545 (patch)
treebec628dd49512ced1fb548636510884f202945d6
parent082080d81ff17a396d81b9ff33f51fd98ce89ca8 (diff)
downloadorg.eclipse.tycho.extras-69d1b35e3e0fca4a0523075be7c14e4ce9fa4545.tar.gz
org.eclipse.tycho.extras-69d1b35e3e0fca4a0523075be7c14e4ce9fa4545.tar.xz
org.eclipse.tycho.extras-69d1b35e3e0fca4a0523075be7c14e4ce9fa4545.zip
Bug 472455 - update JGit to 4.0.1
Port buildtimestamp jgit to the new api. Change-Id: I900cea63627b9b902110fe474b4370976769e588 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--pom.xml2
-rw-r--r--tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java15
-rw-r--r--tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/PathFilter.java10
3 files changed, 13 insertions, 14 deletions
diff --git a/pom.xml b/pom.xml
index c476294..3c6dbad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven-version>3.0</maven-version>
<plugin-tools-version>3.3</plugin-tools-version>
- <jgit-version>3.5.3.201412180710-r</jgit-version>
+ <jgit-version>4.0.1.201506240215-r</jgit-version>
<!-- tycho-extras and tycho are normally developed and released in parallel using the same version -->
<tycho-version>${project.version}</tycho-version>
<min.jdk.version>1.7</min.jdk.version>
diff --git a/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java b/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java
index ae5b7fa..fb0d785 100644
--- a/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java
+++ b/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java
@@ -152,12 +152,10 @@ public class JGitBuildTimestampProvider implements BuildTimestampProvider {
logger.warn("Fallback to default timestamp provider");
return defaultTimestampProvider.getTimestamp(session, project, execution);
} else {
- throw new MojoExecutionException(
- message
- + "\n"
- + "You are trying to use tycho-buildtimestamp-jgit on a directory that has uncommitted changes (see details above)."
- + "\nEither commit all changes/add files to .gitignore, or enable fallback to default timestamp provider by configuring "
- + "\njgit.dirtyWorkingTree=warning for tycho-packaging-plugin");
+ throw new MojoExecutionException(message + "\n"
+ + "You are trying to use tycho-buildtimestamp-jgit on a directory that has uncommitted changes (see details above)."
+ + "\nEither commit all changes/add files to .gitignore, or enable fallback to default timestamp provider by configuring "
+ + "\njgit.dirtyWorkingTree=warning for tycho-packaging-plugin");
}
}
}
@@ -172,12 +170,13 @@ public class JGitBuildTimestampProvider implements BuildTimestampProvider {
// When dirtyBehaviour==ignore and no commit was ever done,
// the commit is null, so we fallback to the defaultTimestampProvider
if (commit == null) {
- logger.info("Fallback to default timestamp provider, because no commit could be found for that project (Shared but not commited yet).");
+ logger.info(
+ "Fallback to default timestamp provider, because no commit could be found for that project (Shared but not commited yet).");
return defaultTimestampProvider.getTimestamp(session, project, execution);
}
return new Date(commit.getCommitTime() * 1000L);
} finally {
- walk.release();
+ walk.close();
}
} finally {
repository.close();
diff --git a/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/PathFilter.java b/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/PathFilter.java
index ce349e9..96e6c51 100644
--- a/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/PathFilter.java
+++ b/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/PathFilter.java
@@ -18,7 +18,7 @@ import java.util.StringTokenizer;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
-import org.eclipse.jgit.ignore.IgnoreRule;
+import org.eclipse.jgit.ignore.FastIgnoreRule;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.jgit.treewalk.filter.TreeFilter;
@@ -27,16 +27,16 @@ public class PathFilter extends TreeFilter {
private final byte[] basedir;
- private final List<IgnoreRule> rules;
+ private final List<FastIgnoreRule> rules;
public PathFilter(String basedir, String filters) {
this.basedir = Constants.encode(basedir);
if (filters != null) {
StringTokenizer st = new StringTokenizer(filters, "\n\r\f", false);
- List<IgnoreRule> rules = new ArrayList<IgnoreRule>();
+ List<FastIgnoreRule> rules = new ArrayList<FastIgnoreRule>();
while (st.hasMoreTokens()) {
- rules.add(new IgnoreRule(st.nextToken().trim()));
+ rules.add(new FastIgnoreRule(st.nextToken().trim()));
}
this.rules = Collections.unmodifiableList(rules);
} else {
@@ -53,7 +53,7 @@ public class PathFilter extends TreeFilter {
if (!tw.isSubtree() && rules != null) {
String path = tw.getPathString();
- for (IgnoreRule rule : rules) {
+ for (FastIgnoreRule rule : rules) {
if (rule.isMatch(path, tw.isSubtree())) {
return !rule.getResult();
}

Back to the top