use of org.zmlx.hg4idea.command.HgWorkingCopyRevisionsCommand 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;
}
use of org.zmlx.hg4idea.command.HgWorkingCopyRevisionsCommand in project intellij-community by JetBrains.
the class HgDiffProvider method getLastRevision.
public ItemLatestState getLastRevision(FilePath filePath) {
VirtualFile vcsRoot = VcsUtil.getVcsRootFor(project, filePath);
if (vcsRoot == null) {
return null;
}
HgWorkingCopyRevisionsCommand command = new HgWorkingCopyRevisionsCommand(project);
HgRevisionNumber currentRevision = command.identify(vcsRoot).getFirst();
if (currentRevision == null) {
return null;
}
boolean fileExists = filePath.getIOFile().exists();
if (currentRevision.isWorkingVersion()) {
return new ItemLatestState(command.firstParent(vcsRoot), fileExists, true);
}
return new ItemLatestState(currentRevision, fileExists, true);
}
use of org.zmlx.hg4idea.command.HgWorkingCopyRevisionsCommand in project intellij-community by JetBrains.
the class HgDiffProvider method getCurrentRevision.
public VcsRevisionNumber getCurrentRevision(VirtualFile file) {
VirtualFile vcsRoot = VcsUtil.getVcsRootFor(project, file);
if (vcsRoot == null) {
return null;
}
FilePath filePath = ObjectsConvertor.VIRTUAL_FILEPATH.convert(file);
return new HgWorkingCopyRevisionsCommand(project).parents(vcsRoot, filePath).first;
}
Aggregations