Skip to content

Commit 9dd8712

Browse files
JENKINS-49202: Add getComment() to ChangeLogSet.Entry
1 parent 396f78b commit 9dd8712

File tree

1 file changed

+28
-52
lines changed

1 file changed

+28
-52
lines changed

core/src/main/java/hudson/scm/ChangeLogSet.java

Lines changed: 28 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
* For the change list at project level, see {@link SCM}.
4848
*
4949
* <p>
50-
* {@link Iterator} is expected to return newer changes first then older changes later.
50+
* {@link Iterator} is expected to return newer changes first then older changes
51+
* later.
5152
*
5253
* @author Kohsuke Kawaguchi
5354
*/
@@ -116,6 +117,7 @@ public final Object[] getItems() {
116117

117118
/**
118119
* Optional identification of the kind of SCM being used.
120+
*
119121
* @return a short token, such as the SCM's main CLI executable name
120122
* @since 1.284
121123
*/
@@ -126,6 +128,7 @@ public String getKind() {
126128

127129
/**
128130
* Constant instance that represents no changes.
131+
*
129132
* @since 1.568
130133
*/
131134
public static ChangeLogSet<? extends ChangeLogSet.Entry> createEmpty(Run build) {
@@ -153,16 +156,8 @@ protected void setParent(ChangeLogSet parent) {
153156
}
154157

155158
/**
156-
* Returns a human readable display name of the commit number, revision number, and such thing
157-
* that identifies this entry.
158-
*
159-
* <p>
160-
* This method is primarily intended for visualization of the data.
161-
*
162-
* @return
163-
* null if such a concept doesn't make sense for the implementation. For example,
164-
* in CVS there's no single identifier for commits. Each file gets a different revision number.
165-
* @since 1.405
159+
* Returns a human readable display name of the commit number, revision number,
160+
* etc.
166161
*/
167162
@Exported
168163
public String getCommitId() {
@@ -171,74 +166,54 @@ public String getCommitId() {
171166

172167
/**
173168
* Returns the timestamp of this commit in the {@link Date#getTime()} format.
174-
*
175-
* <p>
176-
* This method is primarily intended for visualization of the data.
177-
*
178-
* @return
179-
* -1 if the implementation doesn't support it (for example, in CVS a commit
180-
* spreads over time between multiple changes on multiple files, so there's no single timestamp.)
181-
* @since 1.405
182169
*/
183170
@Exported
184171
public long getTimestamp() {
185172
return -1;
186173
}
187174

188175
/**
189-
* Gets the "commit message".
176+
* Gets the first line commit message (short message).
177+
*/
178+
@Exported
179+
public abstract String getMsg();
180+
181+
/**
182+
* Returns the full commit message.
190183
*
191-
* <p>
192-
* The exact definition depends on the individual SCM implementation.
184+
* Default implementation returns the same value as getMsg().
185+
* SCM implementations can override this if they support full message
186+
* separately.
193187
*
194-
* @return
195-
* Can be empty but never null.
188+
* @since TODO
196189
*/
197190
@Exported
198-
public abstract String getMsg();
191+
public String getComment() {
192+
return getMsg();
193+
}
199194

200195
/**
201196
* The user who made this change.
202-
*
203-
* @return
204-
* never null.
205197
*/
206198
@Exported
207199
public abstract User getAuthor();
208200

209201
/**
210-
* Returns a set of paths in the workspace that was
211-
* affected by this change.
212-
*
213-
* <p>
214-
* Contains string like 'foo/bar/zot'. No leading/trailing '/',
215-
* and separator must be normalized to '/'.
216-
*
217-
* @return never null.
202+
* Returns affected paths.
218203
*/
219204
@Exported
220205
public abstract Collection<String> getAffectedPaths();
221206

222207
/**
223-
* Returns a set of paths in the workspace that was
224-
* affected by this change.
225-
* <p>
226-
* Noted: since this is a new interface, some of the SCMs may not have
227-
* implemented this interface. The default implementation for this
228-
* interface is throw UnsupportedOperationException
229-
* <p>
230-
* It doesn't throw NoSuchMethodException because I rather to throw a
231-
* runtime exception
232-
*
233-
* @return AffectedFile never null.
234-
* @since 1.309
208+
* Returns affected files.
235209
*/
236210
public Collection<? extends AffectedFile> getAffectedFiles() {
237211
String scm = "this SCM";
238212
ChangeLogSet parent = getParent();
239213
if (null != parent) {
240214
String kind = parent.getKind();
241-
if (null != kind && !kind.trim().isEmpty()) scm = kind;
215+
if (null != kind && !kind.trim().isEmpty())
216+
scm = kind;
242217
}
243218
throw new UnsupportedOperationException("getAffectedFiles() is not implemented by " + scm);
244219
}
@@ -252,9 +227,11 @@ public String getMsgAnnotated() {
252227
try {
253228
a.annotate(parent.run, this, markup);
254229
} catch (RuntimeException e) {
255-
LOGGER.info("ChangeLogAnnotator " + a.toString() + " failed to annotate message '" + getMsg() + "'; " + e.getMessage());
230+
LOGGER.info("ChangeLogAnnotator " + a.toString() + " failed to annotate message '" + getMsg()
231+
+ "'; " + e.getMessage());
256232
} catch (Error e) {
257-
LOGGER.severe("ChangeLogAnnotator " + a + " failed to annotate message '" + getMsg() + "'; " + e.getMessage());
233+
LOGGER.severe("ChangeLogAnnotator " + a + " failed to annotate message '" + getMsg() + "'; "
234+
+ e.getMessage());
258235
}
259236

260237
return markup.toString(false);
@@ -289,7 +266,6 @@ public interface AffectedFile {
289266
*/
290267
String getPath();
291268

292-
293269
/**
294270
* Return whether the file is new/modified/deleted
295271
*/

0 commit comments

Comments
 (0)