Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
25,100 | List<String> (List<String> arguments, int port) { List<String> cmdArguments = new ArrayList<>(); cmdArguments.add("--config"); cmdArguments.add("extensions.hg4ideapromptextension=" + myVcs.getPromptHooksExtensionFile().getAbsolutePath()); cmdArguments.add("--config"); cmdArguments.add("hg4ideapass.port=" + port); if (arguments != null && arguments.size() != 0) { cmdArguments.addAll(arguments); } return cmdArguments; } | prepareArguments |
25,101 | void (@NotNull String operation, @Nullable List<String> arguments) { //do not log arguments for remote command because of internal password port info etc super.logCommand(operation, null); } | logCommand |
25,102 | void () { if (myAuthenticator == null) return; myAuthenticator.forgetPassword(); } | forgetPassword |
25,103 | void () { if (myGetPassword == null) return; // prompt was not suggested; String url = VirtualFileManager.extractPath(myGetPassword.getURL()); PasswordSafe.getInstance().set(createCredentialAttributes(url), null); } | forgetPassword |
25,104 | boolean (Project project, @NotNull String proposedLogin, @NotNull String uri, @NotNull String path, @Nullable ModalityState state) { GetPasswordRunnable runnable = new GetPasswordRunnable(project, proposedLogin, uri, path, myForceAuthorization, mySilentMode); ApplicationManager.getApplication().invokeAndWait(runnable, state == null ? ModalityState.defaultModalityState() : state); myGetPassword = runnable; return runnable.isOk(); } | promptForAuthentication |
25,105 | String () { return myGetPassword.getUserName(); } | getUserName |
25,106 | String () { return myGetPassword.getPassword(); } | getPassword |
25,107 | void () { // find if we've already been here final HgVcs vcs = HgVcs.getInstance(myProject); if (vcs == null) { return; } final @NotNull HgGlobalSettings hgGlobalSettings = HgGlobalSettings.getInstance(); @Nullable String rememberedLoginsForUrl = null; String url = VirtualFileManager.extractPath(myURL); if (!StringUtil.isEmptyOrSpaces(myURL)) { rememberedLoginsForUrl = hgGlobalSettings.getRememberedUserName(url); } String login = myProposedLogin; if (StringUtil.isEmptyOrSpaces(login)) { // find the last used login login = rememberedLoginsForUrl; } Credentials savedCredentials = PasswordSafe.getInstance().get(createCredentialAttributes(url)); String password = savedCredentials == null ? null : savedCredentials.getPasswordAsString(); if (savedCredentials != null && StringUtil.isEmptyOrSpaces(login)) { login = savedCredentials.getUserName(); } // don't show dialog if we don't have to (both fields are known) except force authorization required if (!myForceAuthorization && !StringUtil.isEmptyOrSpaces(password) && !StringUtil.isEmptyOrSpaces(login)) { myCredentials = new Credentials(login, password); ok = true; return; } if (mySilent) { ok = false; return; } final AuthDialog dialog = new AuthDialog(myProject, HgBundle.message("hg4idea.dialog.login.password.required"), HgBundle.message("hg4idea.dialog.login.description", myURL), login, password, true); if (dialog.showAndGet()) { ok = true; Credentials credentials = new Credentials(dialog.getUsername(), dialog.getPassword()); myCredentials = credentials; PasswordSafe.getInstance().set(createCredentialAttributes(url), credentials, !dialog.isRememberPassword()); hgGlobalSettings.addRememberedUrl(url, credentials.getUserName()); } } | run |
25,108 | String () { return myCredentials.getUserName(); } | getUserName |
25,109 | String () { return myCredentials == null ? null : myCredentials.getPasswordAsString(); } | getPassword |
25,110 | boolean () { return ok; } | isOk |
25,111 | String () { return myURL; } | getURL |
25,112 | CredentialAttributes (@NotNull String url) { return new CredentialAttributes(CredentialAttributesKt.generateServiceName("HG", url), null); } | createCredentialAttributes |
25,113 | void (@Nullable HgCommandResult result) { } | process |
25,114 | void (@Nullable Charset charset) { if (charset != null) { myCharset = charset; } } | setCharset |
25,115 | void (boolean isSilent) { myIsSilent = isSilent; } | setSilent |
25,116 | void (boolean showOutput) { myShowOutput = showOutput; } | setShowOutput |
25,117 | void (boolean isBinary) { myIsBinary = isBinary; } | setBinary |
25,118 | void (boolean outputAlwaysSuppressed) { myOutputAlwaysSuppressed = outputAlwaysSuppressed; } | setOutputAlwaysSuppressed |
25,119 | HgCommandResult (@Nullable final VirtualFile repo, @NotNull final @NonNls String operation, @Nullable final List<@NonNls String> arguments) { return executeInCurrentThread(repo, operation, arguments, false); } | executeInCurrentThread |
25,120 | HgCommandResult (@Nullable VirtualFile repo, @NotNull @NonNls String operation, @Nullable List<@NonNls String> arguments, boolean ignoreDefaultOptions) { ShellCommand.CommandResultCollector collector = new ShellCommand.CommandResultCollector(myIsBinary); boolean success = executeInCurrentThread(repo, operation, arguments, ignoreDefaultOptions, collector); return success ? collector.getResult() : null; } | executeInCurrentThread |
25,121 | boolean (@Nullable VirtualFile repo, @NotNull @NonNls String operation, @Nullable List<@NonNls String> arguments, boolean ignoreDefaultOptions, @NotNull HgLineProcessListener listener) { boolean success = executeInCurrentThreadAndLog(repo, operation, arguments, ignoreDefaultOptions, listener); List<String> errors = StringUtil.split(listener.getErrorOutput().toString(), System.lineSeparator()); if (success && HgErrorUtil.isUnknownEncodingError(errors)) { setCharset(StandardCharsets.UTF_8); return executeInCurrentThreadAndLog(repo, operation, arguments, ignoreDefaultOptions, listener); } return success; } | executeInCurrentThread |
25,122 | boolean (@Nullable VirtualFile repo, @NotNull @NonNls String operation, @Nullable List<@NonNls String> arguments, boolean ignoreDefaultOptions, @NotNull HgLineProcessListener listener) { if (myProject == null || myProject.isDisposed() || myVcs == null) return false; if (!myProject.isDefault() && !TrustedProjects.isTrusted(myProject)) { throw new IllegalStateException("Shouldn't be possible to run a Hg command in the safe mode"); } ShellCommand shellCommand = createShellCommandWithArgs(repo, operation, arguments, ignoreDefaultOptions); try { long startTime = System.currentTimeMillis(); LOG.debug(String.format("hg %s started", operation)); shellCommand.execute(myShowOutput, myIsBinary, listener); LOG.debug(String.format("hg %s finished. Took %s ms", operation, System.currentTimeMillis() - startTime)); return true; } catch (ShellCommandException e) { processError(e); return false; } } | executeInCurrentThreadAndLog |
25,123 | void (@NotNull ShellCommandException e) { if (myVcs.getExecutableValidator().checkExecutableAndNotifyIfNeeded()) { // if the problem was not with invalid executable - show error. showError(e); LOG.info(e.getMessage(), e); } } | processError |
25,124 | ShellCommand (@Nullable VirtualFile repo, @NotNull @NonNls String operation, @Nullable List<@NonNls String> arguments, boolean ignoreDefaultOptions) { logCommand(operation, arguments); final List<String> cmdLine = new LinkedList<>(); cmdLine.add(HgExecutableManager.getInstance().getHgExecutable(myProject)); if (repo != null) { cmdLine.add("--repository"); cmdLine.add(repo.getPath()); } if (!ignoreDefaultOptions) { cmdLine.addAll(DEFAULT_OPTIONS); } cmdLine.add(operation); if (arguments != null && arguments.size() != 0) { cmdLine.addAll(arguments); } if (HgVcs.HGENCODING == null) { cmdLine.add("--encoding"); cmdLine.add(HgEncodingUtil.getNameFor(myCharset)); } String workingDir = repo != null ? repo.getPath() : null; return new ShellCommand(cmdLine, workingDir, myCharset); } | createShellCommandWithArgs |
25,125 | void (@NotNull String operation, @Nullable List<String> arguments) { if (myProject.isDisposed()) { return; } String exeName = HgExecutableManager.getInstance().getHgExecutable(myProject); final int lastSlashIndex = exeName.lastIndexOf(File.separator); exeName = exeName.substring(lastSlashIndex + 1); @NonNls String str = String.format("%s %s %s", exeName, operation, arguments == null ? "" : StringUtil.escapeStringCharacters(StringUtil.join(arguments, " "))); //remove password from path before log final String cmdString = myDestination != null ? HgUtil.removePasswordIfNeeded(str) : str; // log command if (!myIsSilent) { LOG.info(cmdString); myVcs.showMessageInConsole(cmdString, ConsoleViewContentType.NORMAL_OUTPUT); } else { LOG.debug(cmdString); } } | logCommand |
25,126 | void (Exception e) { final HgVcs vcs = HgVcs.getInstance(myProject); if (vcs == null) return; String message = HgBundle.message("hg4idea.command.executor.error", HgExecutableManager.getInstance().getHgExecutable(myProject), e.getMessage()); VcsImplUtil.showErrorMessage(myProject, message, HgBundle.message("hg4idea.error")); } | showError |
25,127 | ActionUpdateThread () { return ActionUpdateThread.BGT; } | getActionUpdateThread |
25,128 | void (@NotNull AnActionEvent e) { Project project = e.getProject(); e.getPresentation().setEnabledAndVisible(project == null || project.isDefault() || TrustedProjects.isTrusted(project)); } | update |
25,129 | void (@NotNull AnActionEvent e) { myProject = notNull(e.getData(CommonDataKeys.PROJECT), ProjectManager.getInstance().getDefaultProject()); // provide window to select the root directory final HgInitDialog hgInitDialog = new HgInitDialog(myProject); if (!hgInitDialog.showAndGet()) { return; } final VirtualFile selectedRoot = hgInitDialog.getSelectedFolder(); if (selectedRoot == null) { return; } // check if the selected folder is not yet under mercurial and provide some options in that case final VirtualFile vcsRoot = HgUtil.getNearestHgRoot(selectedRoot); VirtualFile mapRoot = selectedRoot; boolean needToCreateRepo = false; if (vcsRoot != null) { final HgInitAlreadyUnderHgDialog dialog = new HgInitAlreadyUnderHgDialog(myProject, selectedRoot.getPresentableUrl(), vcsRoot.getPresentableUrl()); if (!dialog.showAndGet()) { return; } if (dialog.getAnswer() == HgInitAlreadyUnderHgDialog.Answer.USE_PARENT_REPO) { mapRoot = vcsRoot; } else if (dialog.getAnswer() == HgInitAlreadyUnderHgDialog.Answer.CREATE_REPO_HERE) { needToCreateRepo = true; } } else { // no parent repository => creating the repository here. needToCreateRepo = true; } boolean finalNeedToCreateRepo = needToCreateRepo; VirtualFile finalMapRoot = mapRoot; BackgroundTaskUtil.executeOnPooledThread(HgDisposable.getInstance(myProject), () -> { if (!finalNeedToCreateRepo || createRepository(requireNonNull(myProject), selectedRoot)) { updateDirectoryMappings(finalMapRoot); } }); } | actionPerformed |
25,130 | void (VirtualFile mapRoot) { if (myProject != null && (!myProject.isDefault()) && myProject.getBaseDir() != null && VfsUtilCore.isAncestor(myProject.getBaseDir(), mapRoot, false)) { mapRoot.refresh(false, false); final String path = mapRoot.equals(myProject.getBaseDir()) ? "" : mapRoot.getPath(); ProjectLevelVcsManager manager = ProjectLevelVcsManager.getInstance(myProject); manager.setDirectoryMappings(VcsUtil.addMapping(manager.getDirectoryMappings(), path, HgVcs.VCS_NAME)); } } | updateDirectoryMappings |
25,131 | boolean (@NotNull Project project, @NotNull final VirtualFile selectedRoot) { HgCommandResult result = new HgInitCommand(project).execute(selectedRoot.getPath()); if (!HgErrorUtil.hasErrorsInCommandExecution(result)) { VcsNotifier.getInstance(project) .notifySuccess(REPO_CREATED, HgBundle.message("hg4idea.init.created.notification.title"), HgBundle.message("hg4idea.init.created.notification.description", selectedRoot.getPresentableUrl())); return true; } else { new HgCommandResultNotifier(project.isDefault() ? null : project) .notifyError(REPO_CREATION_ERROR, result, HgBundle.message("hg4idea.init.error.title"), HgBundle.message("hg4idea.init.error.description", selectedRoot.getPresentableUrl())); return false; } } | createRepository |
25,132 | void (@NotNull HgRepository repository, @NotNull Hash commit) { String revisionHash = commit.asString(); new HgCreateTagAction().execute(repository.getProject(), Collections.singleton(repository), repository, revisionHash); } | actionPerformed |
25,133 | void (@NotNull final Project project, @NotNull Collection<HgRepository> repositories, @Nullable final HgRepository selectedRepo, @NotNull DataContext dataContext) { new Task.Backgroundable(project, HgBundle.message("action.hg4idea.Rebase.Continue.progress")) { @Override public void run(@NotNull ProgressIndicator indicator) { if (selectedRepo != null) { HgRebaseCommand rebaseCommand = new HgRebaseCommand(project, selectedRepo); HgCommandResult result = rebaseCommand.continueRebase(); if (HgErrorUtil.isAbort(result)) { new HgCommandResultNotifier(project).notifyError(REBASE_CONTINUE_ERROR, result, HgBundle.message("hg4idea.hg.error"), HgBundle.message("action.hg4idea.Rebase.Continue.error")); } HgUtil.markDirectoryDirty(project, selectedRepo.getRoot()); } } }.queue(); } | execute |
25,134 | void (@NotNull ProgressIndicator indicator) { if (selectedRepo != null) { HgRebaseCommand rebaseCommand = new HgRebaseCommand(project, selectedRepo); HgCommandResult result = rebaseCommand.continueRebase(); if (HgErrorUtil.isAbort(result)) { new HgCommandResultNotifier(project).notifyError(REBASE_CONTINUE_ERROR, result, HgBundle.message("hg4idea.hg.error"), HgBundle.message("action.hg4idea.Rebase.Continue.error")); } HgUtil.markDirectoryDirty(project, selectedRepo.getRoot()); } } | run |
25,135 | void (@NotNull final HgRepository repository, @NotNull Hash commit) { final Project project = repository.getProject(); final VirtualFile root = repository.getRoot(); FileDocumentManager.getInstance().saveAllDocuments(); HgUpdateCommand.updateRepoTo(project, root, commit.asString(), null); } | actionPerformed |
25,136 | void (@NotNull HgRepository repository, @NotNull Hash commit) { FileDocumentManager.getInstance().saveAllDocuments(); HgMergeCommand.mergeWith(repository, commit.asString(), UpdatedFiles.create()); } | actionPerformed |
25,137 | AbstractRepositoryManager<HgRepository> (@NotNull Project project) { return project.getService(HgRepositoryManager.class); } | getRepositoryManager |
25,138 | HgRepository (@NotNull Project project, @NotNull VirtualFile root) { return getRepositoryManager(project).getRepositoryForRootQuick(root); } | getRepositoryForRoot |
25,139 | void (@NotNull final HgRepository repository, @NotNull final Hash commit) { final Project project = repository.getProject(); FileDocumentManager.getInstance().saveAllDocuments(); String shortHash = commit.toShortString(); final String name = getNewBranchNameFromUser(repository, HgBundle.message("hg4idea.branch.create.from", shortHash)); if (name != null) { new Task.Backgroundable(project, HgBundle.message("hg4idea.progress.updatingTo", shortHash)) { @Override public void run(@NotNull ProgressIndicator indicator) { if (HgUpdateCommand.updateRepoToInCurrentThread(project, repository.getRoot(), commit.asString(), false)) { new HgBranchPopupActions.HgNewBranchAction(project, Collections.singletonList(repository), repository) .createNewBranchInCurrentThread(name); } } }.queue(); } } | actionPerformed |
25,140 | void (@NotNull ProgressIndicator indicator) { if (HgUpdateCommand.updateRepoToInCurrentThread(project, repository.getRoot(), commit.asString(), false)) { new HgBranchPopupActions.HgNewBranchAction(project, Collections.singletonList(repository), repository) .createNewBranchInCurrentThread(name); } } | run |
25,141 | boolean (@NotNull HgRepository repository) { final Map<String, LinkedHashSet<Hash>> branches = repository.getBranches(); if (branches.size() > 1) return false; final Hash currentRevisionHash = getCurrentHash(repository); final Collection<HgNameWithHashInfo> other_bookmarks = getOtherBookmarks(repository, currentRevisionHash); if (!other_bookmarks.isEmpty()) return false; // if only one heavy branch and no other bookmarks -> check that current revision is not "main" branch head return currentRevisionHash.equals(getHeavyBranchMainHash(repository, repository.getCurrentBranch())); } | nothingToCompare |
25,142 | Hash (@NotNull HgRepository repository) { final String currentRevision = repository.getCurrentRevision(); assert currentRevision != null : "Compare With Branch couldn't be performed for newly created repository"; return HashImpl.build(repository.getCurrentRevision()); } | getCurrentHash |
25,143 | List<HgNameWithHashInfo> (@NotNull HgRepository repository, @NotNull final Hash currentRevisionHash) { return ContainerUtil.filter(repository.getBookmarks(), info -> !info.getHash().equals(currentRevisionHash)); } | getOtherBookmarks |
25,144 | Hash (@NotNull HgRepository repository, @NotNull final String bookmarkName) { HgNameWithHashInfo bookmarkInfo = ContainerUtil.find(repository.getBookmarks(), info -> info.getName().equals(bookmarkName)); return bookmarkInfo != null ? bookmarkInfo.getHash() : null; } | findBookmarkHashByName |
25,145 | Hash (@NotNull HgRepository repository, @NotNull String branchName) { // null for new branch or not heavy ref final LinkedHashSet<Hash> branchHashes = repository.getBranches().get(branchName); return branchHashes != null ? Objects.requireNonNull(Iterables.getLast(branchHashes)) : null; } | getHeavyBranchMainHash |
25,146 | Hash (@NotNull HgRepository repository, @NotNull String branchToCompare) { Hash refHashToCompare = getHeavyBranchMainHash(repository, branchToCompare); return refHashToCompare != null ? refHashToCompare : findBookmarkHashByName(repository, branchToCompare); } | detectActiveHashByName |
25,147 | List<String> (@NotNull HgRepository repository) { final List<String> namesToCompare = new ArrayList<>(repository.getBranches().keySet()); final String currentBranchName = repository.getCurrentBranchName(); assert currentBranchName != null; final Hash currentHash = getCurrentHash(repository); if (currentHash.equals(getHeavyBranchMainHash(repository, currentBranchName))) { namesToCompare.remove(currentBranchName); } namesToCompare.addAll(HgUtil.getNamesWithoutHashes(getOtherBookmarks(repository, currentHash))); return namesToCompare; } | getBranchNamesExceptCurrent |
25,148 | HgRepositoryManager (@NotNull Project project) { return HgUtil.getRepositoryManager(project); } | getRepositoryManager |
25,149 | boolean (@NotNull HgRepository repository, @NotNull FilePath path, @NotNull HgRevisionNumber compareWithRevisionNumber) { HgStatusCommand statusCommand = new HgStatusCommand.Builder(true).ignored(false).unknown(false).copySource(!path.isDirectory()) .baseRevision(compareWithRevisionNumber).targetRevision(null).build(repository.getProject()); statusCommand.cleanFilesOption(true); return !statusCommand.executeInCurrentThread(repository.getRoot(), Collections.singleton(path)).isEmpty(); } | existInBranch |
25,150 | void (@NotNull final Project project, @NotNull Collection<HgRepository> repositories, @Nullable HgRepository selectedRepo, @NotNull DataContext dataContext) { final HgRepository repository = repositories.size() > 1 ? letUserSelectRepository(project, repositories, selectedRepo) : ContainerUtil.getFirstItem(repositories); if (repository != null) { new Task.Backgroundable(project, HgBundle.message("action.hg4idea.run.conflict.resolver.description")) { @Override public void run(@NotNull ProgressIndicator indicator) { new HgConflictResolver(project).resolve(repository.getRoot()); HgUtil.markDirectoryDirty(project, repository.getRoot()); } }.queue(); } } | execute |
25,151 | void (@NotNull ProgressIndicator indicator) { new HgConflictResolver(project).resolve(repository.getRoot()); HgUtil.markDirectoryDirty(project, repository.getRoot()); } | run |
25,152 | HgRepository (@NotNull Project project, @NotNull Collection<HgRepository> repositories, @Nullable HgRepository selectedRepo) { HgRunConflictResolverDialog dialog = new HgRunConflictResolverDialog(project, repositories, selectedRepo); return dialog.showAndGet() ? dialog.getRepository() : null; } | letUserSelectRepository |
25,153 | void (@NotNull final Project project, @NotNull Collection<HgRepository> repositories, @Nullable HgRepository selectedRepo, @Nullable final String reference) { final HgTagDialog dialog = new HgTagDialog(project, repositories, selectedRepo); if (dialog.showAndGet()) { try { new HgTagCreateCommand(project, dialog.getRepository(), dialog.getTagName(), reference).executeAsynchronously(new HgCommandResultHandler() { @Override public void process(@Nullable HgCommandResult result) { if (HgErrorUtil.hasErrorsInCommandExecution(result)) { new HgCommandResultNotifier(project) .notifyError(TAG_CREATION_ERROR, result, HgBundle.message("hg4idea.branch.creation.error"), HgBundle.message("action.hg4idea.CreateTag.error.msg", dialog.getTagName())); } } }); } catch (HgCommandException e) { HgErrorUtil.handleException(project, TAG_CREATION_FAILED, e); } } } | execute |
25,154 | void (@Nullable HgCommandResult result) { if (HgErrorUtil.hasErrorsInCommandExecution(result)) { new HgCommandResultNotifier(project) .notifyError(TAG_CREATION_ERROR, result, HgBundle.message("hg4idea.branch.creation.error"), HgBundle.message("action.hg4idea.CreateTag.error.msg", dialog.getTagName())); } } | process |
25,155 | void (@NotNull final Project project, @NotNull Collection<HgRepository> repositories, @Nullable HgRepository selectedRepo, @NotNull DataContext dataContext) { execute(project, repositories, selectedRepo, ""); } | execute |
25,156 | void (@NotNull final Project project, @NotNull final Collection<HgRepository> repos, @Nullable final HgRepository selectedRepo, @NotNull DataContext dataContext) { 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()); } } | execute |
25,157 | void (@NotNull Project project, @NotNull Collection<HgRepository> repositories, @NotNull List<HgRepository> selectedRepositories, @NotNull DataContext context) { execute(project, repositories, selectedRepositories.isEmpty() ? null : selectedRepositories.get(0), context); } | execute |
25,158 | HgRepository (@NotNull DataContext dataContext) { List<HgRepository> repositories = getSelectedRepositoriesFromEvent(dataContext); return repositories.isEmpty() ? null : repositories.get(0); } | getSelectedRepositoryFromEvent |
25,159 | boolean (AnActionEvent e) { HgRepository repository = getSelectedRepositoryFromEvent(e.getDataContext()); return repository != null && repository.getState() == myState; } | isRebasing |
25,160 | boolean (AnActionEvent e) { return super.isEnabled(e) && isRebasing(e); } | isEnabled |
25,161 | ActionUpdateThread () { return ActionUpdateThread.BGT; } | getActionUpdateThread |
25,162 | void (@NotNull AnActionEvent event) { final DataContext dataContext = event.getDataContext(); final Project project = CommonDataKeys.PROJECT.getData(dataContext); final VirtualFile[] files = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext); if (project == null || files == null || files.length == 0) { return; } project.save(); final HgVcs vcs = HgVcs.getInstance(project); if ((vcs == null) || !ProjectLevelVcsManager.getInstance(project).checkAllFilesAreUnder(vcs, files)) { return; } final AbstractVcsHelper helper = AbstractVcsHelper.getInstance(project); List<VcsException> exceptions = helper.runTransactionRunnable(vcs, new TransactionRunnable() { @Override public void run(List<VcsException> exceptions) { try { execute(project, vcs, files, dataContext); } catch (VcsException ex) { exceptions.add(ex); } } }, null); helper.showErrors(exceptions, vcs.getDisplayName()); } | actionPerformed |
25,163 | void (List<VcsException> exceptions) { try { execute(project, vcs, files, dataContext); } catch (VcsException ex) { exceptions.add(ex); } } | run |
25,164 | void (@NotNull AnActionEvent e) { Presentation presentation = e.getPresentation(); final DataContext dataContext = e.getDataContext(); Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { presentation.setEnabled(false); return; } VirtualFile[] files = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext); if (files == null || files.length == 0) { presentation.setEnabled(false); return; } final HgVcs vcs = HgVcs.getInstance(project); if ((vcs == null)) { presentation.setEnabled(false); return; } if (!ProjectLevelVcsManager.getInstance(project).checkAllFilesAreUnder(vcs, files)) { presentation.setEnabled(false); return; } boolean enabled = false; for (VirtualFile file : files) { boolean fileEnabled = isEnabled(project, vcs, file); if (fileEnabled) { enabled = true; break; } } presentation.setEnabled(enabled); } | update |
25,165 | void (@NotNull final Project project, @NotNull Collection<HgRepository> repositories, @Nullable final HgRepository selectedRepo, @NotNull DataContext dataContext) { new Task.Backgroundable(project, HgBundle.message("action.hg4idea.Graft.Continue.progress")) { @Override public void run(@NotNull ProgressIndicator indicator) { if (selectedRepo != null) { HgGraftCommand graftCommand = new HgGraftCommand(project, selectedRepo); HgCommandResult result = graftCommand.continueGrafting(); if (HgErrorUtil.isAbort(result)) { new HgCommandResultNotifier(project) .notifyError(GRAFT_CONTINUE_ERROR, result, HgBundle.message("hg4idea.hg.error"), HgBundle.message("action.hg4idea.Graft.continue.error")); } HgUtil.markDirectoryDirty(project, selectedRepo.getRoot()); } } }.queue(); } | execute |
25,166 | void (@NotNull ProgressIndicator indicator) { if (selectedRepo != null) { HgGraftCommand graftCommand = new HgGraftCommand(project, selectedRepo); HgCommandResult result = graftCommand.continueGrafting(); if (HgErrorUtil.isAbort(result)) { new HgCommandResultNotifier(project) .notifyError(GRAFT_CONTINUE_ERROR, result, HgBundle.message("hg4idea.hg.error"), HgBundle.message("action.hg4idea.Graft.continue.error")); } HgUtil.markDirectoryDirty(project, selectedRepo.getRoot()); } } | run |
25,167 | void (@NotNull final Project project, @NotNull Collection<HgRepository> repositories, @Nullable final HgRepository selectedRepo, @NotNull DataContext dataContext) { new Task.Backgroundable(project, HgBundle.message("action.hg4idea.Rebase.Abort.progress")) { @Override public void run(@NotNull ProgressIndicator indicator) { if (selectedRepo != null) { HgRebaseCommand rebaseCommand = new HgRebaseCommand(project, selectedRepo); HgCommandResult result = rebaseCommand.abortRebase(); if (HgErrorUtil.isAbort(result)) { new HgCommandResultNotifier(project).notifyError(REBASE_ABORT_ERROR, result, HgBundle.message("hg4idea.hg.error"), HgBundle.message("action.hg4idea.Rebase.Abort.error")); } HgUtil.markDirectoryDirty(project, selectedRepo.getRoot()); } } }.queue(); } | execute |
25,168 | void (@NotNull ProgressIndicator indicator) { if (selectedRepo != null) { HgRebaseCommand rebaseCommand = new HgRebaseCommand(project, selectedRepo); HgCommandResult result = rebaseCommand.abortRebase(); if (HgErrorUtil.isAbort(result)) { new HgCommandResultNotifier(project).notifyError(REBASE_ABORT_ERROR, result, HgBundle.message("hg4idea.hg.error"), HgBundle.message("action.hg4idea.Rebase.Abort.error")); } HgUtil.markDirectoryDirty(project, selectedRepo.getRoot()); } } | run |
25,169 | boolean (Project project, HgVcs vcs, VirtualFile file) { final FileStatus fileStatus = ChangeListManager.getInstance(project).getStatus(file); return FileStatus.MERGED_WITH_CONFLICTS.equals(fileStatus); } | isEnabled |
25,170 | void (Project project, HgVcs activeVcs, List<VirtualFile> files, DataContext context) { HgResolveCommand resolveCommand = new HgResolveCommand(project); for (VirtualFile file : files) { VirtualFile root = VcsUtil.getVcsRootFor(project, file); if (root == null) { return; } resolveCommand.markResolved(root, file); } } | batchPerform |
25,171 | AbstractVcs (Project project) { return HgVcs.getInstance(project); } | getVcs |
25,172 | String (Project project) { return HgVcs.VCS_NAME; } | getVcsName |
25,173 | void (@NonNls @Nullable String displayId, @Nullable HgCommandResult result, @NlsContexts.NotificationTitle @NotNull String failureTitle, @NlsContexts.NotificationContent @NotNull String failureDescription) { notifyError(displayId, result, failureTitle, failureDescription, null); } | notifyError |
25,174 | void (@NonNls @Nullable String displayId, @Nullable HgCommandResult result, @NlsContexts.NotificationTitle @NotNull String failureTitle, @NlsContexts.NotificationContent @NotNull String failureDescription, NotificationListener listener) { List<String> err = result != null ? result.getErrorLines() : Collections.emptyList(); HtmlBuilder sb = new HtmlBuilder(); if (!StringUtil.isEmptyOrSpaces(failureDescription)) { sb.append(failureDescription); } else { sb.append(failureTitle); } if (!err.isEmpty()) { sb.br(); sb.appendWithSeparators(HtmlChunk.br(), ContainerUtil.map(err, HtmlChunk::text)); } String errorMessage = sb.wrapWithHtmlBody().toString(); VcsNotifier.getInstance(myProject).notifyError(displayId, failureTitle, errorMessage, listener); } | notifyError |
25,175 | void (@NotNull final Project project, @NotNull Collection<HgRepository> repos, @Nullable HgRepository selectedRepo, @NotNull DataContext dataContext) { 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, HgBundle.message("action.hg4idea.pull.progress", source), false) { @Override public void run(@NotNull ProgressIndicator indicator) { executePull(project, hgRepository, source); HgUtil.markDirectoryDirty(project, hgRepository.getRoot()); } }.queue(); } } | execute |
25,176 | void (@NotNull ProgressIndicator indicator) { executePull(project, hgRepository, source); HgUtil.markDirectoryDirty(project, hgRepository.getRoot()); } | run |
25,177 | void (final Project project, final HgRepository hgRepository, final String source) { final HgPullCommand command = new HgPullCommand(project, hgRepository.getRoot()); command.setSource(source); command.executeInCurrentThread(); hgRepository.update(); } | executePull |
25,178 | ActionUpdateThread () { return ActionUpdateThread.BGT; } | getActionUpdateThread |
25,179 | void (@NotNull AnActionEvent event) { final DataContext dataContext = event.getDataContext(); final Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { return; } HgRepositoryManager repositoryManager = HgUtil.getRepositoryManager(project); List<HgRepository> repositories = repositoryManager.getRepositories(); if (repositories.isEmpty()) return; List<HgRepository> selectedRepositories = getSelectedRepositoriesFromEvent(event.getDataContext()); execute(project, repositories, selectedRepositories, event.getDataContext()); } | actionPerformed |
25,180 | void (@NotNull AnActionEvent e) { boolean enabled = isEnabled(e); e.getPresentation().setEnabled(enabled); } | update |
25,181 | boolean (AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) { return false; } HgVcs vcs = Objects.requireNonNull(HgVcs.getInstance(project)); final VirtualFile[] roots = ProjectLevelVcsManager.getInstance(project).getRootsUnderVcs(vcs); if (roots == null || roots.length == 0) { return false; } return true; } | isEnabled |
25,182 | List<HgRepository> (@NotNull DataContext dataContext) { Project project = dataContext.getData(CommonDataKeys.PROJECT); if (project == null) return Collections.emptyList(); HgRepositoryManager repositoryManager = HgUtil.getRepositoryManager(project); VirtualFile[] files = ObjectUtils.notNull(dataContext.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY), VirtualFile.EMPTY_ARRAY); List<HgRepository> selectedRepositories = ContainerUtil.mapNotNull(files, repositoryManager::getRepositoryForFileQuick); if (!selectedRepositories.isEmpty()) return selectedRepositories; HgRepository repository = HgUtil.guessRepositoryForOperation(project, dataContext); return ContainerUtil.createMaybeSingletonList(repository); } | getSelectedRepositoriesFromEvent |
25,183 | void (@NotNull final Project project, @NotNull final Collection<HgRepository> repositories, @Nullable HgRepository selectedRepo, @NotNull DataContext dataContext) { final HgUpdateToDialog dialog = new HgUpdateToDialog(project, repositories, selectedRepo); if (dialog.showAndGet()) { FileDocumentManager.getInstance().saveAllDocuments(); final String updateToValue = StringUtil.escapeBackSlashes(dialog.getTargetValue()); final boolean clean = dialog.isRemoveLocalChanges(); final VirtualFile root = dialog.getRepository().getRoot(); HgUpdateCommand.updateRepoTo(project, root, updateToValue, clean, null); } } | execute |
25,184 | void (@NotNull HgRepository repository, @NotNull List<String> patchNames) { new HgQFoldCommand(repository).executeInCurrentThread(patchNames); } | executeInCurrentThread |
25,185 | String () { return HgBundle.message("action.hg4idea.QFold.title"); } | getTitle |
25,186 | boolean (@NotNull HgRepository repository) { return !repository.getMQAppliedPatches().isEmpty(); } | isEnabled |
25,187 | void (@NotNull Project project, @NotNull Collection<HgRepository> repositories, @Nullable HgRepository selectedRepo, @NotNull DataContext dataContext) { if (selectedRepo != null) { showUnAppliedPatches(project, selectedRepo); } } | execute |
25,188 | void (@NotNull AnActionEvent e) { HgRepository repository = getSelectedRepositoryFromEvent(e.getDataContext()); e.getPresentation().setEnabledAndVisible(repository != null && repository.getRepositoryConfig().isMqUsed()); } | update |
25,189 | void (@NotNull Project project, @NotNull HgRepository selectedRepo) { ToolWindow toolWindow = Objects.requireNonNull(ToolWindowManager.getInstance(project).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID)); String tabName = selectedRepo.getRoot().getName(); HgMqUnAppliedPatchesPanel patchesPanel = new HgMqUnAppliedPatchesPanel(selectedRepo); ContentUtilEx.addTabbedContent(toolWindow.getContentManager(), patchesPanel, "MQ", HgBundle.messagePointer("hg4idea.mq.tab.name"), () -> tabName, true, patchesPanel); toolWindow.activate(null); } | showUnAppliedPatches |
25,190 | void (@NotNull HgRepository repository, @NotNull String patchName) { new HgQGotoCommand(repository).executeInCurrentThread(patchName); } | executeInCurrentThread |
25,191 | String () { return HgBundle.message("action.hg4idea.QGotoFromPatches.title"); } | getTitle |
25,192 | boolean (@NotNull Project project, @NotNull HgRepository repository, @NotNull Hash hash) { return repository.getRepositoryConfig().isMqUsed() && super.isVisible(project, repository, hash); } | isVisible |
25,193 | boolean (@NotNull HgRepository repository, @NotNull Hash commit) { return repository.getRepositoryConfig().isMqUsed() && super.isEnabled(repository, commit); } | isEnabled |
25,194 | void (@NotNull HgRepository repository, @NotNull List<String> patchNames) { assert patchNames.size() == 1; executeInCurrentThread(repository, patchNames.iterator().next()); } | executeInCurrentThread |
25,195 | void (@NotNull AnActionEvent e) { HgMqUnAppliedPatchesPanel patchInfo = e.getData(HgMqUnAppliedPatchesPanel.MQ_PATCHES); e.getPresentation().setEnabled(patchInfo != null && patchInfo.getSelectedRowsCount() == 1); } | update |
25,196 | void (@NotNull HgRepository repository, @NotNull String patchName) { new HgQPushCommand(repository).executeInCurrentThread(patchName); } | executeInCurrentThread |
25,197 | String () { return HgBundle.message("action.hg4idea.QPushAction.title"); } | getTitle |
25,198 | void (final @NotNull HgRepository repository, final @NotNull VcsFullCommitDetails commit) { final Project project = repository.getProject(); List<Hash> parents = commit.getParents(); final Hash parentHash = parents.isEmpty() ? null : parents.get(0); final HgNameWithHashInfo parentPatchName = ContainerUtil.find(repository.getMQAppliedPatches(), info -> info.getHash().equals(parentHash)); new Task.Backgroundable(repository.getProject(), parentPatchName != null ? HgBundle.message("hg4idea.mq.progress.goto", parentPatchName) : HgBundle.message("hg4idea.mq.progress.pop")) { @Override public void run(@NotNull ProgressIndicator indicator) { if (parentPatchName != null) { new HgQGotoCommand(repository).executeInCurrentThread(parentPatchName.getName()); } else { new HgQPopCommand(repository).executeInCurrentThread(); } } @Override public void onSuccess() { HgShowUnAppliedPatchesAction.showUnAppliedPatches(project, repository); } }.queue(); } | actionPerformed |
25,199 | void (@NotNull ProgressIndicator indicator) { if (parentPatchName != null) { new HgQGotoCommand(repository).executeInCurrentThread(parentPatchName.getName()); } else { new HgQPopCommand(repository).executeInCurrentThread(); } } | run |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.