Exemplo n.º 1
0
  /** Create the change message and the affected file list. */
  public String getChangeDetail() {
    StringBuilder detail = new StringBuilder();

    if (patchSetInfo != null) {
      detail.append(patchSetInfo.getMessage().trim() + "\n");
    } else {
      detail.append(change.getSubject().trim() + "\n");
    }

    if (patchSet != null) {
      detail.append("---\n");
      PatchList patchList = getPatchList();
      for (PatchListEntry p : patchList.getPatches()) {
        if (Patch.COMMIT_MSG.equals(p.getNewName())) {
          continue;
        }
        detail.append(p.getChangeType().getCode() + " " + p.getNewName() + "\n");
      }
      detail.append(
          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()));
      detail.append("\n");
    }
    return detail.toString();
  }
Exemplo n.º 2
0
 private static void assertName(String expectedNewName, PatchListEntry e) {
   assertThat(e.getNewName()).isEqualTo(expectedNewName);
   assertThat(e.getOldName()).isNull();
 }
Exemplo n.º 3
0
 private static void assertDeleted(String expectedNewName, PatchListEntry e) {
   assertName(expectedNewName, e);
   assertThat(e.getChangeType()).isEqualTo(ChangeType.DELETED);
 }
Exemplo n.º 4
0
 private static void assertModified(String expectedNewName, PatchListEntry e) {
   assertName(expectedNewName, e);
   assertThat(e.getChangeType()).isEqualTo(ChangeType.MODIFIED);
 }