Fix output of wrong status on push of non-draft patch set to draft change
When a non-draft patch set is pushed to a draft change, the change gets published. This means that the change status is changed from DRAFT to NEW. The commandline output of the push command was wrongly claiming that the change is still a draft. This was because it read the change status from the change notes that were loaded before the change update. E.g. the output showed: remote: Updated Changes: remote: http://ekempin0.muc.corp.google.com:8080/42 Foo [DRAFT] instead of remote: Updated Changes: remote: http://ekempin0.muc.corp.google.com:8080/42 Foo Fix this by checking the draft state on the newly created patch set instead of looking at the outdated status of the change. Change-Id: Icc5e76af4b7fdc4a76c4e7c4c143b66068b35f4f Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -682,8 +682,9 @@ public class ReceiveCommits {
|
||||
addMessage("");
|
||||
addMessage("New Changes:");
|
||||
for (CreateRequest c : created) {
|
||||
addMessage(formatChangeUrl(canonicalWebUrl, c.change,
|
||||
c.change.getSubject(), false));
|
||||
addMessage(
|
||||
formatChangeUrl(canonicalWebUrl, c.change, c.change.getSubject(),
|
||||
c.change.getStatus() == Change.Status.DRAFT, false));
|
||||
}
|
||||
addMessage("");
|
||||
}
|
||||
@@ -722,21 +723,22 @@ public class ReceiveCommits {
|
||||
subject = u.info.getSubject();
|
||||
}
|
||||
addMessage(formatChangeUrl(canonicalWebUrl, u.notes.getChange(),
|
||||
subject, edit));
|
||||
subject, u.replaceOp != null && u.replaceOp.getPatchSet().isDraft(),
|
||||
edit));
|
||||
}
|
||||
addMessage("");
|
||||
}
|
||||
}
|
||||
|
||||
private static String formatChangeUrl(String url, Change change,
|
||||
String subject, boolean edit) {
|
||||
String subject, boolean draft, boolean edit) {
|
||||
StringBuilder m = new StringBuilder()
|
||||
.append(" ")
|
||||
.append(url)
|
||||
.append(change.getChangeId())
|
||||
.append(" ")
|
||||
.append(ChangeUtil.cropSubject(subject));
|
||||
if (change.getStatus() == Change.Status.DRAFT) {
|
||||
if (draft) {
|
||||
m.append(" [DRAFT]");
|
||||
}
|
||||
if (edit) {
|
||||
|
||||
Reference in New Issue
Block a user