Skip to content

Commit 98ed4c3

Browse files
committed
Merge remote-tracking branch 'origin/intellij14.1' into intellij15
# Conflicts: # gradle.properties
2 parents 3073137 + 6d52293 commit 98ed4c3

24 files changed

Lines changed: 282 additions & 78 deletions

README.md

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ gerrit-intellij-plugin
66
Introduction
77
-----------
88

9-
Unofficial [IntelliJ Platform] plugin for the [Gerrit Code Review] tool. It supports any product based on the IntelliJ platform:
9+
Unofficial [IntelliJ Platform](http://www.jetbrains.com/idea/) plugin for the
10+
[Gerrit Code Review](https://www.gerritcodereview.com/) tool. It supports any product based on the IntelliJ platform:
1011
* IntelliJ IDEA
1112
* IntelliJ IDEA CE
1213
* RubyMine
@@ -16,18 +17,15 @@ Unofficial [IntelliJ Platform] plugin for the [Gerrit Code Review] tool. It supp
1617
* PyCharm CE
1718
* AppCode
1819
* Android Studio
19-
* 0xDBE
20+
* DataGrip
2021
* CLion
22+
* Gogland
2123
* Rider
2224

2325
Only Gerrit 2.6 or newer is supported (missing / incomplete REST API in older versions).
2426

25-
[IntelliJ Platform]: http://www.jetbrains.com/idea/
26-
[Gerrit Code Review]: https://www.gerritcodereview.com/
27-
28-
You can install this plugin from the [IntelliJ Plugin Manager].
27+
You can install this plugin from the [IntelliJ Plugin Manager](http://plugins.jetbrains.com/plugin/7272).
2928
If you install this plugin directly in your IDE's plugin manager, you will get notified when a new release is available.
30-
[IntelliJ Plugin Manager]: http://plugins.jetbrains.com/plugin/7272
3129

3230
###### Pre-Releases
3331
If you want to get new releases earlier, you can subscribe to the release-candidate plugin channel:
@@ -41,12 +39,10 @@ Your Support
4139
------------
4240
If you like this plugin, you can support it:
4341
* Spread it: Tell your friends who are using IntelliJ and Gerrit about this plugin (or even encourage them to use these fantastic products!)
44-
* Vote for it: Write your review and vote for it at the [IntelliJ plugin repository].
45-
* Star it: [Star it at GitHub]. GitHub account required.
42+
* Vote for it: Write your review and vote for it at the [IntelliJ plugin repository](http://plugins.jetbrains.com/plugin/7272).
43+
* Star it: [Star it at GitHub](https://github.com/uwolfer/gerrit-intellij-plugin). GitHub account required.
4644
* Improve it: Report bugs or feature requests. Or even fix / implement them by yourself - everything is open source!
4745
* Donate: You can find donation-possibilities at the bottom of this file.
48-
[IntelliJ plugin repository]: http://plugins.jetbrains.com/plugin/7272
49-
[Star it at GitHub]: https://github.com/uwolfer/gerrit-intellij-plugin
5046

5147
Troubleshooting
5248
---------------
@@ -78,32 +74,27 @@ error or checking out does not properly finish, you can try to:
7874
* use SSH clone URL in checkout dialog (you can find the SSH URL in the Gerrit Web UI project settings)
7975
* or: check out with the default Git plugin and set up the Gerrit plugin manually afterwards
8076

81-
You can find background information about this issue in a [Gerrit mailing list topic].
82-
[Gerrit mailing list topic]: https://groups.google.com/forum/#!topic/repo-discuss/UnQd3HsL820
77+
You can find background information about this issue in a [Gerrit mailing list topic](https://groups.google.com/forum/#!topic/repo-discuss/UnQd3HsL820).
8378

8479
### Loading file-diff-list is slow
8580
Diff viewing is based on Git operations (i.e. it fetches the commit from the Gerrit remote). When loading the file list
86-
takes a lot of time, you can run a local "[git gc]" and ask your Gerrit administrator to do run a "[gerrit gc]".
87-
[git gc]: https://www.kernel.org/pub/software/scm/git/docs/git-gc.html
88-
[gerrit gc]: https://gerrit-review.googlesource.com/Documentation/cmd-gc.html
81+
takes a lot of time, you can run a local "[git gc](https://www.kernel.org/pub/software/scm/git/docs/git-gc.html)"
82+
and ask your Gerrit administrator to do run a "[gerrit gc](https://gerrit-review.googlesource.com/Documentation/cmd-gc.html)".
8983

9084
Architecture
9185
------------
9286
### IntelliJ Integration
93-
The plugin is integrated into the IntelliJ IDE with a [tool window].
94-
[tool window]: http://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Tool+Windows
87+
The plugin is integrated into the IntelliJ IDE with a [tool window](http://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Tool+Windows).
9588
See package <code>com.urswolfer.intellij.plugin.gerrit.ui</code>.
9689

9790
### REST API
98-
Most of the communication between the plugin and a Gerrit instance is based on the [Gerrit REST API].
99-
The REST specific part is available as [standalone implementation].
100-
[Gerrit REST API]: https://gerrit-review.googlesource.com/Documentation/rest-api.html
101-
[standalone implementation]: https://github.com/uwolfer/gerrit-rest-java-client
91+
Most of the communication between the plugin and a Gerrit instance is based on the [Gerrit REST API](https://gerrit-review.googlesource.com/Documentation/rest-api.html).
92+
The REST specific part is available as [standalone implementation](https://github.com/uwolfer/gerrit-rest-java-client).
10293
See package <code>com.urswolfer.intellij.plugin.gerrit.rest</code>.
10394

10495
### Git
105-
Some actions like comparing and listing files are based on Git operations. [IntelliJ Git4Idea] is used for these operations.
106-
[IntelliJ Git4Idea]:http://git.jetbrains.org/?p=idea/community.git;a=tree;f=plugins/git4idea
96+
Some actions like comparing and listing files are based on Git operations.
97+
[IntelliJ Git4Idea](http://git.jetbrains.org/?p=idea/community.git;a=tree;f=plugins/git4idea) is used for these operations.
10798
See package <code>com.urswolfer.intellij.plugin.gerrit.git</code>.
10899

109100

@@ -115,7 +106,7 @@ It's very easy to set it up as an IntelliJ project.
115106
1. Activate plugins ```Gradle```, ```Plugin DevKit``` and ```UI Designer``` in IntelliJ.
116107
2. ```git clone https://github.com/uwolfer/gerrit-intellij-plugin``` (probably switch to ```intellij{version}``` branch, but keep in mind that pull-requests should be against the default branch ("intellij13" and older are not supported anymore))
117108
3. Open checked out project in IntelliJ ("File" -> "New" -> "Project from Existing Sources" -> select file ```build.gradle``` in ```gerrit-intellij-plugin``` folder and press "OK")
118-
4. Create a new run configuration: "Gradle" -> "Gradle project": select the only project -> "Tasks": "runIdea"
109+
4. Create a new run configuration: "Gradle" -> "Gradle project": select the only project -> "Tasks": "runIde"
119110
5. Press "Debug" button. IntelliJ should start with a clean workspace (development sandbox). You need to checkout a
120111
project to see changes (it shows only changes for Git repositories that are set up in current workspace by default).
121112

@@ -129,10 +120,10 @@ Credits
129120

130121
Donations
131122
--------
132-
If you like this work, you can support it with [this donation link]. If you don't like Paypal
133-
(Paypal takes 2.9% plus $0.30 per transaction fee from your donation), please contact me.
123+
If you like this work, you can support it with
124+
[this donation link](https://www.paypal.com/webscr?cmd=_s-xclick&hosted_button_id=8F2GZVBCVEDUQ).
125+
If you don't like Paypal (Paypal takes 2.9% plus $0.30 per transaction fee from your donation), please contact me.
134126
Please only use the link from github.com/uwolfer/gerrit-intellij-plugin to verify that it is correct.
135-
[this donation link]: https://www.paypal.com/webscr?cmd=_s-xclick&hosted_button_id=8F2GZVBCVEDUQ
136127

137128

138129
Copyright and license

build.gradle

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
plugins {
18-
id 'org.jetbrains.intellij' version '0.1.10'
18+
id 'org.jetbrains.intellij' version '0.2.9'
1919
}
2020

2121
apply plugin: 'java'
@@ -41,22 +41,22 @@ repositories {
4141
}
4242

4343
dependencies {
44-
compile ('com.google.inject:guice:4.0') {
44+
compile ('com.google.inject:guice:4.1') {
4545
exclude group: 'com.google.guava', module: 'guava'
4646
}
47-
compile ('com.google.inject.extensions:guice-multibindings:4.0') {
47+
compile ('com.google.inject.extensions:guice-multibindings:4.1.0') {
4848
exclude group: 'com.google.guava', module: 'guava'
4949
}
50-
compile ('com.urswolfer.gerrit.client.rest:gerrit-rest-java-client:0.8.8') {
50+
compile ('com.urswolfer.gerrit.client.rest:gerrit-rest-java-client:0.8.12') {
5151
exclude group: 'com.google.code.gson', module: 'gson'
5252
exclude group: 'com.google.guava', module: 'guava'
5353
exclude group: 'commons-logging', module: 'commons-logging'
5454
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
5555
}
56-
compile 'org.javassist:javassist:3.19.0-GA'
56+
compile 'org.javassist:javassist:3.21.0-GA'
5757

58-
testCompile 'org.testng:testng:6.8.7'
59-
testCompile 'org.easymock:easymock:3.2'
58+
testCompile 'org.testng:testng:6.8.21'
59+
testCompile 'org.easymock:easymock:3.4'
6060
}
6161

6262
intellij {
@@ -66,8 +66,8 @@ intellij {
6666
downloadSources Boolean.valueOf(downloadIdeaSources)
6767
plugins 'git4idea'
6868

69-
publish {
70-
channel ijPluginRepoChannel
69+
publishPlugin {
70+
channels ijPluginRepoChannel
7171
username System.getenv('IJ_REPO_USERNAME')
7272
password System.getenv('IJ_REPO_PASSWORD')
7373
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ideaVersion=IC-15.0.5
22
ijPluginRepoChannel=
33
downloadIdeaSources=false
4-
version=0.9.9.1-142
4+
version=1.0.0.1-142
55
javaVersion=1.6

src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@
2727
import com.intellij.openapi.diagnostic.Logger;
2828
import com.intellij.openapi.util.text.StringUtil;
2929
import com.urswolfer.gerrit.client.rest.GerritAuthData;
30+
import com.urswolfer.intellij.plugin.gerrit.ui.ShowProjectColumn;
3031
import org.jdom.Element;
3132
import org.jetbrains.annotations.NotNull;
3233
import org.jetbrains.annotations.Nullable;
3334

34-
import java.util.ArrayList;
35-
import java.util.Collection;
36-
3735
/**
3836
* Parts based on org.jetbrains.plugins.github.GithubSettings
3937
*
@@ -59,6 +57,8 @@ public class GerritSettings implements PersistentStateComponent<Element>, Gerrit
5957
private static final String PUSH_TO_GERRIT = "PushToGerrit";
6058
private static final String SHOW_CHANGE_NUMBER_COLUMN = "ShowChangeNumberColumn";
6159
private static final String SHOW_CHANGE_ID_COLUMN = "ShowChangeIdColumn";
60+
private static final String SHOW_TOPIC_COLUMN = "ShowTopicColumn";
61+
private static final String SHOW_PROJECT_COLUMN = "ShowProjectColumn";
6262
private static final String GERRIT_SETTINGS_PASSWORD_KEY = "GERRIT_SETTINGS_PASSWORD_KEY";
6363

6464
private String login;
@@ -70,6 +70,8 @@ public class GerritSettings implements PersistentStateComponent<Element>, Gerrit
7070
private boolean pushToGerrit;
7171
private boolean showChangeNumberColumn;
7272
private boolean showChangeIdColumn;
73+
private boolean showTopicColumn;
74+
private ShowProjectColumn showProjectColumn = ShowProjectColumn.AUTO;
7375

7476
private Logger log;
7577

@@ -84,6 +86,8 @@ public Element getState() {
8486
element.setAttribute(PUSH_TO_GERRIT, Boolean.toString(getPushToGerrit()));
8587
element.setAttribute(SHOW_CHANGE_NUMBER_COLUMN, Boolean.toString(getShowChangeNumberColumn()));
8688
element.setAttribute(SHOW_CHANGE_ID_COLUMN, Boolean.toString(getShowChangeIdColumn()));
89+
element.setAttribute(SHOW_TOPIC_COLUMN, Boolean.toString(getShowTopicColumn()));
90+
element.setAttribute(SHOW_PROJECT_COLUMN, getShowProjectColumn().name());
8791
return element;
8892
}
8993

@@ -100,6 +104,8 @@ public void loadState(@NotNull final Element element) {
100104
setPushToGerrit(getBooleanValue(element, PUSH_TO_GERRIT));
101105
setShowChangeNumberColumn(getBooleanValue(element, SHOW_CHANGE_NUMBER_COLUMN));
102106
setShowChangeIdColumn(getBooleanValue(element, SHOW_CHANGE_ID_COLUMN));
107+
setShowTopicColumn(getBooleanValue(element, SHOW_TOPIC_COLUMN));
108+
setShowProjectColumn(getShowProjectColumnValue(element, SHOW_PROJECT_COLUMN));
103109
} catch (Exception e) {
104110
log.error("Error happened while loading gerrit settings: " + e);
105111
}
@@ -123,6 +129,15 @@ private int getIntegerValue(Element element, String attributeName) {
123129
}
124130
}
125131

132+
private ShowProjectColumn getShowProjectColumnValue(Element element, String attributeName) {
133+
String attributeValue = element.getAttributeValue(attributeName);
134+
if (attributeValue != null) {
135+
return ShowProjectColumn.valueOf(attributeValue);
136+
} else {
137+
return ShowProjectColumn.AUTO;
138+
}
139+
}
140+
126141
@Override
127142
@Nullable
128143
public String getLogin() {
@@ -142,6 +157,11 @@ public String getPassword() {
142157
return StringUtil.notNullize(password);
143158
}
144159

160+
@Override
161+
public boolean isHttpPassword() {
162+
return false;
163+
}
164+
145165
@Override
146166
public String getHost() {
147167
return host;
@@ -232,6 +252,22 @@ public void setShowChangeIdColumn(boolean showChangeIdColumn) {
232252
this.showChangeIdColumn = showChangeIdColumn;
233253
}
234254

255+
public boolean getShowTopicColumn() {
256+
return showTopicColumn;
257+
}
258+
259+
public ShowProjectColumn getShowProjectColumn() {
260+
return showProjectColumn;
261+
}
262+
263+
public void setShowProjectColumn(ShowProjectColumn showProjectColumn) {
264+
this.showProjectColumn = showProjectColumn;
265+
}
266+
267+
public void setShowTopicColumn(boolean showTopicColumn) {
268+
this.showTopicColumn = showTopicColumn;
269+
}
270+
235271
public void setLog(Logger log) {
236272
this.log = log;
237273
}

src/main/java/com/urswolfer/intellij/plugin/gerrit/SelectedRevisions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public String get(ChangeInfo changeInfo) {
5454
currentRevision = Iterables.getLast(revisionKeys);
5555
}
5656
}
57-
return get(changeInfo.id).or(currentRevision);
57+
return get(changeInfo.id).or(Optional.fromNullable(currentRevision)).orNull();
5858
}
5959

6060
public void put(String changeId, String revisionHash) {

src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ public Optional<GitRepository> getRepositoryForGerritProject(Project project, St
109109
}
110110
}
111111
}
112-
NotificationBuilder notification = new NotificationBuilder(project, "Error",
113-
String.format("No repository found for Gerrit project: '%s'.", gerritProjectName));
114-
notificationService.notifyError(notification);
115112
return Optional.absent();
116113
}
117114

@@ -163,7 +160,12 @@ public void cherryPickChange(final Project project, final ChangeInfo changeInfo,
163160
public void run(@NotNull ProgressIndicator indicator) {
164161
try {
165162
Optional<GitRepository> gitRepositoryOptional = getRepositoryForGerritProject(project, changeInfo.project);
166-
if (!gitRepositoryOptional.isPresent()) return;
163+
if (!gitRepositoryOptional.isPresent()) {
164+
NotificationBuilder notification = new NotificationBuilder(project, "Error",
165+
String.format("No repository found for Gerrit project: '%s'.", changeInfo.project));
166+
notificationService.notifyError(notification);
167+
return;
168+
}
167169
GitRepository gitRepository = gitRepositoryOptional.get();
168170

169171
final VirtualFile virtualFile = gitRepository.getGitDir();

0 commit comments

Comments
 (0)