Search in sources :

Example 6 with HgRepositoryManager

use of org.zmlx.hg4idea.repo.HgRepositoryManager in project intellij-community by JetBrains.

the class HgTagCreateCommand method executeAsynchronously.

public void executeAsynchronously(HgCommandResultHandler resultHandler) throws HgCommandException {
    if (StringUtil.isEmptyOrSpaces(tagName)) {
        throw new HgCommandException("tag name is empty");
    }
    List<String> arguments = new ArrayList<>();
    arguments.add(tagName);
    if (!StringUtil.isEmptyOrSpaces(revisionNumberOrHash)) {
        arguments.add("--rev");
        arguments.add(revisionNumberOrHash);
    }
    new HgCommandExecutor(project).execute(repo, "tag", arguments, resultHandler);
    if (!project.isDisposed()) {
        HgRepositoryManager manager = HgUtil.getRepositoryManager(project);
        manager.updateRepository(repo);
    }
}
Also used : HgCommandExecutor(org.zmlx.hg4idea.execution.HgCommandExecutor) HgRepositoryManager(org.zmlx.hg4idea.repo.HgRepositoryManager) ArrayList(java.util.ArrayList) HgCommandException(org.zmlx.hg4idea.execution.HgCommandException)

Example 7 with HgRepositoryManager

use of org.zmlx.hg4idea.repo.HgRepositoryManager in project intellij-community by JetBrains.

the class HgUtil method groupFilePathsByHgRoots.

@NotNull
public static Map<VirtualFile, Collection<FilePath>> groupFilePathsByHgRoots(@NotNull Project project, @NotNull Collection<FilePath> files) {
    Map<VirtualFile, Collection<FilePath>> sorted = new HashMap<>();
    if (project.isDisposed())
        return sorted;
    HgRepositoryManager repositoryManager = getRepositoryManager(project);
    for (FilePath file : files) {
        HgRepository repo = repositoryManager.getRepositoryForFile(file);
        if (repo == null) {
            continue;
        }
        Collection<FilePath> filesForRoot = sorted.get(repo.getRoot());
        if (filesForRoot == null) {
            filesForRoot = new HashSet<>();
            sorted.put(repo.getRoot(), filesForRoot);
        }
        filesForRoot.add(file);
    }
    return sorted;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) VcsVirtualFile(com.intellij.openapi.vcs.vfs.VcsVirtualFile) AbstractVcsVirtualFile(com.intellij.openapi.vcs.vfs.AbstractVcsVirtualFile) FilePath(com.intellij.openapi.vcs.FilePath) HgRepositoryManager(org.zmlx.hg4idea.repo.HgRepositoryManager) HgRepository(org.zmlx.hg4idea.repo.HgRepository) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

HgRepositoryManager (org.zmlx.hg4idea.repo.HgRepositoryManager)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 AbstractVcsVirtualFile (com.intellij.openapi.vcs.vfs.AbstractVcsVirtualFile)3 VcsVirtualFile (com.intellij.openapi.vcs.vfs.VcsVirtualFile)3 HgRepository (org.zmlx.hg4idea.repo.HgRepository)3 DataContext (com.intellij.openapi.actionSystem.DataContext)2 Project (com.intellij.openapi.project.Project)2 NotNull (org.jetbrains.annotations.NotNull)2 Nullable (org.jetbrains.annotations.Nullable)2 AnAction (com.intellij.openapi.actionSystem.AnAction)1 Condition (com.intellij.openapi.util.Condition)1 FilePath (com.intellij.openapi.vcs.FilePath)1 ArrayList (java.util.ArrayList)1 CalledInAwt (org.jetbrains.annotations.CalledInAwt)1 HgProjectSettings (org.zmlx.hg4idea.HgProjectSettings)1 HgCommandException (org.zmlx.hg4idea.execution.HgCommandException)1 HgCommandExecutor (org.zmlx.hg4idea.execution.HgCommandExecutor)1