File tree Expand file tree Collapse file tree 2 files changed +73
-1
lines changed
Expand file tree Collapse file tree 2 files changed +73
-1
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,17 @@ public long getTimestamp() {
196196 */
197197 @ Exported
198198 public abstract String getMsg ();
199-
199+
200+ /**
201+ * Returns the comment for this change entry.
202+ * By default, returns the same value as {@link #getMsg()}.
203+ *
204+ * @since 2.552
205+ */
206+ @ Exported
207+ public String getComment () {
208+ return getMsg ();
209+ }
200210 /**
201211 * The user who made this change.
202212 *
Original file line number Diff line number Diff line change 1+ package hudson .scm ;
2+
3+ import static org .junit .jupiter .api .Assertions .assertEquals ;
4+
5+ import hudson .model .User ;
6+ import java .util .Collection ;
7+ import java .util .Collections ;
8+ import org .junit .jupiter .api .Test ;
9+
10+ public class ChangeLogSetEntryTest {
11+
12+ @ Test
13+ public void getCommentDefaultsToMsg () {
14+ ChangeLogSet .Entry entry = new ChangeLogSet .Entry () {
15+
16+ @ Override
17+ public String getMsg () {
18+ return "short message" ;
19+ }
20+
21+ @ Override
22+ public User getAuthor () {
23+ return null ;
24+ }
25+
26+ @ Override
27+ public Collection <String > getAffectedPaths () {
28+ return Collections .emptyList ();
29+ }
30+ };
31+
32+ assertEquals ("short message" , entry .getComment ());
33+ }
34+
35+ @ Test
36+ public void getCommentCanBeOverridden () {
37+ ChangeLogSet .Entry entry = new ChangeLogSet .Entry () {
38+
39+ @ Override
40+ public String getMsg () {
41+ return "short" ;
42+ }
43+
44+ @ Override
45+ public String getComment () {
46+ return "full commit message" ;
47+ }
48+
49+ @ Override
50+ public User getAuthor () {
51+ return null ;
52+ }
53+
54+ @ Override
55+ public Collection <String > getAffectedPaths () {
56+ return Collections .emptyList ();
57+ }
58+ };
59+
60+ assertEquals ("full commit message" , entry .getComment ());
61+ }
62+ }
You can’t perform that action at this time.
0 commit comments