package com.perforce.p4simulink.util; /** * Copyright (C) 2014 Perforce Software. All rights reserved. * * Please see LICENSE.txt in top-level folder of this distribution. */ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.perforce.p4java.core.file.FileSpecOpStatus; import com.perforce.p4java.core.file.IFileSpec; import com.perforce.p4simulink.P4CMException; public class Files { private static Logger logger = LogManager.getLogger(Files.class.getName()); public static boolean validateFileSpecs(List<IFileSpec> fileSpecs, String... ignore) throws Exception { return validateFileSpecs(fileSpecs, false, ignore); } public static boolean validateFileSpecs(List<IFileSpec> fileSpecs, boolean quiet, String... ignore) throws Exception { boolean success = true; boolean abort = false; String latestError = ""; for (IFileSpec fileSpec : fileSpecs) { FileSpecOpStatus status = fileSpec.getOpStatus(); if (status != FileSpecOpStatus.VALID) { String msg = fileSpec.getStatusMessage(); // superfluous p4java message boolean unknownMsg = true; ArrayList<String> ignoreList = new ArrayList<String>(); ignoreList.addAll(Arrays.asList(ignore)); for (String istring : ignoreList) { if (msg.contains(istring)) { // its a known message unknownMsg = false; } } // check and report unknown message if (unknownMsg) { if (!quiet) { msg = "P4JAVA: " + msg; latestError = msg; logger.error(msg); if (status == FileSpecOpStatus.ERROR || status == FileSpecOpStatus.CLIENT_ERROR) { abort = true; } } success = false; } } } if (!quiet && abort) { String msg = "P4JAVA: Error(s): " + latestError; throw new P4CMException(msg); } return success; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 11898 | Paul Allen |
Populate -o //guest/perforce_software/p4sl/main/... //guest/paul_allen/p4sl/.... |
||
//guest/perforce_software/p4sl/main/src/main/java/com/perforce/p4simulink/util/Files.java | |||||
#9 | 11672 | Paul Allen |
Tidy up formatting and imports. No functional change. |
||
#8 | 11659 | Paul Allen |
Performance improvements, continued: improved performance of getFileState() by replacing the client haveList call with a direct server command. Also improved isLatest by removing fstat calls and replacing with simpler calls to diff and sync. Transferred from p4://perforce.perforce.com:1666@983506 |
||
#7 | 11652 | Paul Allen |
Added boilerplate to code, fixed build issues (NPEs on plugin load), removed Mathworks classes from plugin jar, fixed delete vs missing issue on remove() call. Transferred from p4://perforce.perforce.com:1666@970498 |
||
#6 | 11647 | Paul Allen |
New project creation fixes. Transferred from p4://perforce.perforce.com:1666@958305 |
||
#5 | 11645 | Paul Allen |
Refactoring and additional work on UI: Removed Connection class and went with global server/client objects. Implemented panes for connection, depot path and passwords. Passwords are only requested when required. Transferred from p4://perforce.perforce.com:1666@957149 |
||
#4 | 11643 | Paul Allen |
Unshelved from pending changelist '953729': Paul: Added: - getWorkspaceState() -- run a p4 status - getOpenedState() -- run p4 opened - getIgnoreState() -- run p4 add -n Modified: - add() -- seemed to call reopen? - P4FileState -- simple constructor for state Elliot: * global client and changelist object within the adapter * removed repeated client updates and changelist refreshes * removed 'reopen' in add * added calls to 'edit' where appropriate file states are found * made 'checkout' a pure sync, with no edits * commented a bunch of the @Override methods * added a call to haveList in getFileState so we can see versions of files in the project * changed the connection pane to look like p4v's * refactored a bit of the dialogue code, added calls to prompt for password (like p4v) * changed all log.trace() calls to log.debug() so the log file messiness can be controlled more easily Functionality that now works properly: * open project from source control, with properly-configured .p4config file * add new project to source control, with properly-configured .p4config file * add * edit * commit * revert * compare reversions (opens Simulink diff tool) Things to work on: * dialogues (particularily the password one, but the connection one is a bit dodge-y) * remove from project (possibly always making the Simulink project meta-data editable will fix this - it *almost* works) - the current issue is Simulink needs to edit the meta-data, but Perforce has made the files read-only, so Simulink throws up on itself Transferred from p4://perforce.perforce.com:1666@954622 |
||
#3 | 11642 | Paul Allen |
More fixes from discussion with Paul and after looking at other integrations work. Transferred from p4://perforce.perforce.com:1666@953553 |
||
#2 | 11641 | Paul Allen |
Fixes from chat with Paul. Transferred from p4://perforce.perforce.com:1666@953389 |
||
#1 | 11639 | Paul Allen |
Integrate code from the P4Jenkins plugin, add ability to authenticate with tickets or ticket file. Worked through some issues with getting current file state. Transferred from p4://perforce.perforce.com:1666@952289 |