use of org.zmlx.hg4idea.command.HgResolveStatusEnum 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);
}
});
}
use of org.zmlx.hg4idea.command.HgResolveStatusEnum in project intellij-community by JetBrains.
the class HgConflictResolver method resolve.
public void resolve(final VirtualFile repo) {
final Map<HgFile, HgResolveStatusEnum> resolves = new HgResolveCommand(myProject).getListSynchronously(repo);
final List<File> conflictFiles = new ArrayList<>();
for (HgFile hgFile : resolves.keySet()) {
File file = hgFile.getFile();
if (resolves.get(hgFile) == HgResolveStatusEnum.UNRESOLVED) {
conflictFiles.add(file);
updateUpdatedFiles(file, true);
} else {
updateUpdatedFiles(file, false);
}
}
if (conflictFiles.isEmpty())
return;
final HgVcs vcs = HgVcs.getInstance(myProject);
if (vcs == null)
return;
final List<VirtualFile> conflicts = sortVirtualFilesByPresentation(findVirtualFilesWithRefresh(conflictFiles));
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
public void run() {
AbstractVcsHelper.getInstance(myProject).showMergeDialog(conflicts, vcs.getMergeProvider());
}
});
}
use of org.zmlx.hg4idea.command.HgResolveStatusEnum in project intellij-community by JetBrains.
the class HgChangeProvider method process.
private Collection<HgChange> process(ChangelistBuilder builder, Collection<FilePath> files) {
final Set<HgChange> hgChanges = new HashSet<>();
for (Map.Entry<VirtualFile, Collection<FilePath>> entry : HgUtil.groupFilePathsByHgRoots(myProject, files).entrySet()) {
VirtualFile repo = entry.getKey();
final HgRevisionNumber workingRevision = new HgWorkingCopyRevisionsCommand(myProject).identify(repo).getFirst();
final HgRevisionNumber parentRevision = new HgWorkingCopyRevisionsCommand(myProject).firstParent(repo);
final Map<HgFile, HgResolveStatusEnum> list = new HgResolveCommand(myProject).getListSynchronously(repo);
hgChanges.addAll(new HgStatusCommand.Builder(true).ignored(false).build(myProject).executeInCurrentThread(repo, entry.getValue()));
final HgRepository hgRepo = HgUtil.getRepositoryForFile(myProject, repo);
if (hgRepo != null && hgRepo.hasSubrepos()) {
hgChanges.addAll(ContainerUtil.mapNotNull(hgRepo.getSubrepos(), info -> findChange(hgRepo, info)));
}
sendChanges(builder, hgChanges, list, workingRevision, parentRevision);
}
return hgChanges;
}
Aggregations