@Override public boolean equals(Object obj) { // we say that two commit objects are equal iff they have the same ID // this prevents us from having to do clever workarounds for // https://gitlab.com/gitlab-org/gitlab-ce/issues/759 try { GitlabCommit commitObj = (GitlabCommit) obj; return (this.getId().compareTo(commitObj.getId()) == 0); } catch (ClassCastException e) { return false; } }
@Override public GitCommit commit(String refName) throws GitException { checkProject(); try { List<GitlabCommit> lastCommits = connect.getLastCommits(project.getId(), refName); GitlabCommit gitlabCommit = lastCommits.get(0); String commitId = gitlabCommit.getId(); String commitMessage = gitlabCommit.getMessage(); String commitAuthorEmail = gitlabCommit.getAuthorEmail(); return new GitCommit(commitId, commitMessage, commitAuthorEmail); } catch (IOException e) { throw new GitException(e.getMessage()); } }
public int compare(GitlabCommit o1, GitlabCommit o2) { return o2.getCreatedAt().compareTo(o1.getCreatedAt()); } });
@Before public void before() throws Exception { new MockUp<GitlabBuildTrigger.GitlabBuildTriggerDescriptor>() { @Mock String getBotUsername() { return "test-bot-username"; } }; new NonStrictExpectations() {{ api.getCommits(mergeRequest); result = Arrays.asList(commit); trigger.getAssigneeFilter(); result = ""; trigger.getTriggerComment(); result = "test-trigger-comment"; }}; botUser.setUsername("test-bot-username"); commit.setId("test-commit-id"); jenkinsNote.setAuthor(botUser); jenkinsNote.setBody("test-jenkins-note"); jenkinsNote.setCreatedAt(dateFormat.parse("2015-01-01")); triggerNote.setBody("test-trigger-comment"); triggerNote.setCreatedAt(dateFormat.parse("2015-01-02")); }
@Override public long lastModified() { try { return api().getCommit(projectId, hash).getCreatedAt().getTime(); } catch (GitLabAPIException e) { LOGGER.log(SEVERE, "could not get last modification time for project " + projectId + ", branch " + name + " (" + hash + ")", e); return 0L; } }
@Override public boolean equals(Object obj) { // we say that two commit objects are equal iff they have the same ID // this prevents us from having to do clever workarounds for // https://gitlab.com/gitlab-org/gitlab-ce/issues/759 try { GitlabCommit commitObj = (GitlabCommit) obj; return (this.getId().compareTo(commitObj.getId()) == 0); } catch (ClassCastException e) { return false; } }
@Override public boolean equals(Object obj) { // we say that two commit objects are equal iff they have the same ID // this prevents us from having to do clever workarounds for // https://gitlab.com/gitlab-org/gitlab-ce/issues/759 try { GitlabCommit commitObj = (GitlabCommit) obj; return (this.getId().compareTo(commitObj.getId()) == 0); } catch (ClassCastException e) { return false; } }
@Override public int hashCode() { return this.getId().hashCode(); }
@Override public int hashCode() { return this.getId().hashCode(); }
@Override public int hashCode() { return this.getId().hashCode(); }
private void setAReachableLatestCommit() { ((GitlabMergeRequestStatus) getField(subject, "mergeRequestStatus")).setLatestCommitOfMergeRequest( mergeRequest.getId().toString(), commit.getId()); } }
build(customParameters, latestCommit.getId(), gitlabMergeRequest); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to fetch commits for Merge Request " + gitlabMergeRequest.getIid());