-
Notifications
You must be signed in to change notification settings - Fork 5.2k
/
SvnAddTest.java
75 lines (67 loc) · 2.42 KB
/
SvnAddTest.java
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
68
69
70
71
72
73
74
75
package org.jetbrains.idea.svn16;
import com.intellij.execution.process.ProcessOutput;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.vcs.VcsConfiguration;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.idea.svn.SvnVcs;
import org.junit.Assert;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @author yole
*/
public class SvnAddTest extends SvnTestCase {
@Test
public void testCopy() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile file = createFileInCommand("a.txt", "old content");
checkin();
copyFileInCommand(file, "b.txt");
verify(runSvn("status"), "A + b.txt");
}
// IDEADEV-16268
@Test
public void testDirAndFileInCommand() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
new WriteCommandAction.Simple(myProject) {
@Override
public void run() {
try {
VirtualFile dir = myWorkingCopyDir.createChildDirectory(this, "child");
dir.createChildData(this, "a.txt");
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
}.execute();
final ProcessOutput result = runSvn("status");
verify(result, "A child", "A child" + File.separatorChar + "a.txt");
}
// IDEADEV-19308
@Test
public void testDirAfterFile() throws Exception {
disableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile dir = createDirInCommand(myWorkingCopyDir, "dir");
final VirtualFile file = createFileInCommand(dir, "a.txt", "content");
final List<VirtualFile> files = new ArrayList<VirtualFile>();
files.add(file);
files.add(dir);
final List<VcsException> errors = SvnVcs.getInstance(myProject).getCheckinEnvironment().scheduleUnversionedFilesForAddition(files);
Assert.assertEquals(0, errors.size());
}
@Test
public void testUndoAdd() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
createFileInCommand("a.txt", "old content");
checkin();
undo();
verify(runSvn("status"), "D a.txt");
Assert.assertFalse(new File(myWorkingCopyDir.getPath(), "a.txt").exists());
}
}