package org.jenkinsci.plugins.p4.scm; import jenkins.scm.api.SCMRevision; import org.jenkinsci.plugins.p4.changes.P4Ref; import java.util.ArrayList; import java.util.List; import java.util.Objects; public class P4SCMRevision extends SCMRevision { private final P4Ref ref; public P4SCMRevision(P4SCMHead branch, P4Ref ref) { super(branch); this.ref = ref; } public static P4SCMRevision builder(String path, String branch, P4Ref ref) { P4Path p4path = new P4Path(path, ref.toString()); P4SCMHead head = new P4SCMHead(branch, p4path); return new P4SCMRevision(head, ref); } public static P4SCMRevision swarmBuilder(String path, String branch, P4Ref ref) { List<String> mappings = new ArrayList<>(); mappings.add(path + "/" + branch + "/..."); P4SwarmPath swarmPath = new P4SwarmPath(path, mappings, ref.toString()); P4SCMHead head = new P4SCMHead(branch, swarmPath); return new P4SCMRevision(head, ref); } public static P4SCMRevision swarmBuilder(String path, String branch, P4Ref ref, String reviewID) { List<String> mappings = new ArrayList<>(); mappings.add(path + "/" + branch + "/..."); P4SwarmPath swarmPath = new P4SwarmPath(path, mappings, ref.toString()); String trgName = branch + "-" + reviewID; P4SCMHead target = new P4SCMHead(trgName, swarmPath); P4ChangeRequestSCMHead head = new P4ChangeRequestSCMHead(trgName, reviewID, swarmPath, target); return new P4SCMRevision(head, ref); } public P4Ref getRef() { return ref; } /** * {@inheritDoc} */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } P4SCMRevision that = (P4SCMRevision) o; boolean c = ref.equals(that.ref); boolean h = getHead().equals(that.getHead()); return c && h; } /** * {@inheritDoc} */ @Override public int hashCode() { return Objects.hashCode(ref); } @Override public String toString() { if (ref == null) { return "undefined"; } return "P4SCMRevision: " + getHead() + " REF: " + ref.toString(); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#9 | 25844 | Paul Allen | Change Swarm Reviews so that they are only identified by review number in the multi branch (for better rendering in BlueOcean). | ||
#8 | 25006 | Paul Allen |
Support for remote Jenkinsfiles in a MultiBranch project. Jenkinsfile are idenitified by the Include branches path (e.g. //depot/Remote/...), but you must add a Mapping in the BranchSource->Advanced->View Mappings to locate the projects source and use a special ${BRANCH_NAME} in the path. e.g. //depot/ProjectA/${BRANCH_NAME}/... JENKINS-53936 |
||
#7 | 24671 | Paul Allen |
Added backwards support for old XML data. Class rename in 1.9.0 would prevent processing of old build data. JENKINS-53870 |
||
#6 | 24614 | Paul Allen | Remove debug data from toString - shown in Event and Poll log. | ||
#5 | 24571 | Paul Allen |
Support for Swarm pre-commit review events. Swarm pre-commit review event creates a new 'Reviews' Tag in the MultiBranch and builds with specified change and shelf. |
||
#4 | 24536 | Paul Allen |
Improved Swarm SCMRevision builder. Started to add Swarm Review Event support and exteded test case. JENKINS-52066 |
||
#3 | 24529 | Paul Allen |
Swarm Commit Event support, refactoring and test. JENKINS-52605 (Fix doc in 'Includes' help bubble for MultiBranch) JENKINS-52066 (Improve Swarm Commit and Branch Event support) |
||
#2 | 24504 | Paul Allen |
Tree walter for BranchSCMSource Events. On a change-submit event use the change number and grab a submitted file. Walk up the path looking for a Jenkinsfile, then derive 'Project' path, 'Branch' name and 'Path' for the SCMHead/Revision. This assumes that the Jenkinsfile is in the route of your projects. Alternatively use the Swarm Event and pass your own 'Project', 'Branch' and 'Path'. |
||
#1 | 24501 | Paul Allen | Refactor to use P4SCMXxx naming convention. | ||
//guest/perforce_software/p4jenkins/main/src/main/java/org/jenkinsci/plugins/p4/scm/P4Revision.java | |||||
#7 | 24497 | Paul Allen |
Force use of revision for Head. Update P4Head->P4Path revision with P4Revision to avoid builds on unbounded 'latest'. |
||
#6 | 24492 | Paul Allen |
Initial work for MultiBranch Event trigger. JENKINS-52066 (Triggered Events and not Polling per change) |
||
#5 | 22879 | Paul Allen | Fix equals used in comparable check and null check. | ||
#4 | 22863 | Paul Allen | Store change in P4Revision as P4Ref. | ||
#3 | 22396 | Paul Allen |
MultiBranch support for Perforce Swarm Reviews. A work in progress - adds Swarm API support to find branches and reviews from a Swarm project. #review-22354 |
||
#2 | 22128 | Paul Allen |
Helix Graph support for Jenkins. JENKINS-40354 |
||
#1 | 21758 | Paul Allen |
Merge pull request #38 from jenkinsci/dev scm-api 2.0.2 updates |