@@ -149,10 +149,30 @@ public List<Commit> getCommits(int projectId, String ref, String path) throws Gi
149
149
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
150
150
*/
151
151
public List <Commit > getCommits (int projectId , String ref , Date since , Date until , int page , int perPage ) throws GitLabApiException {
152
+ return getCommits (projectId , ref , since , until , null , page , perPage );
153
+ }
154
+
155
+ /**
156
+ * Get a list of repository commits in a project.
157
+ *
158
+ * GET /projects/:id/repository/commits
159
+ *
160
+ * @param projectId the project ID to get the list of commits for
161
+ * @param ref the name of a repository branch or tag or if not given the default branch
162
+ * @param since only commits after or on this date will be returned
163
+ * @param until only commits before or on this date will be returned
164
+ * @param path the path to file of a project
165
+ * @param page the page to get
166
+ * @param perPage the number of commits per page
167
+ * @return a list containing the commits for the specified project ID
168
+ * @throws GitLabApiException GitLabApiException if any exception occurs during execution
169
+ */
170
+ public List <Commit > getCommits (int projectId , String ref , Date since , Date until , String path , int page , int perPage ) throws GitLabApiException {
152
171
Form formData = new GitLabApiForm ()
153
172
.withParam ("ref_name" , ref )
154
173
.withParam ("since" , ISO8601 .toString (since , false ))
155
174
.withParam ("until" , ISO8601 .toString (until , false ))
175
+ .withParam ("path" , (path == null ? null : urlEncode (path )))
156
176
.withParam (PAGE_PARAM , page )
157
177
.withParam (PER_PAGE_PARAM , perPage );
158
178
Response response = get (Response .Status .OK , formData .asMap (), "projects" , projectId , "repository" , "commits" );
@@ -173,10 +193,29 @@ public List<Commit> getCommits(int projectId, String ref, Date since, Date until
173
193
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
174
194
*/
175
195
public Pager <Commit > getCommits (int projectId , String ref , Date since , Date until , int itemsPerPage ) throws GitLabApiException {
196
+ return getCommits (projectId , ref , since ,until , null , itemsPerPage );
197
+ }
198
+
199
+ /**
200
+ * Get a Pager of repository commits in a project
201
+ *
202
+ * GET /projects/:id/repository/commits
203
+ *
204
+ * @param projectId the project ID to get the list of commits for
205
+ * @param ref the name of a repository branch or tag or if not given the default branch
206
+ * @param since only commits after or on this date will be returned
207
+ * @param until only commits before or on this date will be returned
208
+ * @param itemsPerPage the number of Commit instances that will be fetched per page
209
+ * @param path the path to file of a project
210
+ * @return a Pager containing the commits for the specified project ID
211
+ * @throws GitLabApiException GitLabApiException if any exception occurs during execution
212
+ */
213
+ public Pager <Commit > getCommits (int projectId , String ref , Date since , Date until , String path , int itemsPerPage ) throws GitLabApiException {
176
214
Form formData = new GitLabApiForm ()
177
215
.withParam ("ref_name" , ref )
178
216
.withParam ("since" , ISO8601 .toString (since , false ))
179
- .withParam ("until" , ISO8601 .toString (until , false ));
217
+ .withParam ("until" , ISO8601 .toString (until , false ))
218
+ .withParam ("path" , (path == null ? null : urlEncode (path )));
180
219
return (new Pager <Commit >(this , Commit .class , itemsPerPage , formData .asMap (), "projects" , projectId , "repository" , "commits" ));
181
220
}
182
221
0 commit comments