Merge branch 'stable-2.14' into 'stable-2.15'
* stable-2.14: SSH commands: Set task name for ReviewCommand [SSH] Extract task name creation to method in BaseCommand Change-Id: I5caa4289455715e8057ed5cfc343e6dcf46b4538 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -369,6 +369,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;
|
||||||
@@ -376,14 +392,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
|
||||||
|
@@ -247,6 +247,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