2
2
3
3
import com .infradna .tool .bridge_method_injector .WithBridgeMethods ;
4
4
import edu .umd .cs .findbugs .annotations .SuppressFBWarnings ;
5
-
6
5
import java .io .IOException ;
7
6
import java .net .URL ;
8
7
import java .util .AbstractList ;
9
8
import java .util .ArrayList ;
10
9
import java .util .Collections ;
10
+ import java .util .Date ;
11
11
import java .util .List ;
12
12
13
13
/**
@@ -42,11 +42,19 @@ public GitUser getAuthor() {
42
42
return author ;
43
43
}
44
44
45
+ public Date getAuthoredDate () {
46
+ return GitHub .parseDate (author .date );
47
+ }
48
+
45
49
@ WithBridgeMethods (value = GHAuthor .class , castRequired = true )
46
50
public GitUser getCommitter () {
47
51
return committer ;
48
52
}
49
53
54
+ public Date getCommitDate () {
55
+ return GitHub .parseDate (author .date );
56
+ }
57
+
50
58
/**
51
59
* Commit message.
52
60
*/
@@ -63,6 +71,7 @@ public int getCommentCount() {
63
71
* @deprecated Use {@link GitUser} instead.
64
72
*/
65
73
public static class GHAuthor extends GitUser {
74
+ private String date ;
66
75
}
67
76
68
77
public static class Stats {
@@ -272,10 +281,29 @@ public GHUser getAuthor() throws IOException {
272
281
return resolveUser (author );
273
282
}
274
283
284
+ /**
285
+ * Gets the date the change was authored on.
286
+ * @return the date the change was authored on.
287
+ * @throws IOException if the information was not already fetched and an attempt at fetching the information failed.
288
+ */
289
+ public Date getAuthoredDate () throws IOException {
290
+ return getCommitShortInfo ().getAuthoredDate ();
291
+ }
292
+
275
293
public GHUser getCommitter () throws IOException {
276
294
return resolveUser (committer );
277
295
}
278
296
297
+ /**
298
+ * Gets the date the change was committed on.
299
+ *
300
+ * @return the date the change was committed on.
301
+ * @throws IOException if the information was not already fetched and an attempt at fetching the information failed.
302
+ */
303
+ public Date getCommitDate () throws IOException {
304
+ return getCommitShortInfo ().getCommitDate ();
305
+ }
306
+
279
307
private GHUser resolveUser (User author ) throws IOException {
280
308
if (author ==null || author .login ==null ) return null ;
281
309
return owner .root .getUser (author .login );
0 commit comments