Add REST endpoint to apply a suggested fix of a robot comment
To apply a suggested fix, we manually compute the Git tree which results from applying the described modifications to the patch set. That Git tree is transformed into a change edit if none exists or merged with an existing one. Similar to change edits, fixes may only be applied for the current patch set if no change edit exists. If one exists, fixes may only be applied for the patch set on which the change edit is based on. To fail as early as possible, we now reject suggested fixes which include overlapping replacements when they are provided as review input. Change-Id: Iabf0d0af025b0878e839956d16f29693b1e74eee
This commit is contained in:
@@ -18,6 +18,7 @@ import static com.google.common.truth.Truth.assertAbout;
|
||||
|
||||
import com.google.common.truth.FailureStrategy;
|
||||
import com.google.common.truth.PrimitiveByteArraySubject;
|
||||
import com.google.common.truth.StringSubject;
|
||||
import com.google.common.truth.Subject;
|
||||
import com.google.common.truth.SubjectFactory;
|
||||
import com.google.common.truth.Truth;
|
||||
@@ -51,6 +52,15 @@ public class BinaryResultSubject extends Subject<BinaryResultSubject, BinaryResu
|
||||
super(failureStrategy, binaryResult);
|
||||
}
|
||||
|
||||
public StringSubject asString() throws IOException {
|
||||
isNotNull();
|
||||
// We shouldn't close the BinaryResult within this method as it might still
|
||||
// be used afterwards. Besides, closing it doesn't have an effect for most
|
||||
// implementations of a BinaryResult.
|
||||
BinaryResult binaryResult = actual();
|
||||
return Truth.assertThat(binaryResult.asString());
|
||||
}
|
||||
|
||||
public PrimitiveByteArraySubject bytes() throws IOException {
|
||||
isNotNull();
|
||||
// We shouldn't close the BinaryResult within this method as it might still
|
||||
|
Reference in New Issue
Block a user