package org.jenkinsci.plugins.p4.browsers; import hudson.Extension; import hudson.Util; import hudson.model.Descriptor; import hudson.scm.RepositoryBrowser; import hudson.util.FormValidation; import net.sf.json.JSONObject; import org.jenkinsci.plugins.p4.changes.P4AffectedFile; import org.jenkinsci.plugins.p4.changes.P4ChangeEntry; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.StaplerRequest; import javax.servlet.ServletException; import java.io.IOException; import java.net.URL; public class SwarmBrowser extends P4Browser { private static final long serialVersionUID = 1L; @DataBoundConstructor public SwarmBrowser(String url) { super(url); } @Override public URL getChangeSetLink(P4ChangeEntry changeSet) throws IOException { return new URL(getSafeUrl() + "change/" + changeSet.getId()); } public URL getLabelSetLink(P4ChangeEntry changeSet) throws IOException { return new URL(getSafeUrl() + "label/" + changeSet.getId()); } @Override public URL getDiffLink(P4AffectedFile file, String change) throws Exception { // TODO Auto-generated method stub return null; } @Override public URL getFileLink(P4AffectedFile file) throws Exception { String r = file.getRevision(); String path = file.getPath(); path = path.replace("//", "files/"); String rev = "?v=" + r; return new URL(getSafeUrl() + path + rev); } @Override public URL getJobLink(String job) throws Exception { return new URL(getSafeUrl() + "jobs/" + job); } @Extension public static class DescriptorImpl extends Descriptor<RepositoryBrowser<?>> { @Override public String getDisplayName() { return "Swarm browser"; } public FormValidation doCheck(@QueryParameter final String value) throws IOException, ServletException { String url = Util.fixEmpty(value); if (url == null) { return FormValidation.ok(); } if (!url.startsWith("http://") && !url.startsWith("https://")) { return FormValidation.errorWithMarkup("The URL should contain <tt>http://</tt> or <tt>https://</tt>"); } return FormValidation.ok(); } @Override public SwarmBrowser newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException { return (req == null) ? null : req.bindJSON(SwarmBrowser.class, jsonObject); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#10 | 24698 | Paul Allen | Fix for the revision number used by Swarm and other browsers. | ||
#9 | 22684 | Paul Allen | Added @Symbol to Extension classes for Pipeline Syntax. | ||
#8 | 22375 | Paul Allen | Add null check for findbugs. | ||
#7 | 22372 | Paul Allen |
Update Repository Browser for use with Pipeline. May fix the following: JENKINS-43069 JENKINS-37094 |
||
#6 | 22128 | Paul Allen |
Helix Graph support for Jenkins. JENKINS-40354 |
||
#5 | 21132 | Paul Allen | FindBugs: Null Pointer Checks | ||
#4 | 19581 | Paul Allen | Minor fixes to satisfy FindBugs Analysis. | ||
#3 | 16409 | Paul Allen |
Use Fix records for Job information. 'p4 fixes' is lighter and still provides enough useful data. Includes jelly fix and extra job data in changelog.xml. |
||
#2 | 10207 | Paul Allen |
Swarm browses file at correct revision. Previously Swarm browser opened file at head revision not the correct revision for the change-list. |
||
#1 | 9690 | Paul Allen |
[Branching using p4-jenkins] Release 1.0.1 |
||
//guest/paul_allen/dev/p4-jenkins/p4-client/src/main/java/org/jenkinsci/plugins/p4/browsers/SwarmBrowser.java | |||||
#1 | 9672 | Paul Allen | Refactor name from 'p4_client' to 'p4'. | ||
//guest/paul_allen/dev/p4-jenkins/p4-client/src/main/java/org/jenkinsci/plugins/p4_client/browsers/SwarmBrowser.java | |||||
#2 | 9055 | Paul Allen |
Label support. Build at a label using the pram 'label'. This includes adding the label to the ChangeEntry, building the change reports and Browser links to Swarm. (TPI-102) |
||
#1 | 8915 | Paul Allen |
Support for ChangeLog and RepoBrowser. - Added RepoBrowser for Swarm (porting the others should be easy) - ChangeLog XML file now only stores the changelist number all other information is fetched from Perforce |