blob: fb0afa17af6b42b27e2475b66fb47d94b89e797f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
package org.eclipse.team.internal.ccvs.core.response;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import java.io.PrintStream;
import org.eclipse.team.internal.ccvs.core.util.Assert;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.connection.Connection;
import org.eclipse.team.internal.ccvs.core.resources.api.IManagedFile;
import org.eclipse.team.internal.ccvs.core.resources.api.IManagedFolder;
/**
* Reacts on the "Copy-file"-Response of the server.
* Just copies the file as suggested by the server.<br>
* NOTE: The handler acctually copies the file, what does not
* seem to cause a problem, because it is only used for
* making copies for security on a merge.
*/
class CopyHandler extends ResponseHandler {
/**
* @see IResponseHandler#getName()
*/
public String getName() {
return "Copy-file";
}
/**
* @see IResponseHandler#handle(Connection, PrintStream, IManagedFolder)
*/
public void handle(
Connection connection,
PrintStream messageOutput,
IManagedFolder mRoot)
throws CVSException {
String fileName;
IManagedFolder mParent;
IManagedFile mFile;
IManagedFile mNewFile;
// Read the info associated with the Updated response
String localDirectory = connection.readLine();
String repositoryFilename = connection.readLine();
String newFilename = connection.readLine();
// Get the local file
fileName = repositoryFilename.substring(repositoryFilename.lastIndexOf("/") + 1);
mParent = mRoot.getFolder(localDirectory);
mFile = mParent.getFile(fileName);
Assert.isTrue(mParent.exists() && mParent.isCVSFolder());
Assert.isTrue(mFile.exists() && mFile.isManaged());
// Move the file to newFile (we know we do not need the
// original any more anyway)
mNewFile = mParent.getFile(newFilename);
mFile.moveTo(mNewFile);
}
}
|