From 4dc870a9e4bffca0705b87ce2bdf4364bd255686 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Fri, 4 Oct 2019 20:53:51 +0200 Subject: [PATCH 1/8] add hint how to authenticate against *-review.googlesource.com related to issue #365 --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 3bd6d617..4627be23 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,14 @@ Diff viewing is based on Git operations (i.e. it fetches the commit from the Ger takes a lot of time, you can run a local "[git gc](https://www.kernel.org/pub/software/scm/git/docs/git-gc.html)" and ask your Gerrit administrator to do run a "[gerrit gc](https://gerrit-review.googlesource.com/Documentation/cmd-gc.html)". +### Authenticate against *-review.googlesource.com +It's a bit of manual work to do: +Settings -> HTTP Credentials -> Obtain password + +Then search for the line in the text area starting with `*-review.googlesource.com` (e.g. `gerrit-review.googlesource.com`) and extract username and password: + +gerrit-review.googlesource.com,FALSE,/,TRUE,12345678,o,**git-username.gmail.com**=**password-until-end-of-line** + Architecture ------------ ### IntelliJ Integration From 88d9472fec4f3801ea122fb409d822992d87eef1 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Sat, 16 Nov 2019 12:49:57 +0100 Subject: [PATCH 2/8] prevent exception when Change#subject is null I do not know how to reproduce this exception, but received it several times from users. --- .../intellij/plugin/gerrit/ui/GerritChangeDetailsPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeDetailsPanel.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeDetailsPanel.java index 972448ad..f339f66a 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeDetailsPanel.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeDetailsPanel.java @@ -155,7 +155,7 @@ public void setCommit(final ChangeInfo changeInfo) { } private void addMetaData(ChangeInfo changeInfo, StringBuilder sb) { - final String comment = IssueLinkHtmlRenderer.formatTextWithLinks(project, changeInfo.subject); + String comment = changeInfo.subject != null ? IssueLinkHtmlRenderer.formatTextWithLinks(project, changeInfo.subject) : "-"; sb.append("").append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont())) .append("") .append("") From 1f1b269d73508158d2db3b9b01baa9de8f3f703f Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Tue, 17 Dec 2019 22:05:19 +0100 Subject: [PATCH 3/8] build valid git branch name on checkout fixes bug #373 --- .../intellij/plugin/gerrit/ui/action/CheckoutAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CheckoutAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CheckoutAction.java index 112127fb..21120b64 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CheckoutAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CheckoutAction.java @@ -125,11 +125,11 @@ private String buildBranchName(ChangeInfo changeDetails) { if (topic == null) { topic = Integer.toString(changeDetails._number); } - String branchName = "review/" + changeDetails.owner.name.toLowerCase().replace(" ", "_").replace("?", "_") + '/' + topic; + String branchName = "review/" + changeDetails.owner.name.toLowerCase() + '/' + topic; if (revisionInfo._number != changeDetails.revisions.size()) { branchName += "-patch" + revisionInfo._number; } - return branchName; + return branchName.replace(" ", "_").replace("?", "_"); } public static class Proxy extends CheckoutAction { From 8aecc54103553249678cd5b2ce6ee398ffd8f011 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Wed, 18 Dec 2019 21:27:41 +0100 Subject: [PATCH 4/8] replace deprecated icons --- .../intellij/plugin/gerrit/ui/action/AbandonAction.java | 2 +- .../intellij/plugin/gerrit/ui/action/CompareBranchAction.java | 2 +- .../intellij/plugin/gerrit/ui/action/DeleteAction.java | 2 +- .../intellij/plugin/gerrit/ui/action/PublishAction.java | 2 +- .../intellij/plugin/gerrit/ui/action/SubmitAction.java | 2 +- .../intellij/plugin/gerrit/ui/diff/RemoveCommentAction.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/AbandonAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/AbandonAction.java index 82060f0e..208dfef2 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/AbandonAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/AbandonAction.java @@ -39,7 +39,7 @@ public class AbandonAction extends AbstractLoggedInChangeAction { public AbandonAction() { - super("Abandon", "Abandon Change", AllIcons.Actions.Delete); + super("Abandon", "Abandon Change", AllIcons.Actions.Cancel); } @Override diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CompareBranchAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CompareBranchAction.java index e17a144f..0c98f196 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CompareBranchAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CompareBranchAction.java @@ -48,7 +48,7 @@ public class CompareBranchAction extends AbstractChangeAction { private NotificationService notificationService; public CompareBranchAction() { - super("Compare with Branch", "Compare change with current branch", AllIcons.Actions.DiffWithCurrent); + super("Compare with Branch", "Compare change with current branch", AllIcons.Actions.Diff); } @Override diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/DeleteAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/DeleteAction.java index 00a82d06..b44b282a 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/DeleteAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/DeleteAction.java @@ -33,7 +33,7 @@ public class DeleteAction extends AbstractLoggedInChangeAction { public DeleteAction() { - super("Delete Draft", "Delete Draft Change", AllIcons.Actions.Delete); + super("Delete Draft", "Delete Draft Change", AllIcons.Actions.Cancel); } @Override diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/PublishAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/PublishAction.java index 2ed1928c..f7829852 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/PublishAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/PublishAction.java @@ -35,7 +35,7 @@ public class PublishAction extends AbstractLoggedInChangeAction { public PublishAction() { - super("Publish Draft", "Publish Draft Change", AllIcons.Actions.Nextfile); + super("Publish Draft", "Publish Draft Change", AllIcons.Actions.Forward); } @Override diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/SubmitAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/SubmitAction.java index f7d5a573..4f98834b 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/SubmitAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/SubmitAction.java @@ -38,7 +38,7 @@ public class SubmitAction extends AbstractLoggedInChangeAction { private NotificationService notificationService; public SubmitAction() { - super("Submit", "Submit Change", AllIcons.Actions.Export); + super("Submit", "Submit Change", AllIcons.ToolbarDecorator.Export); } @Override diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/diff/RemoveCommentAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/diff/RemoveCommentAction.java index 6700d041..090a008e 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/diff/RemoveCommentAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/diff/RemoveCommentAction.java @@ -52,7 +52,7 @@ public RemoveCommentAction(CommentsDiffTool commentsDiffTool, String revisionId, RangeHighlighter lineHighlighter, RangeHighlighter rangeHighlighter) { - super("Remove", "Remove selected comment", AllIcons.Actions.Delete); + super("Remove", "Remove selected comment", AllIcons.Actions.Cancel); this.commentsDiffTool = commentsDiffTool; this.comment = comment; From 7c36a0d9ee6e04442375b08999ddb1406a2fb3e9 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Sat, 18 Jan 2020 10:28:04 +0100 Subject: [PATCH 5/8] port away from deprecated ContainerUtil#newHashSet --- .../intellij/plugin/gerrit/ui/action/AddReviewersAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/AddReviewersAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/AddReviewersAction.java index c5cf0a15..06d56b44 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/AddReviewersAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/AddReviewersAction.java @@ -41,7 +41,6 @@ import com.intellij.ui.EditorTextFieldProvider; import com.intellij.ui.SoftWrapsEditorCustomization; import com.intellij.util.TextFieldCompletionProviderDumbAware; -import com.intellij.util.containers.ContainerUtil; import com.urswolfer.gerrit.client.rest.GerritRestApi; import com.urswolfer.intellij.plugin.gerrit.GerritModule; import org.jetbrains.annotations.NotNull; @@ -49,6 +48,7 @@ import javax.swing.*; import java.awt.*; +import java.util.HashSet; import java.util.List; import java.util.Set; @@ -97,7 +97,7 @@ protected AddReviewersDialog(Project project, setOKButtonText("Add Reviewers"); EditorTextFieldProvider service = ServiceManager.getService(project, EditorTextFieldProvider.class); - Set editorFeatures = ContainerUtil.newHashSet(); + Set editorFeatures = new HashSet(); editorFeatures.add(SoftWrapsEditorCustomization.ENABLED); editorFeatures.add(SpellCheckingEditorCustomization.DISABLED); reviewTextField = service.getEditorField(FileTypes.PLAIN_TEXT.getLanguage(), project, editorFeatures); From 7cfbbd64434347a12fc229a39cddcde8671036c5 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Sat, 18 Jan 2020 12:49:52 +0100 Subject: [PATCH 6/8] port away from deprecated Throwables#propagate --- .../PluginErrorReportSubmitter.java | 3 +-- .../plugin/gerrit/git/GerritGitUtil.java | 3 +-- .../plugin/gerrit/rest/GerritUtil.java | 23 +++++++++---------- .../gerrit/ui/action/AddReviewersAction.java | 3 +-- .../plugin/gerrit/ui/diff/RangeUtils.java | 5 ++-- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/errorreport/PluginErrorReportSubmitter.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/errorreport/PluginErrorReportSubmitter.java index 6060251e..f11e2a24 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/errorreport/PluginErrorReportSubmitter.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/errorreport/PluginErrorReportSubmitter.java @@ -17,7 +17,6 @@ package com.urswolfer.intellij.plugin.gerrit.errorreport; import com.google.common.base.Strings; -import com.google.common.base.Throwables; import com.google.gson.Gson; import com.intellij.openapi.application.ex.ApplicationInfoEx; import com.intellij.openapi.diagnostic.ErrorReportSubmitter; @@ -97,7 +96,7 @@ private void postError(String json) { httpClient.close(); } } catch (IOException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } } } diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java index 8c861029..c346fef1 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java @@ -21,7 +21,6 @@ import static git4idea.commands.GitSimpleEventDetector.Event.LOCAL_CHANGES_OVERWRITTEN_BY_CHERRY_PICK; import com.google.common.base.Optional; -import com.google.common.base.Throwables; import com.google.common.collect.Lists; import com.google.gerrit.extensions.common.ChangeInfo; import com.google.gerrit.extensions.common.FetchInfo; @@ -163,7 +162,7 @@ public void onSuccess() { successCallable.call(); } } catch (Exception e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } } diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritUtil.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritUtil.java index e630da06..066000d5 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritUtil.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritUtil.java @@ -21,7 +21,6 @@ import com.google.common.base.Joiner; import com.google.common.base.Strings; import com.google.common.base.Supplier; -import com.google.common.base.Throwables; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -128,7 +127,7 @@ public void run(@NotNull ProgressIndicator indicator) { if (exception.get() == null) { return result.get(); } - throw Throwables.propagate(exception.get()); + throw new RuntimeException(exception.get()); } public void postReview(final String changeId, @@ -143,7 +142,7 @@ public Void get() { gerritClient.changes().id(changeId).revision(revision).review(reviewInput); return null; } catch (RestApiException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } } }; @@ -161,7 +160,7 @@ public Void get() { gerritClient.changes().id(changeId).current().submit(submitInput); return null; } catch (RestApiException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } } }; @@ -178,7 +177,7 @@ public Void get() { gerritClient.changes().id(changeId).publish(); return null; } catch (RestApiException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } } }; @@ -195,7 +194,7 @@ public Void get() { gerritClient.changes().id(changeId).delete(); return null; } catch (RestApiException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } } }; @@ -213,7 +212,7 @@ public Void get() { gerritClient.changes().id(changeId).abandon(abandonInput); return null; } catch (RestApiException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } } }; @@ -231,7 +230,7 @@ public Void get() { gerritClient.changes().id(changeId).addReviewer(reviewerName); return null; } catch (RestApiException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } } }; @@ -256,7 +255,7 @@ public Void get() { } return null; } catch (RestApiException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } } }; @@ -279,7 +278,7 @@ public Void get() { gerritClient.changes().id(changeNr).revision(revision).setReviewed(filePath, true); return null; } catch (RestApiException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } } }; @@ -547,7 +546,7 @@ public CommentInfo get() { } return commentInfo; } catch (RestApiException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } } }; @@ -566,7 +565,7 @@ public Void get() { gerritClient.changes().id(changeNr).revision(revision).draft(draftCommentId).delete(); return null; } catch (RestApiException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } } }; diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/AddReviewersAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/AddReviewersAction.java index 06d56b44..66181b45 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/AddReviewersAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/AddReviewersAction.java @@ -19,7 +19,6 @@ import com.google.common.base.Optional; import com.google.common.base.Splitter; import com.google.common.base.Strings; -import com.google.common.base.Throwables; import com.google.gerrit.extensions.api.GerritApi; import com.google.gerrit.extensions.common.AccountInfo; import com.google.gerrit.extensions.common.ChangeInfo; @@ -137,7 +136,7 @@ protected void addCompletionVariants(@NotNull final String text, } } } catch (RestApiException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } } }; diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/diff/RangeUtils.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/diff/RangeUtils.java index 10f4a72c..2087c5bc 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/diff/RangeUtils.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/diff/RangeUtils.java @@ -16,7 +16,6 @@ package com.urswolfer.intellij.plugin.gerrit.ui.diff; -import com.google.common.base.Throwables; import com.google.gerrit.extensions.client.Comment; import com.intellij.util.text.CharSequenceReader; @@ -58,7 +57,7 @@ public static Comment.Range textOffsetToRange(CharSequence charsSequence, int st } } } catch (IOException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } finally { charSequenceReader.close(); } @@ -93,7 +92,7 @@ public static Offset rangeToTextOffset(CharSequence charsSequence, Comment.Range textLineCount++; } } catch (IOException e) { - throw Throwables.propagate(e); + throw new RuntimeException(e); } finally { charSequenceReader.close(); } From 7b4e70d2c7375e5a4eb3ede2a9d39bcd5a26ce23 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Sun, 19 Jan 2020 21:03:34 +0100 Subject: [PATCH 7/8] update org.jetbrains.intellij to v0.4.15 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 29746970..323749af 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ */ plugins { - id 'org.jetbrains.intellij' version '0.4.10' + id 'org.jetbrains.intellij' version '0.4.15' } apply plugin: 'java' From 2fbcdca6256988839a2331fa12538c1047598899 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Tue, 28 Jan 2020 20:18:30 +0100 Subject: [PATCH 8/8] bump version to v1.2.1-140 --- gradle.properties | 2 +- src/main/resources/META-INF/plugin.xml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4c0e9d83..2b234fe3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ ideaVersion=IC-14.0.4 ijPluginRepoChannel= downloadIdeaSources=false -version=1.2.0-140 +version=1.2.1-140 javaVersion=1.6 diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index ed022fc1..c5dfa91b 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -89,6 +89,11 @@ href="https://github.com/uwolfer/gerrit-intellij-plugin#pre-releases"> https://github.com/uwolfer/gerrit-intellij-plugin#pre-releases. +
  • 1.2.1
  • +
      +
    • fix compatibility with new IntelliJ APIs
    • +
    • minor fixes and improvements
    • +
  • 1.2.0
    • add review filter for assignee
    Change-Id:").append(changeInfo.changeId).append("