Include a quick summary of the size of a change in email
Including tabular formatted text in an email can be ugly, many user agents just use a proportional width font and assume that is sufficient. So instead of using a table to display the damage to each file, just display a summary at the bottom of the file listing. It will at least give a reviewer a notion of the length of time they might need to review the change. Bug: issue 452 Change-Id: I3bbf1da2058ed51e363cff045d3e196323bce333 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -35,6 +35,7 @@ import com.google.gerrit.server.query.change.ChangeData;
|
||||
import com.google.gerrit.server.query.change.ChangeQueryBuilder;
|
||||
import com.google.gwtorm.client.OrmException;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
@@ -277,12 +278,20 @@ public abstract class ChangeEmail extends OutgoingEmail {
|
||||
|
||||
if (patchSet != null) {
|
||||
appendText("---\n");
|
||||
for (PatchListEntry p : getPatchList().getPatches()) {
|
||||
PatchList patchList = getPatchList();
|
||||
for (PatchListEntry p : patchList.getPatches()) {
|
||||
if (Patch.COMMIT_MSG.equals(p.getNewName())) {
|
||||
continue;
|
||||
}
|
||||
appendText(p.getChangeType().getCode() + " " + p.getNewName() + "\n");
|
||||
}
|
||||
appendText(MessageFormat.format("" //
|
||||
+ "{0,choice,0#0 files|1#1 file|1<{0} files} changed, " //
|
||||
+ "{1,choice,0#0 insertions|1#1 insertion|1<{1} insertions}(+), " //
|
||||
+ "{2,choice,0#0 deletions|1#1 deletion|1<{2} deletions}(-)" //
|
||||
+ "\n", patchList.getPatches().size() - 1, //
|
||||
patchList.getInsertions(), //
|
||||
patchList.getDeletions()));
|
||||
appendText("\n");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user