Rename revert message on original change

Michael Beardsworth:
> "This patchset was reverted in change: <changeId>" message is a bit
> confusing.  I'd rather have it read something more like
> "A change to revert this patchset was created: see <changeId>" so it's
> more clear that the revert hasn't been submitted.

After discussion we settle for "Created a revert of this change as %s",
because a) you can only revert the latest revision, so it's on a change
actually targeting the change rather than a particular revision and b)
it's shorter than what Michael proposed.

Change-Id: I91d3c1cb694da208f15eefbf17c139e2150a3044
Signed-off-by: Stefan Beller <sbeller@google.com>
This commit is contained in:
Stefan Beller
2016-02-22 10:33:01 -08:00
committed by David Pursehouse
parent 6c1fa171c0
commit 1616a6490e
2 changed files with 2 additions and 6 deletions

View File

@@ -190,8 +190,7 @@ public class ChangeIT extends AbstractDaemonTest {
gApi.changes().id(r.getChangeId()).get().messages); gApi.changes().id(r.getChangeId()).get().messages);
assertThat(sourceMessages).hasSize(4); assertThat(sourceMessages).hasSize(4);
String expectedMessage = String.format( String expectedMessage = String.format(
"Patch Set 1: Reverted\n\n" + "Created a revert of this change as %s",
"This patchset was reverted in change: %s",
revertChange.changeId); revertChange.changeId);
assertThat(sourceMessages.get(3).message).isEqualTo(expectedMessage); assertThat(sourceMessages.get(3).message).isEqualTo(expectedMessage);

View File

@@ -249,10 +249,7 @@ public class Revert implements RestModifyView<ChangeResource, RevertInput>,
ChangeUtil.messageUUID(db.get())), ChangeUtil.messageUUID(db.get())),
ctx.getUser().getAccountId(), ctx.getWhen(), patchSetId); ctx.getUser().getAccountId(), ctx.getWhen(), patchSetId);
StringBuilder msgBuf = new StringBuilder(); StringBuilder msgBuf = new StringBuilder();
msgBuf.append("Patch Set ").append(patchSetId.get()) msgBuf.append("Created a revert of this change as ")
.append(": Reverted");
msgBuf.append("\n\n");
msgBuf.append("This patchset was reverted in change: ")
.append("I").append(computedChangeId.name()); .append("I").append(computedChangeId.name());
changeMessage.setMessage(msgBuf.toString()); changeMessage.setMessage(msgBuf.toString());
cmUtil.addChangeMessage(ctx.getDb(), ctx.getUpdate(patchSetId), cmUtil.addChangeMessage(ctx.getDb(), ctx.getUpdate(patchSetId),