1 11 package org.eclipse.team.internal.ccvs.core.client; 12 13 14 import org.eclipse.core.runtime.IProgressMonitor; 15 import org.eclipse.core.runtime.IStatus; 16 import org.eclipse.team.internal.ccvs.core.*; 17 import org.eclipse.team.internal.ccvs.core.CVSException; 18 import org.eclipse.team.internal.ccvs.core.ICVSResource; 19 import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener; 20 import org.eclipse.team.internal.ccvs.core.connection.CVSServerException; 21 22 25 public class Diff extends Command { 26 27 public static final LocalOption UNIFIED_FORMAT = new LocalOption("-u"); public static final LocalOption CONTEXT_FORMAT = new LocalOption("-c"); public static final LocalOption INCLUDE_NEWFILES = new LocalOption("-N"); public static final LocalOption BRIEF = new LocalOption("--brief"); 32 protected Diff() { } 33 protected String getRequestId() { 34 return "diff"; } 36 37 41 protected IStatus doExecute(Session session, GlobalOption[] globalOptions, LocalOption[] localOptions, 42 String [] arguments, ICommandOutputListener listener, IProgressMonitor monitor) throws CVSException { 43 try { 44 IStatus status = super.doExecute(session, globalOptions, localOptions, arguments, listener, monitor); 45 if (status.getCode() == CVSStatus.SERVER_ERROR) { 46 if (status.isMultiStatus()) { 47 IStatus[] children = status.getChildren(); 48 for (int i = 0; i < children.length; i++) { 49 IStatus child = children[i]; 50 if (child.getMessage().indexOf("[diff aborted]") != -1) { throw new CVSServerException(status); 52 } 53 } 54 } 55 } 56 return status; 57 } catch (CVSServerException e) { 58 if (e.containsErrors()) throw e; 59 return e.getStatus(); 60 } 61 } 62 63 protected ICVSResource[] sendLocalResourceState(Session session, GlobalOption[] globalOptions, 64 LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor) 65 throws CVSException { 66 67 checkResourcesManaged(session, resources); 68 DiffStructureVisitor visitor = new DiffStructureVisitor(session, localOptions); 69 visitor.visit(session, resources, monitor); 70 return resources; 71 } 72 73 protected String getServerErrorMessage() { 74 return CVSMessages.Diff_serverError; 75 } 76 } 77 | Popular Tags |