package org.jenkinsci.plugins.p4.browsers; import com.perforce.p4java.core.file.IFileSpec; 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.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; public final URL url; @DataBoundConstructor public SwarmBrowser(URL url) { this.url = normalizeToEndWithSlash(url); } @Override public URL getChangeSetLink(P4ChangeEntry changeSet) throws IOException { return new URL(url.toString() + "change/" + changeSet.getId()); } public URL getLabelSetLink(P4ChangeEntry changeSet) throws IOException { return new URL(url.toString() + "label/" + changeSet.getId()); } @Override public URL getDiffLink(IFileSpec file) throws Exception { // TODO Auto-generated method stub return null; } @Override public URL getFileLink(IFileSpec file) throws Exception { int r = file.getEndRevision(); String path = file.getDepotPathString(); path = path.replace("//", "files/"); String rev = "?v=" + r; return new URL(url.toString() + path + rev); } @Override public URL getJobLink(String job) throws Exception { return new URL(url.toString() + "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 formData) throws FormException { SwarmBrowser browser = null; if (req != null) { browser = req.bindParameters(SwarmBrowser.class, "swarm."); } return browser; } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#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 | 21940 | Paul Allen | Branching using p4-jenkins | ||
//guest/perforce_software/p4jenkins/main/src/main/java/org/jenkinsci/plugins/p4/browsers/SwarmBrowser.java | |||||
#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 |