Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2015-05-26 10:56:30 -0400
committerMatthias Sohn2015-05-26 10:56:36 -0400
commit6e30f1041361334024f05ae62d74ec222565ab13 (patch)
tree29d5fa58a6fb2d111c4757d8812de24ecb34a679
parentc5941b236860f76e4fe12c64fc615b473c2e7090 (diff)
parentb5523213757eac45e42bcca51a68b84c3be5080d (diff)
downloadegit-github-6e30f1041361334024f05ae62d74ec222565ab13.tar.gz
egit-github-6e30f1041361334024f05ae62d74ec222565ab13.tar.xz
egit-github-6e30f1041361334024f05ae62d74ec222565ab13.zip
Merge branch 'stable-4.0'
* stable-4.0: Prepare post 4.0.0-RC2 builds EGit Mylyn Github Connector v4.0.0.201505260635-rc2 Update target platform for Mars RC2 Use try-with-resource to close JGit walks Change-Id: Id47472e1111763e10f01cb5f798e9d56bf8d5647 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.mylyn.github-feature/github.target8
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CheckoutPullRequestHandler.java5
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CommitAttributePart.java5
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestContextSynchronizer.java43
4 files changed, 26 insertions, 35 deletions
diff --git a/org.eclipse.mylyn.github-feature/github.target b/org.eclipse.mylyn.github-feature/github.target
index 472d352f..c7451ef3 100644
--- a/org.eclipse.mylyn.github-feature/github.target
+++ b/org.eclipse.mylyn.github-feature/github.target
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.6"?>
-<target includeMode="feature" name="Mylyn GitHub Connector Target" sequenceNumber="3">
+<target includeMode="feature" name="Mylyn GitHub Connector Target" sequenceNumber="4">
<locations>
<location includeAllPlatforms="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.hamcrest" version="1.1.0.v20090501071000"/>
<unit id="com.google.gson" version="1.6.0.v201101131530"/>
<unit id="org.mockito" version="1.8.4.v201303031500"/>
-<unit id="org.objenesis" version="1.0.0.v201105211943"/>
+<unit id="org.objenesis" version="1.0.0.v201505121915"/>
<unit id="org.junit" version="4.11.0.v201303080030"/>
-<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20150202203538/repository/"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20150519210750/repository/"/>
</location>
<location includeAllPlatforms="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.platform.ide" version="0.0.0"/>
-<repository location="http://download.eclipse.org/eclipse/updates/4.3"/>
+<repository location="http://download.eclipse.org/eclipse/updates/4.4"/>
</location>
<location includeAllPlatforms="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.mylyn_feature.feature.group" version="0.0.0"/>
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CheckoutPullRequestHandler.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CheckoutPullRequestHandler.java
index b063ef5c..10e6f78a 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CheckoutPullRequestHandler.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CheckoutPullRequestHandler.java
@@ -61,11 +61,8 @@ public class CheckoutPullRequestHandler extends TaskDataHandler {
private RevCommit getBase(Repository repo, PullRequest request)
throws IOException {
- RevWalk walk = new RevWalk(repo);
- try {
+ try (RevWalk walk = new RevWalk(repo)) {
return walk.parseCommit(repo.resolve(request.getBase().getSha()));
- } finally {
- walk.release();
}
}
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CommitAttributePart.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CommitAttributePart.java
index 47f79bb0..4e0b08e4 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CommitAttributePart.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/CommitAttributePart.java
@@ -165,8 +165,7 @@ public class CommitAttributePart extends AbstractTaskEditorSection {
return;
if (repository == null)
return;
- RevWalk walk = new RevWalk(repository);
- try {
+ try (RevWalk walk = new RevWalk(repository)) {
for (Object element : elements) {
String id = ((PullRequestCommitAdapter) element).getCommit()
.getSha();
@@ -198,8 +197,6 @@ public class CommitAttributePart extends AbstractTaskEditorSection {
}
} catch (IOException e) {
GitHubUi.logError(e);
- } finally {
- walk.release();
}
}
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestContextSynchronizer.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestContextSynchronizer.java
index bf4eba6a..33c58b1d 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestContextSynchronizer.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestContextSynchronizer.java
@@ -56,7 +56,6 @@ public class PullRequestContextSynchronizer extends TaskActivationAdapter {
if (context == null)
return;
- RevWalk walk = null;
try {
TaskData data = TasksUi.getTaskDataManager().getTaskData(task);
PullRequestComposite prComp = PullRequestConnector
@@ -67,35 +66,33 @@ public class PullRequestContextSynchronizer extends TaskActivationAdapter {
Repository repository = PullRequestUtils.getRepository(request);
if (repository == null)
return;
- walk = new RevWalk(repository);
- TreeWalk diffs = new TreeWalk(walk.getObjectReader());
- diffs.setFilter(TreeFilter.ANY_DIFF);
- diffs.setRecursive(true);
- diffs.addTree(walk.parseCommit(
- ObjectId.fromString(request.getHead().getSha())).getTree());
- diffs.addTree(walk.parseCommit(
- ObjectId.fromString(request.getBase().getSha())).getTree());
- Set<IResource> resources = new HashSet<IResource>();
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- String base = repository.getWorkTree().getAbsolutePath() + "/"; //$NON-NLS-1$
- while (diffs.next()) {
- IFile file = root.getFileForLocation(Path.fromOSString(base
- + diffs.getPathString()));
- if (file != null)
- resources.add(file);
+ try (RevWalk walk = new RevWalk(repository);
+ TreeWalk diffs = new TreeWalk(walk.getObjectReader())) {
+ diffs.setFilter(TreeFilter.ANY_DIFF);
+ diffs.setRecursive(true);
+ diffs.addTree(walk.parseCommit(
+ ObjectId.fromString(request.getHead().getSha())).getTree());
+ diffs.addTree(walk.parseCommit(
+ ObjectId.fromString(request.getBase().getSha())).getTree());
+ Set<IResource> resources = new HashSet<IResource>();
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ String base = repository.getWorkTree().getAbsolutePath() + "/"; //$NON-NLS-1$
+ while (diffs.next()) {
+ IFile file = root.getFileForLocation(Path.fromOSString(base
+ + diffs.getPathString()));
+ if (file != null)
+ resources.add(file);
+ }
+ if (!resources.isEmpty())
+ ResourcesUi.addResourceToContext(resources,
+ InteractionEvent.Kind.SELECTION);
}
- if (!resources.isEmpty())
- ResourcesUi.addResourceToContext(resources,
- InteractionEvent.Kind.SELECTION);
} catch (MissingObjectException ignored) {
// Ignored
} catch (IOException e) {
GitHubUi.logError(e);
} catch (CoreException e) {
GitHubUi.logError(e);
- } finally {
- if (walk != null)
- walk.release();
}
}
}

Back to the top