Include patch set number into message when setting description for patch set
When a description for a patch set is set/removed, a change message with the new/old description is added to the change. However it doesn't say for which patch set the description was set/removed, which makes the message not very useful, as you cannot distinguish between messages for different patch sets. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: Iaa43c1897a236592c756535346689971a478dc96
This commit is contained in:
@@ -87,17 +87,21 @@ public class PutDescription
|
|||||||
if (oldDescription.equals(newDescription)) {
|
if (oldDescription.equals(newDescription)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String summary;
|
|
||||||
if (oldDescription.isEmpty()) {
|
|
||||||
summary = "Description set to \"" + newDescription + "\"";
|
|
||||||
} else if (newDescription.isEmpty()) {
|
|
||||||
summary = "Description \"" + oldDescription + "\" removed";
|
|
||||||
} else {
|
|
||||||
summary = "Description changed to \"" + newDescription + "\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
update.setPsDescription(newDescription);
|
update.setPsDescription(newDescription);
|
||||||
|
|
||||||
|
String summary;
|
||||||
|
if (oldDescription.isEmpty()) {
|
||||||
|
summary =
|
||||||
|
String.format("Description of patch set %d set to \"%s\"", psId.get(), newDescription);
|
||||||
|
} else if (newDescription.isEmpty()) {
|
||||||
|
summary =
|
||||||
|
String.format(
|
||||||
|
"Description \"%s\" removed from patch set %d", oldDescription, psId.get());
|
||||||
|
} else {
|
||||||
|
summary =
|
||||||
|
String.format(
|
||||||
|
"Description of patch set %d changed to \"%s\"", psId.get(), newDescription);
|
||||||
|
}
|
||||||
ChangeMessage cmsg =
|
ChangeMessage cmsg =
|
||||||
ChangeMessagesUtil.newMessage(
|
ChangeMessagesUtil.newMessage(
|
||||||
psId, ctx.getUser(), ctx.getWhen(), summary, ChangeMessagesUtil.TAG_SET_DESCRIPTION);
|
psId, ctx.getUser(), ctx.getWhen(), summary, ChangeMessagesUtil.TAG_SET_DESCRIPTION);
|
||||||
|
|||||||
@@ -1325,19 +1325,19 @@ public class RevisionIT extends AbstractDaemonTest {
|
|||||||
gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).description("foo");
|
gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).description("foo");
|
||||||
assertDescription(r, "foo");
|
assertDescription(r, "foo");
|
||||||
assertThat(Iterables.getLast(gApi.changes().id(r.getChangeId()).get().messages).message)
|
assertThat(Iterables.getLast(gApi.changes().id(r.getChangeId()).get().messages).message)
|
||||||
.isEqualTo("Description set to \"foo\"");
|
.isEqualTo("Description of patch set 1 set to \"foo\"");
|
||||||
|
|
||||||
// update description
|
// update description
|
||||||
gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).description("bar");
|
gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).description("bar");
|
||||||
assertDescription(r, "bar");
|
assertDescription(r, "bar");
|
||||||
assertThat(Iterables.getLast(gApi.changes().id(r.getChangeId()).get().messages).message)
|
assertThat(Iterables.getLast(gApi.changes().id(r.getChangeId()).get().messages).message)
|
||||||
.isEqualTo("Description changed to \"bar\"");
|
.isEqualTo("Description of patch set 1 changed to \"bar\"");
|
||||||
|
|
||||||
// remove description
|
// remove description
|
||||||
gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).description("");
|
gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).description("");
|
||||||
assertDescription(r, "");
|
assertDescription(r, "");
|
||||||
assertThat(Iterables.getLast(gApi.changes().id(r.getChangeId()).get().messages).message)
|
assertThat(Iterables.getLast(gApi.changes().id(r.getChangeId()).get().messages).message)
|
||||||
.isEqualTo("Description \"bar\" removed");
|
.isEqualTo("Description \"bar\" removed from patch set 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user