The status refresh after commit is changed. The output is parsed and "Up-to-date"
status is assigned to the committed files. Also sticky tag is found in Entries.
This is a fix of bugs #45249 and #21720.
1.1 --- a/vcs.profiles.cvsprofiles/src/org/netbeans/modules/vcs/profiles/cvsprofiles/commands/CvsCommit.java Tue Jul 20 14:58:58 2004 +0000
1.2 +++ b/vcs.profiles.cvsprofiles/src/org/netbeans/modules/vcs/profiles/cvsprofiles/commands/CvsCommit.java Tue Jul 20 15:47:13 2004 +0000
1.3 @@ -19,6 +19,10 @@
1.4 import org.netbeans.api.vcs.VcsManager;
1.5 import org.netbeans.api.vcs.commands.Command;
1.6
1.7 +import org.netbeans.modules.vcs.profiles.cvsprofiles.list.CvsListOffline;
1.8 +import org.netbeans.modules.vcs.profiles.cvsprofiles.list.StatusFilePathsBuilder;
1.9 +import org.netbeans.modules.vcs.profiles.cvsprofiles.visualizers.commit.CommitInformation;
1.10 +
1.11 import org.openide.filesystems.FileSystem;
1.12 import org.openide.filesystems.FileObject;
1.13 import org.openide.filesystems.FileUtil;
1.14 @@ -50,9 +54,17 @@
1.15 private static final String TEMP_FILE_PREFIX = "tempCommit";
1.16 private static final String TEMP_FILE_SUFFIX = "output";
1.17
1.18 + private static final String REPOSITORY_FILE_PATTERN = ",v <-- "; // NOI18N
1.19 + private static final String NEW_REVISION = "new revision: "; // NOI18N
1.20 + private static final String PREVIOUS_REVISION = "; previous revision: "; // NOI18N
1.21 + private static final String INITIAL_REVISION = "initial revision: "; //NOI18N
1.22 + private static final String DELETED_REVISION = "delete"; //NOI18N
1.23 +
1.24 private VcsFileSystem fileSystem = null;
1.25
1.26 private HashMap cachedEntries = new HashMap();
1.27 +
1.28 + private FileStatusUpdater fileStatusUpdater;
1.29
1.30 /** Creates new CvsCommit */
1.31 public CvsCommit() {
1.32 @@ -228,9 +240,12 @@
1.33 /**
1.34 * Run the commit and return the appropriate task IDs.
1.35 */
1.36 - private long[] doCommit(CommandsPool cpool, VcsCommand cmdCommit, ArrayList filesList, Hashtable vars) {
1.37 + private long[] doCommit(CommandsPool cpool, VcsCommand cmdCommit, ArrayList filesList,
1.38 + Hashtable vars, CommandOutputListener stderrNRListener,
1.39 + CommandDataOutputListener stderrListener,
1.40 + VcsCommandExecutor[][] executorsRet) {
1.41 Table files = getFiles(filesList);
1.42 - VcsCommandExecutor[] executors = VcsAction.doCommand(files, cmdCommit, vars, fileSystem);
1.43 + VcsCommandExecutor[] executors = VcsAction.doCommand(files, cmdCommit, vars, fileSystem, fileStatusUpdater, stderrNRListener, null, stderrListener);
1.44 //VcsCommandExecutor commit = fileSystem.getVcsFactory().getCommandExecutor(cmdCommit, vars);
1.45 //int preprocessStatus = cpool.preprocessCommand(commit, vars);
1.46 //cpool.startExecutor(commit);
1.47 @@ -238,17 +253,8 @@
1.48 long[] IDs = new long[executors.length];
1.49 for (int i = 0; i < executors.length; i++) {
1.50 IDs[i] = cpool.getCommandID(executors[i]);
1.51 - /*
1.52 - try {
1.53 - cpool.waitToFinish(executors[i]);
1.54 - } catch (InterruptedException iexc) {
1.55 - for (int j = i; j < executors.length; j++) {
1.56 - cpool.kill(executors[j]);
1.57 - }
1.58 - return new VcsCommandExecutor[0];
1.59 - }
1.60 - */
1.61 }
1.62 + executorsRet[0] = executors;
1.63 return IDs;
1.64 }
1.65
1.66 @@ -282,6 +288,7 @@
1.67 if (relativePath != null) {
1.68 relativePath = relativePath.replace(File.separatorChar, '/');
1.69 }
1.70 + fileStatusUpdater = new FileStatusUpdater(new File(fsRoot, relativePath), relativePath, (String) vars.get("CVS_REPOSITORY"), stdoutNRListener, stdoutListener);
1.71 fsRoot = fsRoot.replace('/', ps);
1.72 //final StringBuffer buff = new StringBuffer();
1.73 ArrayList filePaths = getFilePaths((String) vars.get("COMMON_PARENT"), (String) vars.get("PATHS"), ps);
1.74 @@ -316,7 +323,9 @@
1.75 filesCommited.removeAll(alreadyCommittedFiles);
1.76 if (filesCommited.size() == 0) return true;//break ;
1.77 //setProcessingFiles(filesCommited, vars);
1.78 - long[] IDs = doCommit(cpool, cmdCommit, filesCommited, vars);
1.79 + VcsCommandExecutor[][] executors = new VcsCommandExecutor[1][];
1.80 + long[] IDs = doCommit(cpool, cmdCommit, filesCommited, vars,
1.81 + stderrNRListener, stderrListener, executors);
1.82 //cmdCommit1.setProperty(CommandCustomizationSupport.INPUT_DESCRIPTOR_PARSED,
1.83 // cmdCommit.getProperty(CommandCustomizationSupport.INPUT_DESCRIPTOR_PARSED));
1.84 if (IDs.length == 0) {
1.85 @@ -327,14 +336,15 @@
1.86 alreadyCommittedFiles.addAll(filesCommited);
1.87 filePaths.removeAll(filesCommited);
1.88 //vars = new Hashtable(varsOriginal);
1.89 + StringBuffer IDBuff = new StringBuffer();
1.90 + for (int i = 0; i < IDs.length; i++) {
1.91 + if (i > 0) IDBuff.append(" ,");
1.92 + IDBuff.append(Long.toString(IDs[i]));
1.93 + }
1.94 + final String IDStr = IDBuff.toString();
1.95 if (filePaths.size() > 0) {
1.96 vars.put("TEMPLATE_FILE_PLEASE_WAIT_TEXT", NbBundle.getMessage(CvsCommit.class, "CvsCommit.templateFileCheck"));
1.97 - StringBuffer IDStr = new StringBuffer();
1.98 - for (int i = 0; i < IDs.length; i++) {
1.99 - if (i > 0) IDStr.append(" ,");
1.100 - IDStr.append(Long.toString(IDs[i]));
1.101 - }
1.102 - vars.put("COMMIT_COMMANDS_IDS", IDStr.toString());
1.103 + vars.put("COMMIT_COMMANDS_IDS", IDStr);
1.104 CommandSupport cmdSupport = fileSystem.getCommandSupport("COMMIT"); // Myself
1.105 Command cmd = cmdSupport.createCommand();
1.106 if (cmd instanceof VcsDescribedCommand) {
1.107 @@ -344,9 +354,22 @@
1.108 cmd.execute();
1.109 }
1.110 }
1.111 - //} while (filePaths.size() > 0);
1.112 + boolean status = true;
1.113 + for(int i = 0; i < executors[0].length; i++) {
1.114 + try {
1.115 + cpool.waitToFinish(executors[0][i]);
1.116 + } catch (InterruptedException iexc) {
1.117 + for (int j = i; j < executors[0].length; j++) {
1.118 + cpool.kill(executors[0][j]);
1.119 + }
1.120 + Thread.currentThread().interrupt();
1.121 + break;
1.122 + }
1.123 + status = status && (executors[0][i].getExitStatus() == VcsCommandExecutor.SUCCEEDED);
1.124 + }
1.125 + fileStatusUpdater.flushElements();
1.126 //cpool.preprocessCommand(vce, vars);
1.127 - return true;
1.128 + return status;
1.129 }
1.130
1.131 private static String fileOutput(String buffer) {
1.132 @@ -371,4 +394,124 @@
1.133 }
1.134 return outputFile.getAbsolutePath();
1.135 }
1.136 +
1.137 + /** Gets the output of "cvs commit" command and updates the status of committed files. */
1.138 + private static class FileStatusUpdater extends Object implements CommandOutputListener {
1.139 +
1.140 + private StatusFilePathsBuilder pathsBuilder;
1.141 + private File workingDir;
1.142 + private int workPathLength;
1.143 + private String relativePath;
1.144 + private CommandOutputListener stdoutNRListener; // The listener to propagate the standard output to
1.145 + private CommandDataOutputListener fileUpdateListener; // The listener to send data output to
1.146 + private String lastFilePath;
1.147 + private String lastFileDir;
1.148 + private List elementsToSend;
1.149 +
1.150 + public FileStatusUpdater(File workingDir, String relativePath, String cvsRepository,
1.151 + CommandOutputListener stdoutNRListener,
1.152 + CommandDataOutputListener fileUpdateListener) {
1.153 + this.stdoutNRListener = stdoutNRListener;
1.154 + this.fileUpdateListener = fileUpdateListener;
1.155 + this.pathsBuilder = new StatusFilePathsBuilder(workingDir, cvsRepository);
1.156 + this.workingDir = workingDir;
1.157 + workPathLength = workingDir.getAbsolutePath().length();
1.158 + this.relativePath = relativePath;
1.159 + if (relativePath.length() > 0) {
1.160 + this.relativePath += "/";
1.161 + }
1.162 + elementsToSend = new ArrayList();
1.163 + }
1.164 +
1.165 + public void outputLine(String line) {
1.166 + stdoutNRListener.outputLine(line);
1.167 + int reposFileIndex = line.indexOf(REPOSITORY_FILE_PATTERN);
1.168 + if (reposFileIndex > 0) {
1.169 + String reposFile = line.substring(0, reposFileIndex);
1.170 + int fileIndex = reposFile.lastIndexOf('/');
1.171 + String file = reposFile.substring(fileIndex + 1);
1.172 + lastFilePath = pathsBuilder.getStatusFilePath(file, reposFile);
1.173 + if (lastFilePath != null) {
1.174 + lastFilePath = lastFilePath.replace(File.separatorChar, '/');
1.175 + }
1.176 + } else if (line.startsWith(NEW_REVISION) && lastFilePath != null) {
1.177 + int endRevision = line.indexOf(';', NEW_REVISION.length());
1.178 + if (endRevision <= 0) return ;
1.179 + String revision = line.substring(NEW_REVISION.length(), endRevision).trim();
1.180 + if (DELETED_REVISION.equals(revision)) {
1.181 + endRevision += PREVIOUS_REVISION.length();
1.182 + if (endRevision < line.length()) {
1.183 + revision = line.substring(endRevision).trim();
1.184 + }
1.185 + revision(revision, CommitInformation.REMOVED);
1.186 + } else {
1.187 + revision(revision, CommitInformation.CHANGED);
1.188 + }
1.189 + } else if (line.startsWith(INITIAL_REVISION) && lastFilePath != null) {
1.190 + String revision = line.substring(INITIAL_REVISION.length()).trim();
1.191 + revision(revision, CommitInformation.ADDED);
1.192 + }
1.193 + }
1.194 +
1.195 + private void revision(String revision, String operationType) {
1.196 + int fileIndex = lastFilePath.lastIndexOf('/');
1.197 + String fileDir;
1.198 + if (fileIndex <= 0) fileDir = "";
1.199 + else fileDir = lastFilePath.substring(0, fileIndex);
1.200 + if (!fileDir.equals(lastFileDir)) {
1.201 + // Do that asynchronously for all files in a given folder,
1.202 + // after there's a chance that the CVS/Entries file is updated and closed.
1.203 + flushElements();
1.204 + lastFileDir = fileDir;
1.205 + }
1.206 + String[] elements = new String[9];
1.207 + elements[0] = relativePath + lastFilePath;
1.208 + elements[1] = "Up-to-date";
1.209 + elements[2] = revision;
1.210 + elements[3] = ""; // time
1.211 + elements[4] = ""; // date
1.212 + elements[5] = null;// findSticky(lastFilePath); - load it asynchronously in flushElements()
1.213 + elements[6] = ""; // lockers
1.214 + if (CommitInformation.REMOVED == operationType) {
1.215 + elements[7] = relativePath + lastFilePath; // removed file
1.216 + } else {
1.217 + elements[7] = null; // removed file
1.218 + }
1.219 + elements[8] = operationType; // information for the visualizer
1.220 + //fileUpdateListener.outputData(elements);
1.221 + elementsToSend.add(elements);
1.222 + lastFilePath = null;
1.223 + }
1.224 +
1.225 + public void flushElements() {
1.226 + if (lastFileDir == null) return ;
1.227 + File folder = new File(workingDir, lastFileDir);
1.228 + File entries = new File(folder, "CVS/Entries"); // NOI18N
1.229 + Map entriesByFiles = CvsListOffline.createEntriesByFiles(CvsListOffline.loadEntries(entries));
1.230 + for (Iterator it = elementsToSend.iterator(); it.hasNext(); ) {
1.231 + String[] elements = (String[]) it.next();
1.232 + elements[5] = findSticky(elements[0], entriesByFiles);
1.233 + fileUpdateListener.outputData(elements);
1.234 + }
1.235 + elementsToSend.clear();
1.236 + }
1.237 +
1.238 + private String findSticky(String filePath, Map entriesByFiles) {
1.239 + int fileIndex = filePath.lastIndexOf('/');
1.240 + String fileName;
1.241 + if (fileIndex <= 0) fileName = filePath;
1.242 + else fileName = filePath.substring(fileIndex + 1);
1.243 + String entry = (String) entriesByFiles.get(fileName);
1.244 + if (entry == null) return "";
1.245 + String[] entryItems = CvsListOffline.parseEntry(entry);
1.246 + String sticky;
1.247 + if (entryItems.length > 4) {
1.248 + sticky = entryItems[4];
1.249 + if (sticky.length() > 0) sticky = sticky.substring(1, sticky.length());
1.250 + } else {
1.251 + sticky = "";
1.252 + }
1.253 + return sticky;
1.254 + }
1.255 + }
1.256 }
2.1 --- a/vcs.profiles.cvsprofiles/src/org/netbeans/modules/vcs/profiles/cvsprofiles/config/cvs.xml Tue Jul 20 14:58:58 2004 +0000
2.2 +++ b/vcs.profiles.cvsprofiles/src/org/netbeans/modules/vcs/profiles/cvsprofiles/config/cvs.xml Tue Jul 20 15:47:13 2004 +0000
2.3 @@ -730,6 +730,9 @@
2.4 IF_VAR_NON_EMPTY"FILES_IS_FOLDER"_ASK_FOR_EXPERT(RECURSIVE, getBundle(org/netbeans/modules/vcs/profiles/cvsprofiles/config/Bundle).getString(COMMAND_Recursive), "true",ACCESSIBILITY(DESCRIPTION_getBundle(org/netbeans/modules/vcs/profiles/cvsprofiles/config/Bundle).getString(ACSD_COMMAND_Recursive);;MNEMONIC_getBundle(org/netbeans/modules/vcs/profiles/cvsprofiles/config/Bundle).getString(ACS_COMMAND_Recursive_mnc)),"-R", "-l")
2.5 </value>
2.6 </property>
2.7 + <property name="visualizer">
2.8 + <value>org.netbeans.modules.vcs.profiles.cvsprofiles.visualizers.commit.CvsCommitVisualizer</value>
2.9 + </property>
2.10 <property name="input">
2.11 <value></value>
2.12 </property>
2.13 @@ -739,6 +742,33 @@
2.14 <property name="error.regex">
2.15 <value>(.*$)</value>
2.16 </property>
2.17 + <property name="data.fileName.index">
2.18 + <value>0</value>
2.19 + </property>
2.20 + <property name="data.status.index">
2.21 + <value>1</value>
2.22 + </property>
2.23 + <property name="data.revision.index">
2.24 + <value>2</value>
2.25 + </property>
2.26 + <property name="data.time.index">
2.27 + <value>3</value>
2.28 + </property>
2.29 + <property name="data.date.index">
2.30 + <value>4</value>
2.31 + </property>
2.32 + <property name="data.sticky.index">
2.33 + <value>5</value>
2.34 + </property>
2.35 + <property name="data.locker.index">
2.36 + <value>6</value>
2.37 + </property>
2.38 + <property name="data.removedFileName.index">
2.39 + <value>7</value>
2.40 + </property>
2.41 + <property name="refreshFileRelativePath">
2.42 + <value></value>
2.43 + </property>
2.44 <property name="onRoot">
2.45 <value>true</value>
2.46 </property>
2.47 @@ -762,9 +792,6 @@
2.48 <property name="exec">
2.49 <value>${CDM_EXECUTE} ${USER_GLOBAL_PARAM} commit ${FORCE} ${RUN_MODULE_PROGRAM} ${RECURSIVE} $[? BRANCH] [-r ${BRANCH}] [] -F ${QUOTE}${TEMPLATE_FILE}${QUOTE} $[? PATHS] [${QPATHS}] [] ${NUR}</value>
2.50 </property>
2.51 - <property name="visualizer">
2.52 - <value>org.netbeans.modules.vcs.profiles.cvsprofiles.visualizers.commit.CvsCommitVisualizer</value>
2.53 - </property>
2.54 <property name="checkForModifications">
2.55 <value>true</value>
2.56 </property>
2.57 @@ -774,25 +801,6 @@
2.58 <property name="changingNumRevisions">
2.59 <value>true</value>
2.60 </property>
2.61 - <property name="data.regex">
2.62 - <!-- <value>^RCS file.*Checking in (.*);.*initial revision: (.*)(done)$|^Checking in (.*);.*new revision: (.*);.*(done)$|^(R)(e)(moving) (.*);.*new revision.*done$</value> -->
2.63 - <value>^Checking( )in( )(.*);$|initial( )revision: (.*)$|new( )revision: (.*);.*$|(done)$|^(R)(e)(moving) (.*);$</value>
2.64 - </property>
2.65 - <property name="data.fileName.index">
2.66 - <value>2</value>
2.67 - </property>
2.68 - <property name="data.status.index">
2.69 - <value>0</value>
2.70 - </property>
2.71 - <property name="refreshFileStatusSubstitutions">
2.72 - <value>"done", "Up-to-date"</value>
2.73 - </property>
2.74 - <property name="data.revision.index">
2.75 - <value>1</value>
2.76 - </property>
2.77 - <property name="data.removedFileName.index">
2.78 - <value>3</value>
2.79 - </property>
2.80 <property name="concurrentExec">
2.81 <value>10</value> <!-- EXEC_SERIAL_ON_PACKAGE + EXEC_SERIAL_OF_COMMAND -->
2.82 </property>
3.1 --- a/vcs.profiles.cvsprofiles/src/org/netbeans/modules/vcs/profiles/cvsprofiles/list/StatusFilePathsBuilder.java Tue Jul 20 14:58:58 2004 +0000
3.2 +++ b/vcs.profiles.cvsprofiles/src/org/netbeans/modules/vcs/profiles/cvsprofiles/list/StatusFilePathsBuilder.java Tue Jul 20 15:47:13 2004 +0000
3.3 @@ -31,6 +31,7 @@
3.4 import java.util.regex.PatternSyntaxException;
3.5
3.6 import org.netbeans.modules.vcs.profiles.cvsprofiles.visualizers.status.StatusInformation;
3.7 +import org.openide.filesystems.FileUtil;
3.8
3.9 /**
3.10 * A builder that assembles files paths in working directories
3.11 @@ -160,6 +161,43 @@
3.12 return found[0];
3.13 }
3.14
3.15 + /**
3.16 + * Fill in the complete file path in the status information.
3.17 + * It's supposed, that this method is called once for every file.
3.18 + * This is necessary in order to assure, that one file is not
3.19 + * filled twice when there are more possibilities.
3.20 + * @param fileName The name of the file (only name without path)
3.21 + * @param info the status information about that file
3.22 + * @return The file path relative to the working directory, or <code>null</code>,
3.23 + * when the file path was not found.
3.24 + */
3.25 + public String getStatusFilePath(String fileName, String repositoryFileName) {
3.26 + String[] filePaths = getFilePaths(fileName, repositoryFileName);
3.27 + if (filePaths == null) {
3.28 + if (!examiningPaths.isEmpty()) {
3.29 + filePaths = (String[]) examiningPaths.toArray(new String[0]);
3.30 + } else {
3.31 + filePaths = (String[]) workReposPaths.keySet().toArray(new String[0]);
3.32 + }
3.33 + }
3.34 + boolean[] found = new boolean[] { true };
3.35 + File dir = findSuitableDir(workingDir, filePaths, fileName, null,
3.36 + processedFilePaths, found);
3.37 + if (!found[0]) return null;
3.38 + else {
3.39 + String dirPath = dir.getAbsolutePath();
3.40 + int wl = workingDir.getAbsolutePath().length();
3.41 + if (wl < dirPath.length()) {
3.42 + dirPath = dirPath.substring(wl);
3.43 + while (dirPath.startsWith(File.separator)) dirPath = dirPath.substring(1);
3.44 + } else {
3.45 + dirPath = "";
3.46 + }
3.47 + if (dirPath.length() == 0) return fileName;
3.48 + else return dirPath + File.separator + fileName;
3.49 + }
3.50 + }
3.51 +
3.52 private static File findSuitableDir(File workingDir, String[] filePaths,
3.53 String fileName, StatusInformation info,
3.54 Set processedFilePaths, boolean[] found_ptr) {
3.55 @@ -191,13 +229,15 @@
3.56 String revision = entryItems[1];
3.57 //System.out.println("revision = "+revision);
3.58 String status;
3.59 - if (revision.startsWith("-")) {
3.60 - if (!"Locally Removed".equals(info.getStatus())) {
3.61 - continue;
3.62 - }
3.63 - } else if (revision.equals("0")) {
3.64 - if (!"Locally Added".equals(info.getStatus())) {
3.65 - continue;
3.66 + if (info != null) {
3.67 + if (revision.startsWith("-")) {
3.68 + if (!"Locally Removed".equals(info.getStatus())) {
3.69 + continue;
3.70 + }
3.71 + } else if (revision.equals("0")) {
3.72 + if (!"Locally Added".equals(info.getStatus())) {
3.73 + continue;
3.74 + }
3.75 }
3.76 }
3.77 String filePath = new File(dir, fileName).getAbsolutePath();
3.78 @@ -211,6 +251,7 @@
3.79 found_ptr[0] = false;
3.80 dir = workingDir; // The dir was not found!
3.81 }
3.82 + dir = FileUtil.normalizeFile(dir);
3.83 return dir;
3.84 }
3.85
4.1 --- a/vcs.profiles.cvsprofiles/src/org/netbeans/modules/vcs/profiles/cvsprofiles/visualizers/commit/CvsCommitVisualizer.java Tue Jul 20 14:58:58 2004 +0000
4.2 +++ b/vcs.profiles.cvsprofiles/src/org/netbeans/modules/vcs/profiles/cvsprofiles/visualizers/commit/CvsCommitVisualizer.java Tue Jul 20 15:47:13 2004 +0000
4.3 @@ -39,6 +39,7 @@
4.4 public class CvsCommitVisualizer extends OutputVisualizer {
4.5
4.6 public static final String UNKNOWN = "commit: nothing known about `"; //NOI18N
4.7 + /*
4.8 public static final String EXAM_DIR = "server: Examining"; //NOI18N
4.9 public static final String CHECKING_IN = "Checking in "; //NOI18N
4.10 public static final String REMOVING = "Removing "; //NOI18N
4.11 @@ -47,6 +48,7 @@
4.12 public static final String DONE = "done"; //NOI18N
4.13 public static final String RCS_FILE = "RCS file: "; //NOI18N
4.14 public static final String ADD = "commit: use `cvs add' to create an entry for "; //NOI18N
4.15 + */
4.16
4.17 private CommitInformation commitInformation;
4.18 private boolean isAdding;
4.19 @@ -57,7 +59,6 @@
4.20 */
4.21 private String localPath;
4.22 private CommitInfoPanel contentPane = null;
4.23 - private HashMap output;
4.24 private int exit = Integer.MIN_VALUE; // unset exit status
4.25 private List outputInfosToShow; // cached information when the command is providing
4.26 // output sooner then the GUI is created.
4.27 @@ -75,7 +76,7 @@
4.28
4.29 public Map getOutputPanels() {
4.30 debug("getOutputPanel");
4.31 - output = new HashMap();
4.32 + HashMap output = new HashMap();
4.33 contentPane = new CommitInfoPanel(this);
4.34 contentPane.setVcsTask(getVcsTask());
4.35 contentPane.setOutputCollector(getOutputCollector());
4.36 @@ -126,44 +127,8 @@
4.37 * This method is called, with the output line.
4.38 * @param line The output line.
4.39 */
4.40 - public void stdOutputLine(String line) {
4.41 - if (line.indexOf(UNKNOWN) >= 0) {
4.42 - processUnknownFile(line.substring(line.indexOf(UNKNOWN) + UNKNOWN.length()).trim());
4.43 - }
4.44 - else if (line.indexOf(ADD) > 0) {
4.45 - processToAddFile(line.substring(line.indexOf(ADD) + ADD.length()).trim());
4.46 - }
4.47 - else if (line.startsWith(CHECKING_IN)) {
4.48 - // - 1 means to cut the ';' character
4.49 - processFile(line.substring(CHECKING_IN.length(), line.length() - 1));
4.50 - if (isAdding) {
4.51 - commitInformation.setType(commitInformation.ADDED);
4.52 - isAdding = false;
4.53 - }
4.54 - else {
4.55 - commitInformation.setType(commitInformation.CHANGED);
4.56 - }
4.57 - }
4.58 - else if (line.startsWith(REMOVING)) {
4.59 - processFile(line.substring(REMOVING.length(), line.length() - 1));
4.60 - // - 1 means to cut the ';' character
4.61 - commitInformation.setType(commitInformation.REMOVED);
4.62 - }
4.63 - else if (line.indexOf(EXAM_DIR) >= 0) {
4.64 - fileDirectory = line.substring(line.indexOf(EXAM_DIR) + EXAM_DIR.length()).trim();
4.65 - }
4.66 - else if (line.startsWith(RCS_FILE)) {
4.67 - isAdding = true;
4.68 - }
4.69 - else if (line.startsWith(DONE)) {
4.70 - outputDone();
4.71 - }
4.72 - else if (line.startsWith(INITIAL_REVISION)) {
4.73 - processRevision(line.substring(INITIAL_REVISION.length()));
4.74 - }
4.75 - else if (line.startsWith(NEW_REVISION)) {
4.76 - processRevision(line.substring(NEW_REVISION.length()));
4.77 - }
4.78 + public void stdOutputLine(String line) {
4.79 + // Ignored, we get the parsed output from data output.
4.80 }
4.81
4.82 private File createFile(String fileName) {
4.83 @@ -174,44 +139,19 @@
4.84 commitInformation = new CommitInformation();
4.85 commitInformation.setType(commitInformation.UNKNOWN);
4.86 int index = line.indexOf('\'');
4.87 - String fileName = line.substring(0, index - 1).trim();
4.88 + String fileName = line.substring(0, index).trim();
4.89 commitInformation.setFile(createFile(fileName));
4.90 outputDone();
4.91 }
4.92
4.93 - private void processToAddFile(String line) {
4.94 + private void processFile(String fileName, String commitInfo, String revision) {
4.95 commitInformation = new CommitInformation();
4.96 - commitInformation.setType(commitInformation.TO_ADD);
4.97 - String fileName = line.trim();
4.98 - if (fileName.endsWith(";")) { //NOI18N
4.99 - fileName = fileName.substring(0, fileName.length() - 2);
4.100 - }
4.101 + commitInformation.setType(commitInfo);
4.102 commitInformation.setFile(createFile(fileName));
4.103 + commitInformation.setRevision(revision);
4.104 outputDone();
4.105 }
4.106
4.107 - private void processFile(String filename) {
4.108 - if (commitInformation == null) {
4.109 - commitInformation = new CommitInformation();
4.110 - }
4.111 -
4.112 - if (filename.startsWith("no file")) { //NOI18N
4.113 - filename = filename.substring(8);
4.114 - }
4.115 - commitInformation.setFile(createFile(filename));
4.116 - }
4.117 -
4.118 - private void processRevision(String revision) {
4.119 - int index = revision.indexOf(';');
4.120 - if (index >= 0) {
4.121 - revision = revision.substring(0, index);
4.122 - }
4.123 - commitInformation.setRevision(revision.trim());
4.124 - }
4.125 -
4.126 - public void parseEnhancedMessage(String key, Object value) {
4.127 - }
4.128 -
4.129 public void outputDone() {
4.130 //System.out.println("outputDone("+this.hashCode()+") ENTERED, fic = "+fileInfoContainer+", cp = "+(contentPane != null)+", oi = "+outputInfosToShow);
4.131 if (contentPane != null) {
4.132 @@ -276,6 +216,9 @@
4.133 }
4.134 errOutput.addText(line+'\n');
4.135 }
4.136 + if (line.indexOf(UNKNOWN) >= 0) {
4.137 + processUnknownFile(line.substring(line.indexOf(UNKNOWN) + UNKNOWN.length()).trim());
4.138 + }
4.139 }
4.140
4.141 /**
4.142 @@ -291,6 +234,10 @@
4.143 }
4.144 stdDataOutput.addText(VcsUtilities.arrayToString(data)+'\n');
4.145 }
4.146 + if (data.length < 9) return ;
4.147 + if (data[8] != null) {
4.148 + processFile(data[0], data[8], data[2]);
4.149 + }
4.150 }
4.151
4.152 /**