Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
24,800
void (String revision) { this.revision = revision; }
setRevision
24,801
void (boolean update) { this.update = update; }
setUpdate
24,802
void (boolean rebase) { this.rebase = rebase; }
setRebase
24,803
void (String source) { this.source = source; }
setSource
24,804
HgCommandExitCode () { List<String> arguments = new LinkedList<>(); if (update) { arguments.add("--update"); } else if (rebase) { arguments.add("--rebase"); } if (!StringUtil.isEmptyOrSpaces(revision)) { arguments.add("--rev"); arguments.add(revision); } arguments.add(source); final HgRemoteCommandExecutor executor = new HgRemoteCommandExecutor(project, source); executor.setShowOutput(true); HgCommandResult result = executor.executeInCurrentThread(repo, "pull", arguments); if (HgErrorUtil.isAuthorizationError(result)) { new HgCommandResultNotifier(project) .notifyError(PULL_AUTH_REQUIRED, result, HgBundle.message("action.hg4idea.pull.auth.required"), HgBundle.message("action.hg4idea.pull.auth.required.msg", source)); return ERROR; } else if (HgErrorUtil.isAbort(result) || result.getExitValue() > 1) { //if result == null - > isAbort returns true new HgCommandResultNotifier(project) .notifyError(PULL_ERROR, result, "", HgBundle.message("action.hg4idea.pull.failed")); return ERROR; } else if (result.getExitValue() == 1) { return UNRESOLVED; } else { BackgroundTaskUtil.syncPublisher(project, HgVcs.REMOTE_TOPIC).update(project, null); return SUCCESS; } }
executeInCurrentThread
24,805
void (@NotNull Set<HgFile> files) { myFiles = files; }
setFiles
24,806
char () { return status; }
getStatus
24,807
HgResolveStatusEnum (char status) { if (status == UNRESOLVED.status) { return UNRESOLVED; } if (status == RESOLVED.status) { return RESOLVED; } return null; }
valueOf
24,808
void (@NotNull List<? extends HgRepository> repositories, @NotNull @NlsSafe String name, boolean isActive) { final Project project = Objects.requireNonNull(ContainerUtil.getFirstItem(repositories)).getProject(); if (StringUtil.isEmptyOrSpaces(name)) { VcsNotifier.getInstance(project).notifyError(BOOKMARK_NAME, HgBundle.message("hg4idea.hg.error"), HgBundle.message("hg4idea.bookmark.name.empty")); return; } new Task.Backgroundable(project, HgBundle.message("hg4idea.progress.bookmark", name)) { @Override public void run(@NotNull ProgressIndicator indicator) { for (HgRepository repository : repositories) { executeBookmarkCommandSynchronously(project, repository.getRoot(), name, isActive ? emptyList() : singletonList("--inactive")); } } }.queue(); }
createBookmarkAsynchronously
24,809
void (@NotNull ProgressIndicator indicator) { for (HgRepository repository : repositories) { executeBookmarkCommandSynchronously(project, repository.getRoot(), name, isActive ? emptyList() : singletonList("--inactive")); } }
run
24,810
void (@NotNull Project project, @NotNull VirtualFile repo, @NotNull @NlsSafe String name) { executeBookmarkCommandSynchronously(project, repo, name, singletonList("-d")); }
deleteBookmarkSynchronously
24,811
void (@NotNull Project project, @NotNull VirtualFile repositoryRoot, @NotNull @NlsSafe String name, @NotNull List<@NonNls String> args) { ArrayList<String> arguments = new ArrayList<>(args); arguments.add(name); HgCommandResult result = new HgCommandExecutor(project).executeInCurrentThread(repositoryRoot, "bookmark", arguments); getRepositoryManager(project).updateRepository(repositoryRoot); if (HgErrorUtil.hasErrorsInCommandExecution(result)) { new HgCommandResultNotifier(project) .notifyError(BOOKMARK_ERROR, result, HgBundle.message("hg4idea.hg.error"), HgBundle.message("hg4idea.bookmark.cmd.failed", repositoryRoot.getName(), name)); } }
executeBookmarkCommandSynchronously
24,812
void (HgRevisionNumber revision) { this.revision = revision; }
setRevision
24,813
void (List<String> args) { if (revision != null) { args.add("--rev"); args.add(revision.getChangeset()); } }
addArguments
24,814
boolean () { return true; }
isSilentCommand
24,815
String () { return source; }
getSource
24,816
void (String source) { this.source = source; }
setSource
24,817
void (boolean clean) { myCleanStatus = clean; }
cleanFilesOption
24,818
Builder (boolean val) { includeRemoved = val; return this; }
removed
24,819
Builder (boolean val) { includeUnknown = val; return this; }
unknown
24,820
Builder (boolean val) { includeIgnored = val; return this; }
ignored
24,821
Builder (boolean val) { includeCopySource = val; return this; }
copySource
24,822
Builder (HgRevisionNumber val) { baseRevision = val; return this; }
baseRevision
24,823
Builder (HgRevisionNumber val) { targetRevision = val; return this; }
targetRevision
24,824
HgStatusCommand (@NotNull Project project) { return new HgStatusCommand(project, this); }
build
24,825
Set<HgChange> (VirtualFile repo) { return executeInCurrentThread(repo, null); }
executeInCurrentThread
24,826
Set<HgChange> (VirtualFile repo, @Nullable Collection<FilePath> paths) { if (repo == null) { return Collections.emptySet(); } HgCommandExecutor executor = new HgCommandExecutor(myProject); executor.setSilent(true); List<String> options = new LinkedList<>(); if (myIncludeAdded) { options.add("--added"); } if (myIncludeModified) { options.add("--modified"); } if (myIncludeRemoved) { options.add("--removed"); } if (myIncludeDeleted) { options.add("--deleted"); } if (myIncludeUnknown) { options.add("--unknown"); } if (myIncludeIgnored) { options.add("--ignored"); } if (myIncludeCopySource) { options.add("--copies"); } if (myCleanStatus) { options.add("--clean"); } executor.setOutputAlwaysSuppressed(myCleanStatus || myIncludeUnknown || myIncludeIgnored); if (myBaseRevision != null && (!myBaseRevision.getRevision().isEmpty() || !myBaseRevision.getChangeset().isEmpty())) { options.add("--rev"); options.add(StringUtil.isEmptyOrSpaces(myBaseRevision.getChangeset()) ? myBaseRevision.getRevision() : myBaseRevision.getChangeset()); if (myTargetRevision != null) { options.add("--rev"); options.add(myTargetRevision.getChangeset()); } } final Set<HgChange> changes = new HashSet<>(); if (paths != null) { final List<List<String>> chunked = VcsFileUtil.chunkPaths(repo, paths); for (List<String> chunk : chunked) { List<String> args = new ArrayList<>(); args.addAll(options); args.addAll(chunk); HgCommandResult result = executor.executeInCurrentThread(repo, "status", args); changes.addAll(parseChangesFromResult(repo, result, args)); } } else { HgCommandResult result = executor.executeInCurrentThread(repo, "status", options); changes.addAll(parseChangesFromResult(repo, result, options)); } return changes; }
executeInCurrentThread
24,827
Collection<VirtualFile> (@NotNull VirtualFile repo) { return getFiles(repo, (Collection<FilePath>)null); }
getFiles
24,828
Collection<VirtualFile> (@NotNull VirtualFile repo, @Nullable List<VirtualFile> files) { //noinspection RedundantTypeArguments incorrect inspection, javac fails return getFiles(repo, files != null ? ContainerUtil.<VirtualFile, FilePath>map(files, VcsUtil::getFilePath) : null); }
getFiles
24,829
Collection<VirtualFile> (@NotNull VirtualFile repo, @Nullable Collection<FilePath> paths) { return ContainerUtil.mapNotNull(getFilePaths(repo, paths), FilePath::getVirtualFile); }
getFiles
24,830
Collection<FilePath> (@NotNull VirtualFile repo, @Nullable Collection<FilePath> paths) { Collection<FilePath> resultFiles = new HashSet<>(); Set<HgChange> change = executeInCurrentThread(repo, paths); for (HgChange hgChange : change) { FilePath file = hgChange.afterFile().toFilePath(); resultFiles.add(file); } return resultFiles; }
getFilePaths
24,831
void (@NotNull final String startRevisionNumber) { BackgroundTaskUtil.executeOnPooledThread(myRepository, () -> executeInCurrentThread(startRevisionNumber)); }
execute
24,832
void (@NotNull final String startRevisionNumber) { final Project project = myRepository.getProject(); String lastRevisionName = myRepository.getMQAppliedPatches().isEmpty() ? "tip" : "qparent"; List<String> arguments = List.of("--rev", startRevisionNumber + ":" + lastRevisionName); HgCommandResult result = new HgCommandExecutor(project).executeInCurrentThread(myRepository.getRoot(), "qimport", arguments); if (HgErrorUtil.hasErrorsInCommandExecution(result)) { new HgCommandResultNotifier(project) .notifyError(QIMPORT_ERROR, result, HgBundle.message("action.hg4idea.QImport.error"), HgBundle.message("action.hg4idea.QImport.error.msg", startRevisionNumber)); } myRepository.update(); }
executeInCurrentThread
24,833
HgCommandResult (@NotNull final String name) { Project project = myRepository.getProject(); HgCommandResult result = new HgCommandExecutor(project) .executeInCurrentThread(myRepository.getRoot(), "qgoto", Collections.singletonList(name)); if (HgErrorUtil.hasErrorsInCommandExecution(result)) { new HgCommandResultNotifier(project) .notifyError(QGOTO_ERROR, result, HgBundle.message("action.hg4idea.QGotoFromPatches.error"), HgBundle.message("action.hg4idea.QGotoFromPatches.error.msg", name)); } myRepository.update(); return result; }
executeInCurrentThread
24,834
void (@NotNull final List<String> patchNames) { final Project project = myRepository.getProject(); HgCommandResult result = new HgCommandExecutor(project) .executeInCurrentThread(myRepository.getRoot(), "qfold", patchNames); if (HgErrorUtil.hasErrorsInCommandExecution(result)) { new HgCommandResultNotifier(project) .notifyError(QFOLD_ERROR, result, HgBundle.message("action.hg4idea.QFold.error"), HgBundle.message("action.hg4idea.QFold.error.msg")); } myRepository.update(); }
executeInCurrentThread
24,835
void (@NotNull final String patchName) { final Project project = myRepository.getProject(); HgCommandResult result = new HgCommandExecutor(project).executeInCurrentThread(myRepository.getRoot(), "qpush", Arrays.asList("--move", patchName)); if (HgErrorUtil.hasErrorsInCommandExecution(result)) { new HgCommandResultNotifier(project) .notifyError(QPUSH_ERROR, result, HgBundle.message("action.hg4idea.QPushAction.error"), HgBundle.message("action.hg4idea.QPushAction.error.msg", patchName)); } myRepository.update(); }
executeInCurrentThread
24,836
void (@NotNull final Hash patchHash) { final Project project = myRepository.getProject(); HgNameWithHashInfo patchInfo = ContainerUtil.find(myRepository.getMQAppliedPatches(), info -> info.getHash().equals(patchHash)); if (patchInfo == null) { LOG.error("Could not find patch " + patchHash.toString()); return; } final String oldName = patchInfo.getName(); final String newName = Messages.showInputDialog(project, HgBundle.message("action.hg4idea.QRename.enter.patch.name", oldName), HgBundle.message("action.hg4idea.QRename.title"), Messages.getQuestionIcon(), "", new HgPatchReferenceValidator( myRepository)); if (newName != null) { performPatchRename(myRepository, oldName, newName); } }
execute
24,837
void (@NotNull HgRepository repository, @NotNull String oldName, @NotNull String newName) { if (oldName.equals(newName)) return; Project project = repository.getProject(); BackgroundTaskUtil.executeOnPooledThread(repository, () -> { HgCommandExecutor executor = new HgCommandExecutor(project); HgCommandResult result = executor.executeInCurrentThread(repository.getRoot(), "qrename", Arrays.asList(oldName, newName)); if (HgErrorUtil.hasErrorsInCommandExecution(result)) { new HgCommandResultNotifier(project).notifyError(QRENAME_ERROR, result, HgBundle.message("action.hg4idea.QRename.error"), HgBundle.message("action.hg4idea.QRename.error.msg", oldName, newName)); } repository.update(); }); }
performPatchRename
24,838
HgCommandResult () { final Project project = myRepository.getProject(); HgCommandResult result = new HgCommandExecutor(project) .executeInCurrentThread(myRepository.getRoot(), "qpop", Collections.singletonList("--all")); if (HgErrorUtil.hasErrorsInCommandExecution(result)) { new HgCommandResultNotifier(project) .notifyError(QPOP_ERROR, result, HgBundle.message("action.hg4idea.QPop.error"), HgBundle.message("action.hg4idea.QPop.error.msg")); } else { assert result != null; if (!result.getErrorLines().isEmpty()) { VcsNotifier.getInstance(project).notifyWarning(QPOP_COMPLETED_WITH_ERRORS, HgBundle.message("action.hg4idea.QPop.error.warning"), result.getRawError()); } } myRepository.update(); return result; }
executeInCurrentThread
24,839
void (@NotNull final List<String> patchNames) { final Project project = myRepository.getProject(); HgCommandResult result = new HgCommandExecutor(project) .executeInCurrentThread(myRepository.getRoot(), "qdelete", patchNames); if (HgErrorUtil.hasErrorsInCommandExecution(result)) { new HgCommandResultNotifier(project) .notifyError(QDELETE_ERROR, result, HgBundle.message("action.hg4idea.QDelete.error"), HgBundle.message("action.hg4idea.QDelete.error.msg", patchNames.size())); } myRepository.update(); }
executeInCurrentThread
24,840
Collection<String> () { return HgBranchUtil.getCommonBranches(myRepositories); }
getLocalBranchNames
24,841
String () { StringBuilder sb = new StringBuilder(); for (HgRepository repository : myRepositories) { sb.append(repository.getPresentableUrl()).append(":").append(repository.getCurrentBranchName()).append(":") .append(repository.getState()); } return sb.toString(); }
toString
24,842
void () { if (myBranchType == null) { getTemplatePresentation().setIcon(null); getTemplatePresentation().setHoveredIcon(null); } }
hideIconForUnnamedHeads
24,843
HgRepository (@NotNull List<? extends HgRepository> repositories) { assert !repositories.isEmpty(); return repositories.size() > 1 ? null : repositories.get(0); }
chooseRepository
24,844
void () { super.toggle(); myBranchManager.setFavorite(myBranchType, chooseRepository(myRepositories), myBranchName, isFavorite()); }
toggle
24,845
void (@NotNull AnActionEvent e) { FileDocumentManager.getInstance().saveAllDocuments(); final UpdatedFiles updatedFiles = UpdatedFiles.create(); for (final HgRepository repository : myRepositories) { HgMergeCommand.mergeWith(repository, myBranchName, updatedFiles); } }
actionPerformed
24,846
void (@NotNull AnActionEvent e) { HgUpdateCommand.updateTo(myBranchName, myRepositories, null); }
actionPerformed
24,847
void (@NotNull AnActionEvent e) { FileDocumentManager.getInstance().saveAllDocuments(); HgRepository repository = myRepositories.get(0); new HgBrancher(myProject).compare(myBranchName, myRepositories, repository); }
actionPerformed
24,848
Collection<String> (@NotNull BranchType type) { ArrayList<String> branches = new ArrayList<>(); if (type == HgBranchType.BRANCH) { branches.add(HgRefManager.DEFAULT); } return branches; }
getDefaultBranchNames
24,849
List<String> (@NotNull Collection<? extends HgRepository> repositories) { return getCommonNames(repositories, false); }
getCommonBranches
24,850
List<String> (@NotNull Collection<? extends HgRepository> repositories) { return getCommonNames(repositories, true); }
getCommonBookmarks
24,851
List<String> (@NotNull Collection<? extends HgRepository> repositories, boolean bookmarkType) { Collection<String> common = null; for (HgRepository repository : repositories) { Collection<String> names = bookmarkType ? HgUtil.getSortedNamesWithoutHashes(repository.getBookmarks()) : repository.getOpenedBranches(); common = common == null ? names : ContainerUtil.intersection(common, names); } return common != null ? StreamEx.of(common).sorted(StringUtil::naturalCompare).toList() : Collections.emptyList(); }
getCommonNames
24,852
Project () { return myProject; }
getProject
24,853
RepositoryManager () { return HgUtil.getRepositoryManager(myProject); }
getRepositoryManager
24,854
DvcsCompareSettings () { return HgProjectSettings.getInstance(myProject); }
getDvcsCompareSettings
24,855
String (@NotNull String firstBranch, @NotNull String secondBranch) { return String.format("hg log -r \"reverse(%s%%%s)\"", secondBranch, firstBranch); }
formatLogCommand
24,856
void (@NotNull Project project, @NotNull Collection<HgRepository> repositories, @Nullable HgRepository selectedRepo, @NotNull DataContext dataContext) { if (selectedRepo != null) { HgBranchPopup.getInstance(project, selectedRepo, dataContext).asListPopup().showInFocusCenter(); } }
execute
24,857
void (@NotNull final String branchName, @NotNull final List<HgRepository> repositories, @NotNull final HgRepository selectedRepository) { try { final CommitCompareInfo myCompareInfo = loadCommitsToCompare(repositories, branchName); ApplicationManager.getApplication().invokeLater(() -> displayCompareDialog(branchName, getCurrentBranchOrRev(repositories), myCompareInfo, selectedRepository)); } catch (VcsException e) { VcsNotifier.getInstance(myProject).notifyError(COMPARE_WITH_BRANCH_ERROR, HgBundle.message("hg4idea.branch.compare.error"), e.getMessage()); } }
compare
24,858
void (@NotNull String branchName, @NotNull String currentBranch, @NotNull CommitCompareInfo compareInfo, @NotNull HgRepository selectedRepository) { if (compareInfo.isEmpty()) { Messages.showInfoMessage(myProject, XmlStringUtil .wrapInHtml(HgBundle.message("hg4idea.branch.compare.no.changes.msg", currentBranch, branchName)), HgBundle.message("hg4idea.branch.compare.no.changes")); } else { new CompareBranchesDialog(new HgCompareBranchesHelper(myProject), branchName, currentBranch, compareInfo, selectedRepository, false).show(); } }
displayCompareDialog
24,859
String (@NotNull Collection<HgRepository> repositories) { String currentBranch; if (repositories.size() > 1) { HgMultiRootBranchConfig multiRootBranchConfig = new HgMultiRootBranchConfig(repositories); currentBranch = multiRootBranchConfig.getCurrentBranch(); } else { assert !repositories.isEmpty() : "No repositories passed to HgBranchOperationsProcessor."; HgRepository repository = repositories.iterator().next(); currentBranch = repository.getCurrentBranchName(); } return currentBranch == null ? CURRENT_REVISION : currentBranch; }
getCurrentBranchOrRev
24,860
void (@NotNull AnActionEvent e) { final String name = getNewBranchNameFromUser(myPreselectedRepo, HgBundle.message("hg4idea.branch.create")); if (name == null) { return; } new Task.Backgroundable(myProject, HgBundle.message("hg4idea.branch.creating.progress", myRepositories.size())) { @Override public void run(@NotNull ProgressIndicator indicator) { createNewBranchInCurrentThread(name); } }.queue(); }
actionPerformed
24,861
void (@NotNull ProgressIndicator indicator) { createNewBranchInCurrentThread(name); }
run
24,862
void (final @NotNull String name) { for (final HgRepository repository : myRepositories) { try { HgCommandResult result = new HgBranchCreateCommand(myProject, repository.getRoot(), name).executeInCurrentThread(); repository.update(); if (HgErrorUtil.hasErrorsInCommandExecution(result)) { new HgCommandResultNotifier(myProject) .notifyError(BRANCH_CREATION_ERROR, result, HgBundle.message("hg4idea.branch.creation.error"), HgBundle.message("hg4idea.branch.creation.error.msg", name)); } } catch (HgCommandException exception) { HgErrorUtil.handleException(myProject, BRANCH_CREATION_ERROR, HgBundle.message("hg4idea.branch.cannot.create"), exception); } } }
createNewBranchInCurrentThread
24,863
void (@NotNull AnActionEvent e) { final Project project = myPreselectedRepo.getProject(); StoreUtil.saveDocumentsAndProjectSettings(project); ChangeListManager.getInstance(project).invokeAfterUpdateWithModal( true, VcsBundle.message("waiting.changelists.update.for.show.commit.dialog.message"), () -> commitAndCloseBranch(project)); }
actionPerformed
24,864
void (final @NotNull Project project) { final LocalChangeList activeChangeList = ChangeListManager.getInstance(project).getDefaultChangeList(); HgVcs vcs = HgVcs.getInstance(project); assert vcs != null; final HgRepositoryManager repositoryManager = HgUtil.getRepositoryManager(project); List<Change> changesForRepositories = ContainerUtil.filter(activeChangeList.getChanges(), change -> myRepositories.contains(repositoryManager.getRepositoryForFile( ChangesUtil.getFilePath(change)))); Set<AbstractVcs> affectedVcses = Collections.singleton(vcs); List<HgCloseBranchExecutor> executors = Collections.singletonList(new HgCloseBranchExecutor(myRepositories)); String commitMessage = "Close Branch"; //NON-NLS CommitChangeListDialog.showCommitDialog(project, affectedVcses, changesForRepositories, activeChangeList, executors, false, commitMessage, null); }
commitAndCloseBranch
24,865
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
24,866
void (@NotNull AnActionEvent e) { e.getPresentation().setEnabledAndVisible(ContainerUtil.and(myRepositories, repository -> repository.getOpenedBranches() .contains(repository.getCurrentBranch()))); }
update
24,867
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
24,868
void (@NotNull AnActionEvent e) { DvcsUtil.disableActionIfAnyRepositoryIsFresh(e, myRepositories, HgBundle.message("action.not.possible.in.fresh.repo.new.bookmark")); }
update
24,869
void (@NotNull AnActionEvent e) { final HgBookmarkDialog bookmarkDialog = new HgBookmarkDialog(myPreselectedRepo); if (bookmarkDialog.showAndGet()) { final String name = bookmarkDialog.getName(); if (!StringUtil.isEmptyOrSpaces(name)) { HgBookmarkCommand.createBookmarkAsynchronously(myRepositories, name, bookmarkDialog.isActive()); } } }
actionPerformed
24,870
Collection<Hash> () { Collection<Hash> branchWithHashes = myRepository.getBranches().get(myCurrentBranchName); String currentHead = myRepository.getCurrentRevision(); if (branchWithHashes == null || currentHead == null || myRepository.getState() != Repository.State.NORMAL) { // repository is fresh or branch is fresh or complex state return Collections.emptySet(); } else { Collection<Hash> bookmarkHashes = ContainerUtil.map(myRepository.getBookmarks(), info -> info.getHash()); branchWithHashes.removeAll(bookmarkHashes); branchWithHashes.remove(HashImpl.build(currentHead)); } return branchWithHashes; }
filterUnnamedHeads
24,871
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
24,872
void (final @NotNull AnActionEvent e) { if (myRepository.isFresh() || myHeads.isEmpty()) { e.getPresentation().setEnabledAndVisible(false); } else if (myRepository.getState() != Repository.State.NORMAL) { e.getPresentation().setEnabled(false); } }
update
24,873
void (@NotNull AnActionEvent e) { BackgroundTaskUtil.executeOnPooledThread(HgDisposable.getInstance(myProject), () -> { for (HgRepository repository : myRepositories) { HgBookmarkCommand.deleteBookmarkSynchronously(myProject, repository.getRoot(), myBranchName); } }); }
actionPerformed
24,874
HgBranchPopup (@NotNull Project project, @NotNull HgRepository currentRepository, @NotNull DataContext dataContext) { HgRepositoryManager manager = HgUtil.getRepositoryManager(project); HgProjectSettings hgProjectSettings = HgProjectSettings.getInstance(project); HgMultiRootBranchConfig hgMultiRootBranchConfig = new HgMultiRootBranchConfig(manager.getRepositories()); return new HgBranchPopup(currentRepository, manager, hgMultiRootBranchConfig, hgProjectSettings, Conditions.alwaysFalse(), dataContext); }
getInstance
24,875
void (@NotNull LightActionGroup popupGroup, @NotNull AbstractRepositoryManager<HgRepository> repositoryManager) { List<HgRepository> allRepositories = repositoryManager.getRepositories(); popupGroup.add(new HgBranchPopupActions.HgNewBranchAction(myProject, allRepositories, myCurrentRepository)); popupGroup.addAction(new HgBranchPopupActions.HgNewBookmarkAction(allRepositories, myCurrentRepository)); popupGroup.addAction(new HgBranchPopupActions.HgCloseBranchAction(allRepositories, myCurrentRepository)); popupGroup.addAction(new HgBranchPopupActions.HgShowUnnamedHeadsForCurrentBranchAction(myCurrentRepository)); popupGroup.addAll(createRepositoriesActions()); popupGroup.addSeparator(HgBundle.message("hg4idea.branch.common.branches.separator")); List<HgCommonBranchActions> branchActions = myMultiRootBranchConfig.getLocalBranchNames().stream() .map(b -> createLocalBranchActions(allRepositories, b, false)) .filter(Objects::nonNull).sorted(FAVORITE_BRANCH_COMPARATOR).collect(toList()); int topShownBranches = getNumOfTopShownBranches(branchActions); String commonBranch = MultiRootBranches.getCommonName(myRepositoryManager.getRepositories(), Repository::getCurrentBranchName); if (commonBranch != null) { branchActions.add(0, new HgBranchPopupActions.CurrentBranch(myProject, allRepositories, commonBranch)); topShownBranches++; } wrapWithMoreActionIfNeeded(myProject, popupGroup, branchActions, topShownBranches, SHOW_ALL_BRANCHES_KEY, true); popupGroup.addSeparator(HgBundle.message("hg4idea.branch.common.bookmarks.separator")); List<HgCommonBranchActions> bookmarkActions = ((HgMultiRootBranchConfig)myMultiRootBranchConfig).getBookmarkNames().stream() .map(bm -> createLocalBranchActions(allRepositories, bm, true)) .filter(Objects::nonNull).sorted(FAVORITE_BRANCH_COMPARATOR).collect(toList()); int topShownBookmarks = getNumOfTopShownBranches(bookmarkActions); String commonBookmark = MultiRootBranches.getCommonName(repositoryManager.getRepositories(), HgRepository::getCurrentBookmark); if (commonBookmark != null) { bookmarkActions.add(0, new HgBranchPopupActions.CurrentActiveBookmark(myProject, allRepositories, commonBookmark)); topShownBookmarks++; } wrapWithMoreActionIfNeeded(myProject, popupGroup, bookmarkActions, topShownBookmarks, SHOW_ALL_BOOKMARKS_KEY, true); }
fillWithCommonRepositoryActions
24,876
HgCommonBranchActions (List<HgRepository> allRepositories, String name, boolean isBookmark) { List<HgRepository> repositories = filterRepositoriesNotOnThisBranch(name, allRepositories); if (repositories.isEmpty()) return null; return isBookmark ? new HgBranchPopupActions.BookmarkActions(myProject, repositories, name) : new HgBranchPopupActions.BranchActions(myProject, repositories, name); }
createLocalBranchActions
24,877
LightActionGroup () { LightActionGroup popupGroup = new LightActionGroup(false); popupGroup.addSeparator(HgBundle.message("repositories")); List<ActionGroup> rootActions = DvcsUtil.sortRepositories(myRepositoryManager.getRepositories()).stream() .map(repo -> new RootAction<>(repo, new HgBranchPopupActions(repo.getProject(), repo).createActions(), getDisplayableBranchOrBookmarkText(repo))) .collect(toList()); wrapWithMoreActionIfNeeded(myProject, popupGroup, rootActions, rootActions.size() > MAX_NUM ? DEFAULT_NUM : MAX_NUM, SHOW_ALL_REPOSITORIES); return popupGroup; }
createRepositoriesActions
24,878
void (@NotNull LightActionGroup popupGroup, @Nullable LightActionGroup actions) { popupGroup.addAll(new HgBranchPopupActions(myProject, myCurrentRepository).createActions(actions, myInSpecificRepository ? myCurrentRepository : null, true)); }
fillPopupWithCurrentRepositoryActions
24,879
void (@NotNull final String branchName, @NotNull final List<HgRepository> repositories, @NotNull final HgRepository selectedRepository) { new Task.Backgroundable(myProject, HgBundle.message("hg4idea.branch.comparing", branchName)) { @Override public void run(@NotNull ProgressIndicator indicator) { newWorker(indicator).compare(branchName, repositories, selectedRepository); } }.queue(); }
compare
24,880
void (@NotNull ProgressIndicator indicator) { newWorker(indicator).compare(branchName, repositories, selectedRepository); }
run
24,881
VcsDependentHistoryComponents (VcsHistorySession session, JComponent forShortcutRegistration) { return VcsDependentHistoryComponents.createOnlyColumns(ColumnInfo.EMPTY_ARRAY); }
getUICustomization
24,882
AnAction[] (Runnable runnable) { return new AnAction[]{ShowAllAffectedGenericAction.getInstance(), ActionManager.getInstance().getAction(VcsActions.ACTION_COPY_REVISION_NUMBER)}; }
getAdditionalActions
24,883
boolean () { return false; }
isDateOmittable
24,884
String () { return null; }
getHelpId
24,885
VcsHistorySession (FilePath filePath) { final VirtualFile vcsRoot = VcsUtil.getVcsRootFor(myProject, filePath); if (vcsRoot == null) { return null; } final List<VcsFileRevision> revisions = new ArrayList<>(getHistory(filePath, vcsRoot, myProject)); return createAppendableSession(vcsRoot, filePath, revisions, revisions.isEmpty() ? null : requireNonNull(getFirstItem(revisions)).getRevisionNumber()); }
createSessionFor
24,886
VcsAbstractHistorySession (@NotNull VirtualFile vcsRoot, @NotNull FilePath filePath, @NotNull List<VcsFileRevision> revisions, @Nullable VcsRevisionNumber number) { return new VcsAbstractHistorySession(revisions, number) { @Override protected @Nullable VcsRevisionNumber calcCurrentRevisionNumber() { if (filePath.isDirectory()) return new HgWorkingCopyRevisionsCommand(myProject).firstParent(vcsRoot); return new HgWorkingCopyRevisionsCommand(myProject).parents(vcsRoot, filePath).first; } @Override public VcsHistorySession copy() { return createAppendableSession(vcsRoot, filePath, getRevisionList(), getCurrentRevisionNumber()); } }; }
createAppendableSession
24,887
VcsHistorySession () { return createAppendableSession(vcsRoot, filePath, getRevisionList(), getCurrentRevisionNumber()); }
copy
24,888
List<HgFileRevision> (@NotNull FilePath filePath, @NotNull VirtualFile vcsRoot, @NotNull Project project) { VcsConfiguration vcsConfiguration = VcsConfiguration.getInstance(project); return getHistory(filePath, vcsRoot, project, null, vcsConfiguration.LIMIT_HISTORY ? vcsConfiguration.MAXIMUM_HISTORY_ROWS : -1); }
getHistory
24,889
List<HgFileRevision> (@NotNull FilePath filePath, @NotNull VirtualFile vcsRoot, @NotNull Project project, @Nullable HgRevisionNumber revisionNumber, int limit) { /* The standard way to get history following renames is to call hg log --follow. However: 1. It is broken in case of uncommitted rename (i.e. if the file is currently renamed in the working dir): in this case we use a special python template "follow(path)" which handles this case. 2. We don't use this python "follow(path)" function for all cases, because it is fully supported only since hg 2.6, and it is a bit slower and possibly less reliable than plain --follow parameter. 3. It doesn't work with "-r": in this case --follow is simply ignored (hg commit 24208:8b4b9ee6001a). As a workaround we could use the same follow(path) python, but this function requires current name of the file, which is unknown in case of "-r", and identifying it would be very slow. As a result we don't follow renames in annotate called from diff or from an old revision, which we can survive. */ FilePath originalFilePath = HgUtil.getOriginalFileName(filePath, ChangeListManager.getInstance(project)); if (revisionNumber == null && !filePath.isDirectory() && !filePath.equals(originalFilePath)) { // uncommitted renames detected return getHistoryForUncommittedRenamed(originalFilePath, vcsRoot, project, limit); } final HgLogCommand logCommand = new HgLogCommand(project); logCommand.setFollowCopies(!filePath.isDirectory()); logCommand.setIncludeRemoved(true); List<String> args = new ArrayList<>(); if (revisionNumber != null) { args.add("--rev"); args.add("reverse(0::" + revisionNumber.getChangeset() + ")"); } return logCommand.execute(new HgFile(vcsRoot, filePath), limit, false, args); }
getHistory
24,890
List<HgFileRevision> (@NotNull FilePath originalHgFilePath, @NotNull VirtualFile vcsRoot, @NotNull Project project, int limit) { HgFile originalHgFile = new HgFile(vcsRoot, originalHgFilePath); final HgLogCommand logCommand = new HgLogCommand(project); logCommand.setIncludeRemoved(true); final HgVersion version = logCommand.getVersion(); String[] templates = HgBaseLogParser.constructFullTemplateArgument(false, version); String template = HgChangesetUtil.makeTemplate(templates); List<String> argsForCmd = new ArrayList<>(); String relativePath = originalHgFile.getRelativePath(); argsForCmd.add("--rev"); argsForCmd .add(String.format("reverse(follow(%s))", relativePath != null ? "'" + FileUtil.toSystemIndependentName(relativePath) + "'" : "")); HgCommandResult result = logCommand.execute(vcsRoot, template, limit, relativePath != null ? null : originalHgFile, argsForCmd); return HgHistoryUtil.getCommitRecords(project, result, new HgFileRevisionLogParser(project, originalHgFile, version)); }
getHistoryForUncommittedRenamed
24,891
boolean () { return true; }
supportsHistoryForDirectories
24,892
DiffFromHistoryHandler () { return new HgDiffFromHistoryHandler(myProject); }
getHistoryDiffHandler
24,893
boolean (@NotNull VirtualFile file) { return true; }
canShowHistoryFor
24,894
VcsRevisionNumber () { return myRevisionNumber; }
getRevisionNumber
24,895
VirtualFile () { return myRepositoryRoot; }
getRepositoryRoot
24,896
boolean () { return !AdvancedSettings.getBoolean("vcs.process.ignored"); }
scanTurnedOff
24,897
void (List<? extends Change> changes, List<VcsException> vcsExceptions, @NotNull RollbackProgressListener listener) { if (changes == null || changes.isEmpty()) { return; } List<FilePath> toDelete = new ArrayList<>(); List<FilePath> filePaths = new LinkedList<>(); for (Change change : changes) { ContentRevision contentRevision; if (Change.Type.DELETED == change.getType()) { contentRevision = change.getBeforeRevision(); } else { contentRevision = change.getAfterRevision(); } if (contentRevision != null) { filePaths.add(contentRevision.getFile()); if (Change.Type.MOVED == change.getType()) { toDelete.add(contentRevision.getFile()); } } } try (AccessToken ignore = DvcsUtil.workingTreeChangeStarted(project, getRollbackOperationName())) { revert(filePaths); for (FilePath file : toDelete) { listener.accept(file); try { final File ioFile = file.getIOFile(); if (ioFile.exists()) { if (!ioFile.delete()) { vcsExceptions.add(new VcsException(HgBundle.message("error.cannot.delete.file", file.getPresentableUrl()))); } } } catch (Exception e) { vcsExceptions.add(new VcsException(HgBundle.message("error.cannot.delete.file", file.getPresentableUrl()), e)); } } } }
rollbackChanges
24,898
void (List<? extends FilePath> files, List<? super VcsException> exceptions, RollbackProgressListener listener) { try (AccessToken ignore = DvcsUtil.workingTreeChangeStarted(project, getRollbackOperationName())) { revert(files); } }
rollbackMissingFileDeletion
24,899
void (List<? extends VirtualFile> files, List<? super VcsException> exceptions, RollbackProgressListener listener) { }
rollbackModifiedWithoutCheckout