package org.jenkinsci.plugins.p4_client.changes; import hudson.model.User; import hudson.scm.ChangeLogSet; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import org.jenkinsci.plugins.p4_client.client.ClientHelper; import com.perforce.p4java.core.ChangelistStatus; import com.perforce.p4java.core.IJob; import com.perforce.p4java.core.file.IFileSpec; import com.perforce.p4java.impl.generic.core.Changelist; public class P4ChangeEntry extends ChangeLogSet.Entry { private Changelist changelist; private boolean shelved; private List<IFileSpec> files; private List<IJob> jobs; public P4ChangeEntry(P4ChangeSet parent) { super(); setParent(parent); } @Override public String getMsg() { return changelist.getDescription(); } @Override public User getAuthor() { String id = changelist.getUsername(); User user = User.get(id); return user; } @Override public Collection<String> getAffectedPaths() { List<String> files = new ArrayList<String>(); try { List<IFileSpec> list = changelist.getFiles(true); for (IFileSpec item : list) { files.add(item.getDepotPathString()); } } catch (Exception e) { e.printStackTrace(); } return files; } public void setChange(ClientHelper p4, int id) { try { this.changelist = (Changelist) p4.getChange(id); if (changelist.getStatus() == ChangelistStatus.PENDING) { this.files = p4.loadShelvedFiles(id); this.shelved = true; } else { this.files = changelist.getFiles(true); this.shelved = false; } this.jobs = changelist.getJobs(); } catch (Exception e) { e.printStackTrace(); } } public Changelist getChange() { return changelist; } public List<IFileSpec> getFiles() { return files; } public boolean isShelved() { return shelved; } public List<IJob> getJobs() { return jobs; } public String getJobStatus(IJob job) { Map<String, Object> map = job.getRawFields(); String status = (String) map.get("Status"); return status; } public String getJobSummary(IJob job) { String summary = job.getDescription(); if (summary.length() > 80) { summary = summary.substring(0, 80) + "..."; } return summary; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 9672 | Paul Allen | Refactor name from 'p4_client' to 'p4'. | ||
#5 | 9127 | Paul Allen |
Added Browser support for P4Web. - Includes fix for move/add and move/delete icons when browsing change lists. |
||
#4 | 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) |
||
#3 | 8940 | Paul Allen |
Major refactor for the ConnectionHelper class to simplify serialisation. Fixed remote Jenkins JNLP slave connection issue. ClientHelper now extends ConnectionHelper and takes on all methods that require a client workspace. P4StandardCredentials is sent to the remote node instead of Credentials ID due to an issue accessing the Credentials store over a remote connection. For simplicity Client ID (workspace name) is serialised instead of the Workspace object. |
||
#2 | 8916 | Paul Allen | Unit tests for ChangeLog feature and minor fix when listing files if the change is Submitted or Shelved. | ||
#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 |