Search in sources :

Example 31 with HgRepository

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

the class HgShowUnAppliedPatchesAction method update.

@Override
public void update(AnActionEvent e) {
    HgRepository repository = HgActionUtil.getSelectedRepositoryFromEvent(e);
    e.getPresentation().setEnabledAndVisible(repository != null);
}
Also used : HgRepository(org.zmlx.hg4idea.repo.HgRepository)

Example 32 with HgRepository

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

the class HgBranchPopup method createRepositoriesActions.

@NotNull
protected DefaultActionGroup createRepositoriesActions() {
    DefaultActionGroup popupGroup = new DefaultActionGroup(null, false);
    popupGroup.addSeparator("Repositories");
    for (HgRepository repository : DvcsUtil.sortRepositories(myRepositoryManager.getRepositories())) {
        popupGroup.add(new RootAction<>(repository, highlightCurrentRepo() ? myCurrentRepository : null, new HgBranchPopupActions(repository.getProject(), repository).createActions(), HgUtil.getDisplayableBranchOrBookmarkText(repository)));
    }
    return popupGroup;
}
Also used : HgRepository(org.zmlx.hg4idea.repo.HgRepository) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) NotNull(org.jetbrains.annotations.NotNull)

Example 33 with HgRepository

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

the class HgMerge method execute.

@Override
public void execute(@NotNull final Project project, @NotNull final Collection<HgRepository> repos, @Nullable final HgRepository selectedRepo) {
    final HgMergeDialog mergeDialog = new HgMergeDialog(project, repos, selectedRepo);
    if (mergeDialog.showAndGet()) {
        final String targetValue = StringUtil.escapeBackSlashes(mergeDialog.getTargetValue());
        final HgRepository repo = mergeDialog.getRepository();
        HgMergeCommand.mergeWith(repo, targetValue, UpdatedFiles.create());
    }
}
Also used : HgRepository(org.zmlx.hg4idea.repo.HgRepository) HgMergeDialog(org.zmlx.hg4idea.ui.HgMergeDialog)

Example 34 with HgRepository

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

the class HgPullAction method execute.

@Override
protected void execute(@NotNull final Project project, @NotNull Collection<HgRepository> repos, @Nullable HgRepository selectedRepo) {
    final HgPullDialog dialog = new HgPullDialog(project, repos, selectedRepo);
    if (dialog.showAndGet()) {
        final String source = dialog.getSource();
        final HgRepository hgRepository = dialog.getRepository();
        new Task.Backgroundable(project, "Pulling changes from " + source, false) {

            @Override
            public void run(@NotNull ProgressIndicator indicator) {
                executePull(project, hgRepository, source);
                HgErrorUtil.markDirtyAndHandleErrors(project, hgRepository.getRoot());
            }
        }.queue();
    }
}
Also used : Task(com.intellij.openapi.progress.Task) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) HgRepository(org.zmlx.hg4idea.repo.HgRepository) HgPullDialog(org.zmlx.hg4idea.ui.HgPullDialog)

Example 35 with HgRepository

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

the class HgCommitTest method testAmendCommit.

public void testAmendCommit() throws HgCommandException, VcsException {
    String changedCommit = "anotherCommit";
    HgLogCommand logCommand = new HgLogCommand(myProject);
    logCommand.setLogFile(false);
    HgFile hgFile = new HgFile(myRepository, VfsUtilCore.virtualToIoFile(myRepository));
    List<HgFileRevision> revisions = logCommand.execute(hgFile, -1, false);
    HgRepository hgRepo = HgRepositoryImpl.getInstance(myRepository, myProject, myProject);
    HgCommitCommand commit = new HgCommitCommand(myProject, hgRepo, changedCommit, true);
    commit.executeInCurrentThread();
    List<HgFileRevision> revisionsAfterAmendCommit = logCommand.execute(hgFile, -1, false);
    assertTrue(revisions.size() == revisionsAfterAmendCommit.size());
    assertEquals(revisionsAfterAmendCommit.get(0).getCommitMessage(), changedCommit);
}
Also used : HgFile(org.zmlx.hg4idea.HgFile) HgCommitCommand(org.zmlx.hg4idea.command.HgCommitCommand) HgFileRevision(org.zmlx.hg4idea.HgFileRevision) HgRepository(org.zmlx.hg4idea.repo.HgRepository) HgLogCommand(org.zmlx.hg4idea.command.HgLogCommand)

Aggregations

HgRepository (org.zmlx.hg4idea.repo.HgRepository)36 NotNull (org.jetbrains.annotations.NotNull)11 VirtualFile (com.intellij.openapi.vfs.VirtualFile)10 Project (com.intellij.openapi.project.Project)7 VcsException (com.intellij.openapi.vcs.VcsException)5 FilePath (com.intellij.openapi.vcs.FilePath)4 HgCommitCommand (org.zmlx.hg4idea.command.HgCommitCommand)4 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)3 File (java.io.File)3 HgFile (org.zmlx.hg4idea.HgFile)3 HgCommandException (org.zmlx.hg4idea.execution.HgCommandException)3 Task (com.intellij.openapi.progress.Task)2 AbstractVcsVirtualFile (com.intellij.openapi.vcs.vfs.AbstractVcsVirtualFile)2 VcsVirtualFile (com.intellij.openapi.vcs.vfs.VcsVirtualFile)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Nullable (org.jetbrains.annotations.Nullable)2 HgFileRevision (org.zmlx.hg4idea.HgFileRevision)2 HgNameWithHashInfo (org.zmlx.hg4idea.HgNameWithHashInfo)2 HgLogCommand (org.zmlx.hg4idea.command.HgLogCommand)2