mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Clarify diff display of MutatingCommand
Tools inheriting from MutatingCommand print out the change they are going to make and then ask the user to confirm that this is indeed what they wanted to do. The change is outputted as a list of updated values in the form key -> [oldValue, newValue] e.g. dnsPaused -> [true, false] This CL will change the output to be clearer: key: oldValue -> newValue e.g. dnsPaused: true -> false ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=170853745
This commit is contained in:
parent
fd62f4a74e
commit
01591ff88e
8 changed files with 30 additions and 31 deletions
|
@ -15,7 +15,6 @@
|
|||
package google.registry.util;
|
||||
|
||||
import static com.google.common.base.Predicates.notNull;
|
||||
import static com.google.common.collect.Lists.newArrayList;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Joiner;
|
||||
|
@ -54,7 +53,7 @@ public final class DiffUtils {
|
|||
@Override
|
||||
public String toString() {
|
||||
// Note that we use newArrayList here instead of ImmutableList because a and b can be null.
|
||||
return newArrayList(a, b).toString();
|
||||
return String.format("%s -> %s", a, b);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,9 +140,9 @@ public final class DiffUtils {
|
|||
&& ((DiffPair) value).b instanceof Set) {
|
||||
DiffPair pair = ((DiffPair) value);
|
||||
String prettyLineDiff = prettyPrintSetDiff((Set<?>) pair.a, (Set<?>) pair.b) + "\n";
|
||||
output = newPath + ((prettyLineDiff.startsWith("\n")) ? " ->" : " -> ") + prettyLineDiff;
|
||||
output = newPath + ((prettyLineDiff.startsWith("\n")) ? ":" : ": ") + prettyLineDiff;
|
||||
} else {
|
||||
output = newPath + " -> " + value + "\n";
|
||||
output = newPath + ": " + value + "\n";
|
||||
}
|
||||
builder.append(output);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue