Index: javacvs/libsrc/org/netbeans/lib/cvsclient/Client.java =================================================================== RCS file: /test/javacvs/libsrc/org/netbeans/lib/cvsclient/Client.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- javacvs/libsrc/org/netbeans/lib/cvsclient/Client.java 8 Jul 2003 18:59:19 -0000 1.2 +++ javacvs/libsrc/org/netbeans/lib/cvsclient/Client.java 8 Jul 2003 19:15:13 -0000 1.3 @@ -854,5 +854,23 @@ return wrappersMap; } + /** Returns if this particular request is honored by the server + * + */ + public boolean isValidRequest(String request) { + + // strip off any newlines and blanks at the end + // and get the raw request string as we cache them in the map + int index = request.indexOf("\n"); // NO18N + + if (index > 0) { + request = request.substring(0, index); + } + request = request.trim(); + + return (validRequests.get(request) != null); + + } + } Index: javacvs/libsrc/org/netbeans/lib/cvsclient/ClientServices.java =================================================================== RCS file: /test/javacvs/libsrc/org/netbeans/lib/cvsclient/ClientServices.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- javacvs/libsrc/org/netbeans/lib/cvsclient/ClientServices.java 8 Jul 2003 18:59:19 -0000 1.2 +++ javacvs/libsrc/org/netbeans/lib/cvsclient/ClientServices.java 8 Jul 2003 19:15:13 -0000 1.3 @@ -184,5 +184,11 @@ */ Map getWrappersMap(); + + /** + * Returns if this particular request is honored by the server. This method + * trims the input string off any trailing blanks or new lines. + */ + boolean isValidRequest(String request); } Index: javacvs/libsrc/org/netbeans/lib/cvsclient/command/add/AddCommand.java =================================================================== RCS file: /test/javacvs/libsrc/org/netbeans/lib/cvsclient/command/add/AddCommand.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- javacvs/libsrc/org/netbeans/lib/cvsclient/command/add/AddCommand.java 8 Jul 2003 18:46:02 -0000 1.1.1.1 +++ javacvs/libsrc/org/netbeans/lib/cvsclient/command/add/AddCommand.java 8 Jul 2003 19:15:13 -0000 1.2 @@ -176,24 +176,25 @@ /** * Add requests for a particular file or directory to be added. */ - protected void addRequests(File file) + protected void addRequests(File file, ClientServices client) throws IOException, CommandException { if (file.isDirectory()) { - addRequestsForDirectory(file, false); + addRequestsForDirectory(file, client, false); } else { - addRequestsForFile(file); + addRequestsForFile(file, client); } } /** * Add requests for a particular directory. * @param directory the directory to add + * @param client The corresponding client services * @param adding - for the directory to be added, set to true. * used internally to recurse Directory requests. * @throws IOException if an error occurs */ - private void addRequestsForDirectory(File directory, boolean recursion) + private void addRequestsForDirectory(File directory, ClientServices client, boolean recursion) throws IOException { File parentDirectory = directory.getParentFile(); @@ -213,7 +214,7 @@ // backslashes very much. partPath = dir + "/" + directory.getName(); //NOI18N // recursively scroll back to the localPath.. - addRequestsForDirectory(parentDirectory, true); + addRequestsForDirectory(parentDirectory, client, true); } if (recursion) { @@ -261,7 +262,7 @@ /** * Add requests for a particular file. */ - protected void addRequestsForFile(File file) + protected void addRequestsForFile(File file, ClientServices client) throws IOException { File directory = file.getParentFile(); String dir = getRelativeToLocalPathInUnixStyle(directory); @@ -282,7 +283,14 @@ else { boolean isBinary = (getKeywordSubst() == KeywordSubstitutionOptions.BINARY); - requests.add(new ModifiedRequest(file, isBinary)); + + if (client.isValidRequest("Is-modified")) { + requests.add(new IsModifiedRequest(file, isBinary)); + } + else { + requests.add(new ModifiedRequest(file, isBinary)); + } + } if (dir.equals(".")) { //NOI18N @@ -292,7 +300,7 @@ argumentRequests.add(new ArgumentRequest(dir + "/" + file.getName())); //NOI18N } } - + /** * Execute a command. * @param client the client services object that provides any necessary @@ -340,7 +348,7 @@ try { // current dir sent to server BEFORE and AFTER - kinda hack?? for (int i = 0; i < files.length; i++) { - addRequests(files[i]); + addRequests(files[i] , client); } // now add the request that indicates the working directory for the @@ -584,3 +592,4 @@ } } } + Index: javacvs/libsrc/org/netbeans/lib/cvsclient/request/IsModifiedRequest.java =================================================================== RCS file: javacvs/libsrc/org/netbeans/lib/cvsclient/request/IsModifiedRequest.java diff -N javacvs/libsrc/org/netbeans/lib/cvsclient/request/IsModifiedRequest.java --- nul 1 Jan 1970 00:00:00 -0000 +++ javacvs/libsrc/org/netbeans/lib/cvsclient/request/IsModifiedRequest.java 10 Jul 2003 13:55:58 -0000 1.2 @@ -0,0 +1,80 @@ +/***************************************************************************** + * Sun Public License Notice + * + * The contents of this file are subject to the Sun Public License Version + * 1.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is available at http://www.sun.com/ + * + * The Initial Developer of the Original Code is Sriram Seshan. + * Portions created by Sriram Seshan are Copyright (C) 2003. + * All Rights Reserved. + * + * Contributor(s): Sriram Seshan. + *****************************************************************************/ + +/* + * IsModifiedRequest.java + * This class implements the support for sending the Is-modified request of the + * CVS protocol to the server + * Created on July 3, 2003, 10:59 AM + */ + +package org.netbeans.lib.cvsclient.request; +import java.io.*; + +import org.netbeans.lib.cvsclient.file.*; + +/** + * + * @author Sriram Seshan + */ + + +public class IsModifiedRequest extends Request { + /** + * The file details + */ + private FileDetails fileDetails; + + /** + * Construct a new Ismodified request. + * @param theFile the file that has been modified + */ + public IsModifiedRequest(File file, boolean isBinary) { + fileDetails = new FileDetails(file, isBinary); + } + + + + /** Get the request String that will be passed to the server + * @return the request String + * @throws UnconfiguredRequestException if the request has not been + * properly configured + * + */ + public String getRequestString() throws UnconfiguredRequestException { + StringBuffer sb = new StringBuffer(128); + if (fileDetails == null) { + throw new UnconfiguredRequestException("FileDetails is null in " + + "IsModifiedRequest"); + } + final FileMode mode = new FileMode(fileDetails.getFile()); + if (fileDetails.isBinary()) { + sb.append("Kopt - kb\n"); // NOI18N + } + + sb.append("Is-modified "); //NOI18N + sb.append(fileDetails.getFile().getName()).append("\n"); //NOI18N + return sb.toString(); + } + + /** Is a response expected from the server? + * @return true if a response is expected, false if no response if + * expected + * + */ + public boolean isResponseExpected() { + return false; + } + +}