mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs]: cleanUp and fix tests
This commit is contained in:
+3
-1
@@ -23,11 +23,13 @@ import java.nio.charset.Charset;
|
||||
|
||||
public class DirectoryHistoryDialogPatchCreationTest extends PatchingTestCase {
|
||||
public void testPatchCreation() throws Exception {
|
||||
|
||||
DirectoryHistoryDialogModel m = new DirectoryHistoryDialogModel(myProject, myGateway, getVcs(), myRoot);
|
||||
m.clearRevisions();
|
||||
createChildDataWithContent(myRoot, "f1.txt");
|
||||
createChildDataWithContent(myRoot, "f2.txt");
|
||||
createChildDataWithContent(myRoot, "f3.txt");
|
||||
|
||||
DirectoryHistoryDialogModel m = new DirectoryHistoryDialogModel(myProject, myGateway, getVcs(), myRoot);
|
||||
assertSize(6, m.getRevisions());
|
||||
|
||||
m.selectRevisions(0, 5);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package hg4idea.test.history;
|
||||
|
||||
import com.intellij.openapi.vcs.FilePath;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.vcsUtil.VcsUtil;
|
||||
@@ -63,7 +64,7 @@ public class HgHistoryTest extends HgPlatformTest {
|
||||
int namesSize = names.length;
|
||||
VirtualFile subDir = myRepository.findFileByRelativePath(subDirName);
|
||||
assert subDir != null;
|
||||
VirtualFile vFile = subDir.findFileByRelativePath(names[namesSize - 1]);
|
||||
VirtualFile vFile = VfsUtil.findFileByIoFile(new File(subDir.getPath(),names[namesSize - 1]), true);
|
||||
assert vFile != null;
|
||||
HgFile hgFile = new HgFile(myRepository, VfsUtilCore.virtualToIoFile(vFile));
|
||||
HgLogCommand logCommand = new HgLogCommand(myProject);
|
||||
@@ -86,7 +87,7 @@ public class HgHistoryTest extends HgPlatformTest {
|
||||
//find file with parent revision name
|
||||
VirtualFile subDir = myRepository.findFileByRelativePath(subDirName);
|
||||
assert subDir != null;
|
||||
VirtualFile vFile = subDir.findFileByRelativePath(names[namesSize - 1]);
|
||||
VirtualFile vFile = VfsUtil.findFileByIoFile(new File(subDir.getPath(),names[namesSize - 1]), true);
|
||||
assert vFile != null;
|
||||
HgFile hgFile = new HgFile(myRepository, VfsUtilCore.virtualToIoFile(vFile));
|
||||
HgLogCommand logCommand = new HgLogCommand(myProject);
|
||||
@@ -105,9 +106,9 @@ public class HgHistoryTest extends HgPlatformTest {
|
||||
int namesSize = names.length;
|
||||
VirtualFile subDir = myRepository.findFileByRelativePath(subDirName);
|
||||
assert subDir != null;
|
||||
VirtualFile currentVirtualFile = subDir.findFileByRelativePath(names[namesSize - 1]);
|
||||
assert currentVirtualFile != null;
|
||||
HgFile localFile = new HgFile(myRepository, VfsUtilCore.virtualToIoFile(currentVirtualFile));
|
||||
VirtualFile vFile = VfsUtil.findFileByIoFile(new File(subDir.getPath(), names[namesSize - 1]), true);
|
||||
assert vFile != null;
|
||||
HgFile localFile = new HgFile(myRepository, VfsUtilCore.virtualToIoFile(vFile));
|
||||
HgLogCommand logCommand = new HgLogCommand(myProject);
|
||||
logCommand.setFollowCopies(true);
|
||||
List<HgFileRevision> revisions = logCommand.execute(localFile, -1, true);
|
||||
@@ -126,7 +127,7 @@ public class HgHistoryTest extends HgPlatformTest {
|
||||
cd(subDir);
|
||||
int namesSize = names.length;
|
||||
String beforeName = names[namesSize - 1];
|
||||
VirtualFile before = subDir.findFileByRelativePath(beforeName);
|
||||
VirtualFile before = VfsUtil.findFileByIoFile(new File(subDir.getPath(), beforeName), true);
|
||||
assert before != null;
|
||||
FilePath filePath = VcsUtil.getFilePath(VfsUtilCore.virtualToIoFile(before));
|
||||
final String renamed = "renamed";
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vcs.merge.MergeData;
|
||||
import com.intellij.openapi.vcs.merge.MergeProvider;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.EdtTestUtil;
|
||||
import hg4idea.test.HgPlatformTest;
|
||||
@@ -94,7 +95,7 @@ public class HgMergeProviderTest extends HgPlatformTest {
|
||||
hg("commit -m " + COMMIT_MESSAGE);
|
||||
updateProject();
|
||||
//committing conflicting change
|
||||
verifyMergeData(myChildRepo.findChild(childFile.getName()), "basic", "local", "server");
|
||||
verifyMergeData(childFile, "basic", "local", "server");
|
||||
}
|
||||
|
||||
public void testMergeWithUncommittedLocalChange() throws Exception {
|
||||
@@ -112,7 +113,7 @@ public class HgMergeProviderTest extends HgPlatformTest {
|
||||
HgTestUtil.printToFile(childFile, "local");
|
||||
updateProject();
|
||||
//uncommitted conflicting change
|
||||
verifyMergeData(myChildRepo.findChild(childFile.getName()), "basic", "local", "server");
|
||||
verifyMergeData(childFile, "basic", "local", "server");
|
||||
}
|
||||
|
||||
public void testFileAddedAndCommitted() throws Exception {
|
||||
@@ -129,6 +130,7 @@ public class HgMergeProviderTest extends HgPlatformTest {
|
||||
//Add a file with the same name, but different content in child repository, commit.
|
||||
cd(myChildRepo);
|
||||
touch(bFile, "local");
|
||||
myChildRepo.refresh(false, true);
|
||||
hg("add " + bFile);
|
||||
hg("commit -m " + COMMIT_MESSAGE);
|
||||
|
||||
@@ -193,6 +195,6 @@ public class HgMergeProviderTest extends HgPlatformTest {
|
||||
}
|
||||
|
||||
private static void assertEquals(String s, byte[] bytes) {
|
||||
Assert.assertEquals(s, new String(bytes));
|
||||
Assert.assertEquals(s, new String(bytes, CharsetToolkit.UTF8_CHARSET));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user