package org.jenkinsci.plugins.p4.changes; import hudson.model.Run; import hudson.scm.RepositoryBrowser; import hudson.scm.ChangeLogSet; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.PrintStream; import java.nio.charset.Charset; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; import org.apache.commons.lang.StringEscapeUtils; import org.kohsuke.stapler.framework.io.WriterOutputStream; import com.perforce.p4java.core.file.FileAction; import com.perforce.p4java.core.file.IFileSpec; public class P4ChangeSet extends ChangeLogSet<P4ChangeEntry> { private List<P4ChangeEntry> history; protected P4ChangeSet(Run<?, ?> run, RepositoryBrowser<?> browser, List<P4ChangeEntry> logs) { super(run, browser); this.history = Collections.unmodifiableList(logs); } public Iterator<P4ChangeEntry> iterator() { return history.iterator(); } @Override public boolean isEmptySet() { return history.isEmpty(); } public List<P4ChangeEntry> getHistory() { return history; } public Collection<P4ChangeEntry> getLogs() { return history; } public static void store(File file, List<Object> changes) { try { FileOutputStream o = new FileOutputStream(file); BufferedOutputStream b = new BufferedOutputStream(o); Charset c = Charset.forName("UTF-8"); OutputStreamWriter w = new OutputStreamWriter(b, c); WriterOutputStream s = new WriterOutputStream(w); PrintStream stream = new PrintStream(s); stream.println("<?xml version='1.0' encoding='UTF-8'?>"); stream.println("<changelog>"); for (Object change : changes) { stream.println("\t<entry>"); if (change instanceof String) { stream.println("\t\t<label>" + change + "</label>"); } else if (change instanceof P4ChangeEntry) { P4ChangeEntry cl = (P4ChangeEntry) change; stream.println("\t\t<changenumber><changeInfo>" + cl.getId() + "</changeInfo>"); stream.println("\t\t<clientId>" + cl.getClientId() + "</clientId>"); stream.println("\t\t<msg>" + StringEscapeUtils.escapeXml(cl.getMsg()) + "</msg>"); stream.println("\t\t<changeUser>" + StringEscapeUtils.escapeXml(cl.getAuthor() .getDisplayName()) + "</changeUser>"); stream.println("\t\t<changeTime>" + StringEscapeUtils.escapeXml(cl.getChangeTime()) + "</changeTime>"); stream.println("\t\t<shelved>" + cl.isShelved() + "</shelved>"); stream.println("\t\t<files>"); for (IFileSpec filespec : cl.getFiles()) { FileAction action = filespec.getAction(); stream.println("\t\t<file endRevision=\"" + filespec.getEndRevision() + "\" action=\"" + action.name() + "\" depot=\"" + filespec.getDepotPathString() + "\" />"); } stream.println("\t\t</files>"); stream.println("\t\t</changenumber>"); } else { stream.println("\t\t<changenumber>" + change + "</changenumber>"); } stream.println("\t</entry>"); } stream.println("</changelog>"); stream.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 14865 | Sven Erik Knop | Merging using sknop.p4jenkins-main | ||
#1 | 12955 | Sven Erik Knop | Branching using sknop.p4jenkins-main | ||
//guest/perforce_software/p4jenkins/main/src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeSet.java | |||||
#3 | 11626 | Paul Allen |
Workflow support. - Updated the plugin to the latest LTS Jenkins release 1.580.3. - Updated P4Java to 2014.1 Tested with simple ‘static’ workspace, there may be limitations with ‘manual’ workspace. Plan to add DSL support by extending the SCMStep class. #review-11537 JENKINS-24206 |
||
#2 | 11084 | Paul Allen |
(mjoubert) Fully populate changelog.xml Replaces sparse change log which only recorded the change number. The change is now recorded in full allowing faster page load times. The number of files listed in the change is limited to 50; to view larger changes please add a repo browser such as Swarm, Fisheye, P4Web, etc… |
||
#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/changes/P4ChangeSet.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/changes/P4ChangeSet.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 |