package org.jenkinsci.plugins.p4.changes; import com.perforce.p4java.exception.P4JavaException; import com.perforce.p4java.graph.ICommit; import org.jenkinsci.plugins.p4.client.ClientHelper; import org.jenkinsci.plugins.p4.client.ConnectionHelper; public class P4GraphRef implements P4Ref { private static final long serialVersionUID = 1L; private final String repo; private final String sha; private final long date; private transient final ICommit commit; public P4GraphRef(ConnectionHelper p4, String id) throws P4JavaException { if (id != null && !id.isEmpty() && id.contains("@")) { String[] parts = id.split("@"); if (parts.length == 2) { this.repo = parts[0]; String sha = parts[1]; this.commit = p4.getGraphCommit(sha, repo); this.date = commit.getCommitterDate().getTime(); this.sha = sha; return; } } this.repo = null; this.commit = null; this.date = 0L; this.sha = null; } public P4GraphRef(String repo, ICommit commit) { this.repo = repo; this.commit = commit; this.date = commit.getCommitterDate().getTime(); this.sha = commit.getCommit(); } @Override public P4ChangeEntry getChangeEntry(ClientHelper p4) throws Exception { P4ChangeEntry cl = new P4ChangeEntry(); cl.setGraphCommit(p4, repo, sha); return cl; } @Override public boolean isLabel() { return false; } @Override public boolean isCommit() { return true; } @Override public int getChange() { return -1; } public long getDate() { return date; } public String getRepo() { return repo; } public String getSha() { return sha; } @Override public String toString() { return repo + "@" + sha; } @Override public boolean equals(Object obj) { if (obj instanceof P4GraphRef) { P4GraphRef ref = (P4GraphRef) obj; if (ref.toString().equals(toString())) { return true; } } return false; } @Override public int hashCode() { int hash = 3; hash = 89 * hash + (toString().hashCode()); return hash; } @Override public int compareTo(Object obj) { if (equals(obj)) { return 0; } if (obj instanceof P4GraphRef) { P4GraphRef ref = (P4GraphRef) obj; long diff = getDate() - ref.getDate(); return (int) diff; } throw new ClassCastException(); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 24500 | Paul Allen | Tidyup and refactor P4Ref classes. | ||
#3 | 22861 | Paul Allen | Use long for change number. | ||
#2 | 22815 | Paul Allen |
Provide repo with connection.getCommitObject(). The `p4 graph cat-file commit` requires `super` level access if the repo name is not provided. JENKINS-46595 |
||
#1 | 22128 | Paul Allen |
Helix Graph support for Jenkins. JENKINS-40354 |
||
//guest/paul_allen/p4jenkins/main/src/main/java/org/jenkinsci/plugins/p4/changes/P4GraphRef.java | |||||
#6 | 22058 | Paul Allen | Use committer date to calculate updated commits. | ||
#5 | 22014 | Paul Allen | Polling/Change reporting now iterates over all last build P4Refs to look for change/commit updates. | ||
#4 | 22013 | Paul Allen |
Add Graph Populate type. - Not able to use sync -p with graph - Don't store IClient; store SHA, repo and date |
||
#3 | 22004 | Paul Allen | Store P4Ref graph changes for polling. | ||
#2 | 21990 | Paul Allen |
Reporting Graph changes. Update Browser and Jelly code to use String and not URL for url in Data Binding to Jelly. Use P4AffectedFile object for XML storage and not IFileSpec to allow Graph use. |
||
#1 | 21978 | Paul Allen | Reporting Graph |