mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
HgConfig tests added; static getRepositoryNamedConfig method added to Util class
This commit is contained in:
@@ -567,4 +567,10 @@ public abstract class HgUtil {
|
||||
HgRepository hgRepository = getRepositoryManager(project).getRepositoryForRoot(root);
|
||||
return hgRepository != null ? hgRepository.getRepositoryConfig().getDefaultPushPath() : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getRepositoryNamedConfig(@NotNull Project project, @NotNull VirtualFile root, @Nullable String configName) {
|
||||
HgRepository hgRepository = getRepositoryManager(project).getRepositoryForRoot(root);
|
||||
return hgRepository != null ? hgRepository.getRepositoryConfig().getNamedConfig(configName) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package hg4idea.test.config;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import hg4idea.test.HgPlatformTest;
|
||||
import org.zmlx.hg4idea.repo.HgRepository;
|
||||
import org.zmlx.hg4idea.util.HgUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static com.intellij.dvcs.test.Executor.cd;
|
||||
|
||||
/**
|
||||
* @author Nadya Zabrodina
|
||||
*/
|
||||
public class HgConfigTest extends HgPlatformTest {
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
prepareSecondRepository();
|
||||
}
|
||||
|
||||
public void testDefaultPathInClonedRepo() {
|
||||
cd(myChildRepo);
|
||||
assertEquals(myRepository.getCanonicalPath(), HgUtil.getRepositoryDefaultPath(myProject, myChildRepo));
|
||||
}
|
||||
|
||||
public void testLargeExtensionInClonedRepo() {
|
||||
cd(myChildRepo);
|
||||
File hgrc = new File(new File(myChildRepo.getPath(), ".hg"), "hgrc");
|
||||
assert hgrc.exists();
|
||||
try {
|
||||
FileUtil.appendToFile(hgrc, "\n[extensions]\n" +
|
||||
"largefiles =");
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
fail("Can not update hgrc file.");
|
||||
}
|
||||
HgRepository hgRepository = HgUtil.getRepositoryManager(myProject).getRepositoryForRoot(myChildRepo);
|
||||
assertNotNull(hgRepository);
|
||||
hgRepository.getRepositoryConfig().update(myProject, null);
|
||||
assertNotNull(HgUtil.getRepositoryNamedConfig(myProject, myChildRepo, "extensions.largefiles"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user