summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorTomasz Zarna2012-03-02 09:27:09 (EST)
committer Tomasz Zarna2012-03-02 09:27:09 (EST)
commit8860f7f7eaab5cd69a4648ea3de56bce50121da4 (patch)
tree668c3bdae94b27f96296244997b656fbaa7d5771
parentb8e520aa69b7edc774317f25eccc715f46cdfa23 (diff)
downloadegit-pde-8860f7f7eaab5cd69a4648ea3de56bce50121da4.zip
egit-pde-8860f7f7eaab5cd69a4648ea3de56bce50121da4.tar.gz
egit-pde-8860f7f7eaab5cd69a4648ea3de56bce50121da4.tar.bz2
Ensure Copyright Checker/Updater works with Gitrefs/changes/23/5223/1
-rw-r--r--org.eclipse.egit.relengtools/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--org.eclipse.egit.relengtools/plugin.xml2
-rw-r--r--org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/GitCopyrightAdapter.java28
-rw-r--r--org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/GitCopyrightAdapterFactory.java5
4 files changed, 27 insertions, 15 deletions
diff --git a/org.eclipse.egit.relengtools/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.egit.relengtools/.settings/org.eclipse.jdt.core.prefs
index 23a3bc1..fa6d37d 100644
--- a/org.eclipse.egit.relengtools/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.egit.relengtools/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Thu Oct 14 11:01:27 CEST 2010
+#Fri Mar 02 13:17:33 CET 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
@@ -84,9 +84,12 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
diff --git a/org.eclipse.egit.relengtools/plugin.xml b/org.eclipse.egit.relengtools/plugin.xml
index 3bd3349..5e89307 100644
--- a/org.eclipse.egit.relengtools/plugin.xml
+++ b/org.eclipse.egit.relengtools/plugin.xml
@@ -15,7 +15,7 @@
<extension
point="org.eclipse.core.runtime.adapters">
<factory
- adaptableType="org.eclipse.team.core.RepositoryProviderType"
+ adaptableType="org.eclipse.egit.core.internal.GitRepositoryProviderType"
class="org.eclipse.egit.internal.relengtools.GitCopyrightAdapterFactory">
<adapter
type="org.eclipse.releng.tools.IRepositoryProviderCopyrightAdapterFactory">
diff --git a/org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/GitCopyrightAdapter.java b/org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/GitCopyrightAdapter.java
index dfce499..caf807b 100644
--- a/org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/GitCopyrightAdapter.java
+++ b/org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/GitCopyrightAdapter.java
@@ -19,6 +19,8 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
@@ -26,6 +28,7 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.treewalk.filter.PathFilter;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.releng.tools.RepositoryProviderCopyrightAdapter;
public class GitCopyrightAdapter extends RepositoryProviderCopyrightAdapter {
@@ -36,22 +39,24 @@ public class GitCopyrightAdapter extends RepositoryProviderCopyrightAdapter {
super(resources);
}
+ @Override
public int getLastModifiedYear(IFile file, IProgressMonitor monitor)
throws CoreException {
try {
monitor.beginTask("Fetching logs from Git", 100); //$NON-NLS-1$
- RepositoryMapping mapping = RepositoryMapping.getMapping(file);
+ final RepositoryMapping mapping = RepositoryMapping
+ .getMapping(file);
if (mapping != null) {
- Repository repo = mapping.getRepository();
+ final Repository repo = mapping.getRepository();
if (repo != null) {
RevWalk walk = null;
try {
- ObjectId start = repo.resolve(Constants.HEAD);
+ final ObjectId start = repo.resolve(Constants.HEAD);
walk = new RevWalk(repo);
walk.setTreeFilter(PathFilter.create(mapping
.getRepoRelativePath(file)));
walk.markStart(walk.lookupCommit(start));
- RevCommit commit = walk.next();
+ final RevCommit commit = walk.next();
if (commit != null) {
if (filterString != null
&& commit.getFullMessage().toLowerCase()
@@ -60,13 +65,17 @@ public class GitCopyrightAdapter extends RepositoryProviderCopyrightAdapter {
// ignore
return 0;
}
- Calendar calendar = Calendar.getInstance();
- calendar.setTimeInMillis(commit.getCommitTime() * 1000);
+ final Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(0);
+ calendar.add(Calendar.SECOND,
+ commit.getCommitTime());
return calendar.get(Calendar.YEAR);
}
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ } catch (final IOException e) {
+ throw new CoreException(new Status(IStatus.ERROR,
+ "org.eclipse.egit.relengtools", 0, NLS.bind(
+ "An error occured when processing {0}",
+ file.getName()), e));
} finally {
if (walk != null)
walk.release();
@@ -80,6 +89,7 @@ public class GitCopyrightAdapter extends RepositoryProviderCopyrightAdapter {
return -1;
}
+ @Override
public void initialize(IProgressMonitor monitor) throws CoreException {
// TODO We should perform a bulk "log" command to get the last modified
// year
diff --git a/org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/GitCopyrightAdapterFactory.java b/org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/GitCopyrightAdapterFactory.java
index cbab564..dc9ac38 100644
--- a/org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/GitCopyrightAdapterFactory.java
+++ b/org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/GitCopyrightAdapterFactory.java
@@ -27,12 +27,12 @@ public class GitCopyrightAdapterFactory implements IAdapterFactory,
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (IRepositoryProviderCopyrightAdapterFactory.class
.equals(adapterType)) {
- return getCvsCopyrightAdapter(adaptableObject);
+ return getGitCopyrightAdapter(adaptableObject);
}
return null;
}
- private Object getCvsCopyrightAdapter(Object adaptableObject) {
+ private Object getGitCopyrightAdapter(Object adaptableObject) {
if (!(adaptableObject instanceof RepositoryProviderType))
return null;
return this;
@@ -48,5 +48,4 @@ public class GitCopyrightAdapterFactory implements IAdapterFactory,
IResource[] resources) {
return new GitCopyrightAdapter(resources);
}
-
}