package org.jenkinsci.plugins.p4.scm; import edu.umd.cs.findbugs.annotations.NonNull; import jenkins.scm.api.SCMFile; import jenkins.scm.api.SCMProbe; import jenkins.scm.api.SCMProbeStat; import org.jenkinsci.plugins.p4.client.ConnectionHelper; import java.io.IOException; import java.util.logging.Logger; public class P4Probe extends SCMProbe { private static final long serialVersionUID = 1L; private static Logger logger = Logger.getLogger(P4Probe.class.getName()); private final P4Head head; private transient ConnectionHelper p4; public P4Probe(ConnectionHelper p4, P4Head head) { this.head = head; this.p4 = p4; } @Override public String name() { return head.getName(); } @Override public long lastModified() { long last = 0L; try { P4Path path = head.getPath(); long change = p4.getHead(path.getPathBuilder("...")); if(change > last) { last = change; } } catch (Exception e) { logger.warning("Unable to check changes: " + e.getMessage()); } return last; } @Override public SCMProbeStat stat(@NonNull String file) throws IOException { try { P4Path path = head.getPath(); String depotPath = path.getPathBuilder(file); if (p4.hasFile(depotPath)) { return SCMProbeStat.fromType(SCMFile.Type.REGULAR_FILE); } } catch (Exception e) { throw new IOException("Unable to check file: " + e.getMessage()); } return SCMProbeStat.fromType(SCMFile.Type.NONEXISTENT); } @Override public void close() throws IOException { // No need to close ConnectionHelper } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#11 | 24501 | Paul Allen | Refactor to use P4SCMXxx naming convention. | ||
#10 | 24500 | Paul Allen | Tidyup and refactor P4Ref classes. | ||
#9 | 24487 | Paul Allen | Perforce Connection Refactor. | ||
#8 | 24454 | Paul Allen |
Exclude and Include mapping support. Refactored P4Path usage and added P4SwarmPath. JENKINS-49804 |
||
#7 | 23327 | Paul Allen | Use client less connection when scanning MultiBranch. | ||
#6 | 22875 | Paul Allen | Refactor P4Path and Swarm API | ||
#5 | 22678 | Paul Allen |
MultiBranch support for Helix4Git (GitHub PR model). Update MultiBranch product names to Helix. |
||
#4 | 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 |
||
#3 | 22128 | Paul Allen |
Helix Graph support for Jenkins. JENKINS-40354 |
||
#2 | 21794 | Paul Allen |
Merge pull request #39 from Dohbedoh/JENKINS-34825 Jenkins 34825 |
||
#1 | 21758 | Paul Allen |
Merge pull request #38 from jenkinsci/dev scm-api 2.0.2 updates |