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 | |
---|---|---|---|---|---|
#14 | 28784 | Paul Allen |
Merge pull request #140 from jorgenpt/fix-file-limit-not-persisting Persist `fileLimit` when serializing a changeset |
||
#13 | 24939 | Paul Allen |
Escape unsupported XML low ascii characters with a '?'. JENKINS-52661 JENKINS-54841 |
||
#12 | 22513 | Paul Allen |
Lock resource on P4ChangeSet. Prevent parallel writers from getting the same file. |
||
#11 | 22315 | Paul Allen |
Pending change cleanup for unshelve. Unshelve would leave files open for add/edit/delete, the 'tidy' option will 'revert -k' the files leaving the content in the workspace, but removing the 'have' list data. Unshelve can now specify a Credential and Workspace, important for situations where more than one sync occurs in a pipeline script. JENKINS-43430 |
||
#10 | 22128 | Paul Allen |
Helix Graph support for Jenkins. JENKINS-40354 |
||
#9 | 19712 | Paul Allen | NPE fix when code line has no changes. | ||
#8 | 19581 | Paul Allen | Minor fixes to satisfy FindBugs Analysis. | ||
#7 | 19303 | Paul Allen |
Protect against null when no jobs are in a changelist. JENKINS-33993 |
||
#6 | 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. |
||
#5 | 15750 | Paul Allen |
Use a P4Revision object and not int/String as Object. In sure that there is no ambiguity with the revision specifier. Should fix change summary when using the Workflow plugin. JENKINS-30425 |
||
#4 | 14150 | Paul Allen |
URL Encode/Decode the depot path for changes. Filenames with ampersands was causing Jelly to break when showing the change detail. JENKINS-29017 |
||
#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 |