use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.
the class HgHistoryTest method testFileNameInTargetRevisionAfterRename.
public void testFileNameInTargetRevisionAfterRename() throws HgCommandException {
cd(myRepository);
int namesSize = names.length;
VirtualFile subDir = myRepository.findFileByRelativePath(subDirName);
assert subDir != null;
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);
logCommand.setFollowCopies(true);
List<HgFileRevision> revisions = logCommand.execute(hgFile, -1, true);
for (int i = 0; i < revisions.size(); ++i) {
HgFile expectedFile = new HgFile(myRepository, new File(subDir.getPath(), names[namesSize - i - 1]));
HgFile targetFileName = HgUtil.getFileNameInTargetRevision(myProject, revisions.get(i).getRevisionNumber(), hgFile);
assertEquals(expectedFile.getRelativePath(), targetFileName.getRelativePath());
}
}
use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.
the class HgHistoryTest method testFileNameInTargetRevisionAfterUpdate.
public void testFileNameInTargetRevisionAfterUpdate() throws HgCommandException {
cd(myRepository);
//update to parent revision
hg("update -r .^");
//update filenames size which is in use
int namesSize = names.length - 1;
//find file with parent revision name
VirtualFile subDir = myRepository.findFileByRelativePath(subDirName);
assert subDir != null;
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);
logCommand.setFollowCopies(true);
List<HgFileRevision> revisions = logCommand.execute(hgFile, -1, true);
for (int i = 0; i < revisions.size(); ++i) {
HgFile expectedFile = new HgFile(myRepository, new File(subDir.getPath(), names[namesSize - i - 1]));
HgFile targetFileName = HgUtil.getFileNameInTargetRevision(myProject, revisions.get(i).getRevisionNumber(), hgFile);
assertEquals(expectedFile.getRelativePath(), targetFileName.getRelativePath());
}
}
use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.
the class HgHistoryTest method testFileNameInTargetRevisionFromAffectedFiles.
public void testFileNameInTargetRevisionFromAffectedFiles() throws HgCommandException {
cd(myRepository);
int namesSize = names.length;
VirtualFile subDir = myRepository.findFileByRelativePath(subDirName);
assert subDir != null;
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);
for (int i = 0; i < namesSize; ++i) {
HgFile hgFile = new HgFile(myRepository, new File(subDir.getPath(), names[namesSize - i - 1]));
HgFile targetFileName = HgUtil.getFileNameInTargetRevision(myProject, revisions.get(i).getRevisionNumber(), hgFile);
assertEquals(hgFile.getRelativePath(), targetFileName.getRelativePath());
}
}
use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.
the class HgPullDialog method onChangeRepository.
private void onChangeRepository() {
final VirtualFile repo = hgRepositorySelector.getRepository().getRoot();
final String defaultPath = HgUtil.getRepositoryDefaultPath(project, repo);
if (!StringUtil.isEmptyOrSpaces(defaultPath)) {
addPathsFromHgrc(repo);
myRepositoryURL.setText(HgUtil.removePasswordIfNeeded(defaultPath));
myCurrentRepositoryUrl = defaultPath;
onChangePullSource();
}
}
use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.
the class HgRunConflictResolverDialog method onChangeRepository.
private void onChangeRepository() {
VirtualFile repo = repositorySelector.getRepository().getRoot();
HgResolveCommand command = new HgResolveCommand(project);
final ModalityState modalityState = ApplicationManager.getApplication().getModalityStateForComponent(getRootPane());
command.getListAsynchronously(repo, new Consumer<Map<HgFile, HgResolveStatusEnum>>() {
@Override
public void consume(Map<HgFile, HgResolveStatusEnum> status) {
final DefaultListModel model = new DefaultListModel();
for (Map.Entry<HgFile, HgResolveStatusEnum> entry : status.entrySet()) {
if (entry.getValue() == HgResolveStatusEnum.UNRESOLVED) {
model.addElement(entry.getKey().getRelativePath());
}
}
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
setOKActionEnabled(!model.isEmpty());
if (model.isEmpty()) {
model.addElement("No conflicts to resolve");
}
conflictsList.setModel(model);
}
}, modalityState);
}
});
}
Aggregations