Merge branch 'stable-2.15'
* stable-2.15: SSH commands: Set task name for ReviewCommand [SSH] Extract task name creation to method in BaseCommand Change-Id: Iff9772332fd588114f97ba9a213197cb64e0e4dc
This commit is contained in:
@@ -370,6 +370,22 @@ public abstract class BaseCommand implements Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getTaskDescription() {
|
||||||
|
StringBuilder m = new StringBuilder();
|
||||||
|
m.append(context.getCommandLine());
|
||||||
|
return m.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getTaskName() {
|
||||||
|
StringBuilder m = new StringBuilder();
|
||||||
|
m.append(getTaskDescription());
|
||||||
|
if (user.isIdentifiedUser()) {
|
||||||
|
IdentifiedUser u = user.asIdentifiedUser();
|
||||||
|
m.append(" (").append(u.getAccount().getUserName()).append(")");
|
||||||
|
}
|
||||||
|
return m.toString();
|
||||||
|
}
|
||||||
|
|
||||||
private final class TaskThunk implements CancelableRunnable, ProjectRunnable {
|
private final class TaskThunk implements CancelableRunnable, ProjectRunnable {
|
||||||
private final CommandRunnable thunk;
|
private final CommandRunnable thunk;
|
||||||
private final String taskName;
|
private final String taskName;
|
||||||
@@ -377,14 +393,7 @@ public abstract class BaseCommand implements Command {
|
|||||||
|
|
||||||
private TaskThunk(CommandRunnable thunk) {
|
private TaskThunk(CommandRunnable thunk) {
|
||||||
this.thunk = thunk;
|
this.thunk = thunk;
|
||||||
|
this.taskName = getTaskName();
|
||||||
StringBuilder m = new StringBuilder();
|
|
||||||
m.append(context.getCommandLine());
|
|
||||||
if (user.isIdentifiedUser()) {
|
|
||||||
IdentifiedUser u = user.asIdentifiedUser();
|
|
||||||
m.append(" (").append(u.getAccount().getUserName()).append(")");
|
|
||||||
}
|
|
||||||
this.taskName = m.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -240,6 +240,11 @@ public class ReviewCommand extends SshCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTaskDescription() {
|
||||||
|
return "gerrit review";
|
||||||
|
}
|
||||||
|
|
||||||
private void applyReview(PatchSet patchSet, ReviewInput review) throws RestApiException {
|
private void applyReview(PatchSet patchSet, ReviewInput review) throws RestApiException {
|
||||||
gApi.changes()
|
gApi.changes()
|
||||||
.id(patchSet.getId().getParentKey().get())
|
.id(patchSet.getId().getParentKey().get())
|
||||||
|
Reference in New Issue
Block a user