package org.jenkinsci.plugins.p4.scm; import edu.umd.cs.findbugs.annotations.NonNull; import hudson.model.TaskListener; import jenkins.scm.api.SCMFile; import jenkins.scm.api.SCMProbe; import jenkins.scm.api.SCMProbeStat; import org.jenkinsci.plugins.p4.client.ClientHelper; import java.io.IOException; import java.util.logging.Logger; import static org.jenkinsci.plugins.p4.scm.AbstractP4ScmSource.scmSourceClient; public class P4Probe extends SCMProbe { private static final long serialVersionUID = 1L; private static Logger logger = Logger.getLogger(P4Probe.class.getName()); private final String base; private transient ClientHelper p4; public P4Probe(String credential, TaskListener listener, String charset, String base) { this.base = base; this.p4 = new ClientHelper(credential, listener, scmSourceClient, charset); } @Override public String name() { return base; } @Override public long lastModified() { long last = 0L; try { last = p4.getHead(base + "/..."); } catch (Exception e) { logger.warning("Unable to check changes: " + e.getMessage()); } return last; } @NonNull @Override public SCMProbeStat stat(@NonNull String path) throws IOException { try { String depotPath = base + "/" + path; 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 { p4.disconnect(); } }
# | 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 |