Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
24,900
List<VcsException> (List<? extends FilePath> files) { if (files == null || files.isEmpty()) { return null; } revert(files); return null; }
rollbackMissingFileDeletion
24,901
void (@NotNull List<? extends FilePath> filePaths) { for (Map.Entry<VirtualFile, Collection<FilePath>> entry : HgUtil.groupFilePathsByHgRoots(project, filePaths).entrySet()) { final VirtualFile repo = entry.getKey(); final Collection<FilePath> files = entry.getValue(); HgRevisionNumber revisionNumber = new HgWorkingCopyRevisionsCommand(project).firstParent(repo); for (List<String> chunk : VcsFileUtil.chunkPaths(repo, files)) { HgCommandResult revertResult = new HgRevertCommand(project).execute(repo, chunk, revisionNumber, false); if (HgErrorUtil.hasUncommittedChangesConflict(revertResult)) { String message = XmlStringUtil.wrapInHtml(HgBundle.message("hg4idea.revert.failed.msg", repo.getPresentableName())); int exitCode = HgUpdateCommand.showDiscardChangesConfirmation(project, message); if (exitCode == Messages.OK) { //discard all changes for this repository// HgUpdateCommand updateCommand = new HgUpdateCommand(project, repo); updateCommand.setClean(true); updateCommand.setRevision("."); updateCommand.execute(); } break; } new HgResolveCommand(project).markResolved(repo, files); } } }
revert
24,902
List<Change> (@NotNull FilePath path, @NotNull HgFileRevision rev1, @Nullable HgFileRevision rev2) { return executeDiff(path, rev1, rev2); }
getChangesBetweenRevisions
24,903
List<Change> (@NotNull FilePath path, @NotNull HgFileRevision rev) { return executeDiff(path, null, rev); }
getAffectedChanges
24,904
String (@NotNull HgFileRevision revision) { return revision.getRevisionNumber().getChangeset(); }
getPresentableName
24,905
List<Change> (@NotNull FilePath path, @Nullable HgFileRevision rev1, @Nullable HgFileRevision rev2) { VirtualFile root = VcsUtil.getVcsRootFor(myProject, path); LOG.assertTrue(root != null, "Repository is null for " + path); return HgUtil .getDiff(myProject, root, path, rev1 != null ? rev1.getRevisionNumber() : null, rev2 != null ? rev2.getRevisionNumber() : null); }
executeDiff
24,906
HgRevisionNumber () { return (HgRevisionNumber)super.getRevisionNumber(); }
getRevisionNumber
24,907
String () { return myBranch; }
getBranch
24,908
AbstractVcs () { return myVcs; }
getVcs
24,909
String () { return getComment(); }
toString
24,910
void (@NotNull VirtualFile file) { try { new HgResolveCommand(myProject).markResolved(HgUtil.getHgRootOrThrow(myProject, file), file); } catch (VcsException e) { LOG.error("Couldn't mark file resolved, because it is not under Mercurial root."); } }
conflictResolvedForFile
24,911
boolean (@NotNull VirtualFile file) { return file.getFileType().isBinary(); }
isBinary
24,912
boolean (VirtualFile repo, VirtualFile file) { // in the case of merge if the file was checked in, it will have 2 parents after hg pull. If it wasn't, it would have only one parent final Couple<HgRevisionNumber> parents = new HgWorkingCopyRevisionsCommand(myProject).parents(repo, file); return parents.second != null; }
wasFileCheckedIn
24,913
void (final @NotNull Project project, final @Nullable Listener listener) { FileDocumentManager.getInstance().saveAllDocuments(); HgCloneDialog dialog = new HgCloneDialog(project); if (!dialog.showAndGet()) { return; } dialog.rememberSettings(); String directoryName = dialog.getDirectoryName(); String sourceRepositoryURL = dialog.getSourceRepositoryURL(); String parentDirectory = dialog.getParentDirectory(); doClone(project, listener, directoryName, sourceRepositoryURL, parentDirectory); }
doCheckout
24,914
void (@NotNull Project project, @Nullable Listener listener, @NotNull String directoryName, @NotNull String sourceRepositoryURL, @NotNull String parentDirectory) { VirtualFile destinationParent = LocalFileSystem.getInstance().findFileByIoFile(new File(parentDirectory)); if (destinationParent == null) { return; } final String targetDir = destinationParent.getPath() + File.separator + directoryName; String projectPath = FileUtilRt.toSystemIndependentName(targetDir); CloneTask cloneTask = new CloneTask() { @Override public @NotNull CloneTaskInfo taskInfo() { return new CloneTaskInfo(DvcsBundle.message("cloning.repository", sourceRepositoryURL), DvcsBundle.message("cloning.repository.cancel", sourceRepositoryURL), DvcsBundle.message("clone.repository"), DvcsBundle.message("clone.repository.tooltip"), DvcsBundle.message("clone.repository.failed"), DvcsBundle.message("clone.repository.canceled"), DvcsBundle.message("clone.stop.message.title"), DvcsBundle.message("clone.stop.message.description", sourceRepositoryURL)); } @Override public @NotNull CloneStatus run(@NotNull ProgressIndicator indicator) { HgCloneCommand clone = new HgCloneCommand(project); clone.setRepositoryURL(sourceRepositoryURL); clone.setDirectory(targetDir); HgCommandResult commandResult = clone.executeInCurrentThread(); if (commandResult == null || HgErrorUtil.hasErrorsInCommandExecution(commandResult)) { new HgCommandResultNotifier(project).notifyError(CLONE_ERROR, commandResult, DvcsBundle.message("clone.repository.failed"), HgBundle.message("hg4idea.clone.repo.error.msg", sourceRepositoryURL)); return CloneStatus.FAILURE; } else { DvcsUtil.addMappingIfSubRoot(project, targetDir, HgVcs.VCS_NAME); if (listener != null) { listener.directoryCheckedOut(new File(parentDirectory, directoryName), HgVcs.getKey()); listener.checkoutCompleted(); } return CloneStatus.SUCCESS; } } }; CloneableProjectsService.getInstance().runCloneTask(projectPath, cloneTask); }
doClone
24,915
CloneTaskInfo () { return new CloneTaskInfo(DvcsBundle.message("cloning.repository", sourceRepositoryURL), DvcsBundle.message("cloning.repository.cancel", sourceRepositoryURL), DvcsBundle.message("clone.repository"), DvcsBundle.message("clone.repository.tooltip"), DvcsBundle.message("clone.repository.failed"), DvcsBundle.message("clone.repository.canceled"), DvcsBundle.message("clone.stop.message.title"), DvcsBundle.message("clone.stop.message.description", sourceRepositoryURL)); }
taskInfo
24,916
CloneStatus (@NotNull ProgressIndicator indicator) { HgCloneCommand clone = new HgCloneCommand(project); clone.setRepositoryURL(sourceRepositoryURL); clone.setDirectory(targetDir); HgCommandResult commandResult = clone.executeInCurrentThread(); if (commandResult == null || HgErrorUtil.hasErrorsInCommandExecution(commandResult)) { new HgCommandResultNotifier(project).notifyError(CLONE_ERROR, commandResult, DvcsBundle.message("clone.repository.failed"), HgBundle.message("hg4idea.clone.repo.error.msg", sourceRepositoryURL)); return CloneStatus.FAILURE; } else { DvcsUtil.addMappingIfSubRoot(project, targetDir, HgVcs.VCS_NAME); if (listener != null) { listener.directoryCheckedOut(new File(parentDirectory, directoryName), HgVcs.getKey()); listener.checkoutCompleted(); } return CloneStatus.SUCCESS; } }
run
24,917
String () { return HgBundle.message("hg4idea.vcs.name.with.mnemonic"); }
getVcsName
24,918
VcsCloneComponent (@NotNull Project project, @NotNull ModalityState modalityState, @NotNull VcsCloneDialogComponentStateListener dialogStateListener) { return new HgCloneDialogComponent(project, dialogStateListener); }
buildVcsCloneComponent
24,919
boolean () { return true; }
isModifiedDocumentTrackingRequired
24,920
void (@NotNull VcsDirtyScope dirtyScope, @NotNull ChangelistBuilder builder, @NotNull ProgressIndicator progress, @NotNull ChangeListManagerGate addGate) { if (myProject.isDisposed()) return; final Collection<HgChange> changes = new HashSet<>(); changes.addAll(process(builder, dirtyScope.getRecursivelyDirtyDirectories())); changes.addAll(process(builder, dirtyScope.getDirtyFiles())); processUnsavedChanges(builder, dirtyScope.getDirtyFilesNoExpand(), changes); }
getChanges
24,921
Collection<HgChange> (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; }
process
24,922
void (ChangelistBuilder builder, Set<HgChange> changes, Map<HgFile, HgResolveStatusEnum> resolveStatus, HgRevisionNumber workingRevision, HgRevisionNumber parentRevision) { for (HgChange change : changes) { HgFile afterFile = change.afterFile(); HgFile beforeFile = change.beforeFile(); HgFileStatusEnum status = change.getStatus(); if (resolveStatus.containsKey(afterFile) && resolveStatus.get(afterFile) == HgResolveStatusEnum.UNRESOLVED) { builder.processChange( new Change( HgContentRevision.create(myProject, beforeFile, parentRevision), HgCurrentContentRevision.create(afterFile, workingRevision), FileStatus.MERGED_WITH_CONFLICTS ), myVcsKey); continue; } if (isDeleteOfCopiedFile(change, changes)) { // Don't register the 'delete' change for renamed or moved files; IDEA already handles these // itself. continue; } HgChangeProcessor processor = Holder.PROCESSORS.get(status); if (processor != null) { processor.process(myProject, myVcsKey, builder, workingRevision, parentRevision, beforeFile, afterFile); } } }
sendChanges
24,923
boolean (@NotNull HgChange change, Set<HgChange> changes) { if (change.getStatus().equals(HgFileStatusEnum.DELETED)) { for (HgChange otherChange : changes) { if (otherChange.getStatus().equals(HgFileStatusEnum.COPY) && otherChange.beforeFile().equals(change.afterFile())) { return true; } } } return false; }
isDeleteOfCopiedFile
24,924
void (ChangelistBuilder builder, Set<FilePath> dirtyFiles, Collection<HgChange> alreadyProcessed) { // exclude already processed for (HgChange c : alreadyProcessed) { dirtyFiles.remove(c.beforeFile().toFilePath()); dirtyFiles.remove(c.afterFile().toFilePath()); } final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject); final FileDocumentManager fileDocumentManager = FileDocumentManager.getInstance(); for (FilePath filePath : dirtyFiles) { final VirtualFile vf = filePath.getVirtualFile(); if (vf != null && fileDocumentManager.isFileModified(vf)) { final VirtualFile root = vcsManager.getVcsRootFor(vf); if (root != null && HgUtil.isHgRoot(root)) { final HgRevisionNumber beforeRevisionNumber = new HgWorkingCopyRevisionsCommand(myProject).firstParent(root); final ContentRevision beforeRevision = (beforeRevisionNumber == null ? null : HgContentRevision.create(myProject, new HgFile(myProject, vf), beforeRevisionNumber)); builder.processChange(new Change(beforeRevision, CurrentContentRevision.create(filePath), FileStatus.MODIFIED), myVcsKey); } } } }
processUnsavedChanges
24,925
void (ContentRevision contentRevisionBefore, ContentRevision contentRevisionAfter, FileStatus fileStatus, ChangelistBuilder builder, VcsKey vcsKey) { if (contentRevisionBefore == null && contentRevisionAfter == null) { return; } builder.processChange( new Change(contentRevisionBefore, contentRevisionAfter, fileStatus), vcsKey ); }
processChange
24,926
VcsRevisionNumber () { return revisionNumber; }
getRevisionNumber
24,927
ContentRevision (@NotNull HgFile hgFile, @NotNull HgRevisionNumber revision) { VirtualFile virtualFile = VcsUtil.getVirtualFile(hgFile.getFile()); if (virtualFile == null) { return null; } if (!virtualFile.getFileType().isBinary()) { return new HgCurrentContentRevision(hgFile, revision, virtualFile); } return new HgCurrentBinaryContentRevision(hgFile, revision); }
create
24,928
String () { return HgVcs.VCS_NAME; }
getVcsName
24,929
List<AnAction> (@NotNull ActionManager manager) { List<AnAction> actions = new ArrayList<>(); add("hg4idea.branches", manager, actions); add("hg4idea.pull", manager, actions); add("Vcs.Push", manager, actions); add("hg4idea.updateTo", manager, actions); add("ChangesView.AddUnversioned", manager, actions); return actions; }
collectVcsSpecificActions
24,930
VcsRepositoryIgnoredFilesHolder (@NotNull HgRepository repository) { return repository.getIgnoredFilesHolder(); }
getHolder
24,931
AbstractVcs () { return myVcs; }
getVcs
24,932
VcsManagedFilesHolder () { return new HgIgnoredFileHolder(myManager); }
createHolder
24,933
void (@NotNull Project project) { myManager.getRepositories().forEach(r -> r.getIgnoredFilesHolder().startRescan()); }
refresh
24,934
ChangesBrowserSettingsEditor<ChangeBrowserSettings> (boolean showDateFilter) { return new HgVersionFilterComponent(showDateFilter); }
createFilterUI
24,935
void (ChangeBrowserSettings changeBrowserSettings, @NotNull RepositoryLocation repositoryLocation, int maxCount, @NotNull AsynchConsumer<? super CommittedChangeList> consumer) { try { List<CommittedChangeList> results = getCommittedChanges(changeBrowserSettings, repositoryLocation, maxCount); for (CommittedChangeList result : results) { consumer.consume(result); } } finally { consumer.finished(); } }
loadCommittedChanges
24,936
List<CommittedChangeList> (ChangeBrowserSettings changeBrowserSettings, @NotNull RepositoryLocation repositoryLocation, int maxCount) { VirtualFile root = ((HgRepositoryLocation)repositoryLocation).getRoot(); HgFile hgFile = new HgFile(root, VcsUtil.getFilePath(root.getPath())); List<CommittedChangeList> result = new LinkedList<>(); HgLogCommand hgLogCommand = new HgLogCommand(project); hgLogCommand.setLogFile(false); List<String> args = null; if (changeBrowserSettings != null) { HgLogArgsBuilder argsBuilder = new HgLogArgsBuilder(changeBrowserSettings); args = argsBuilder.getLogArgs(); if (args.isEmpty()) { maxCount = maxCount == 0 ? VcsConfiguration.getInstance(project).MAXIMUM_HISTORY_ROWS : maxCount; } } final List<HgFileRevision> localRevisions; localRevisions = hgLogCommand.execute(hgFile, maxCount == 0 ? -1 : maxCount, true, args); Collections.reverse(localRevisions); for (HgFileRevision revision : localRevisions) { HgRevisionNumber vcsRevisionNumber = revision.getRevisionNumber(); List<? extends HgRevisionNumber> parents = vcsRevisionNumber.getParents(); HgRevisionNumber firstParent = parents.isEmpty() ? null : parents.get(0); // can have no parents if it is a root List<Change> changes = new ArrayList<>(); for (String file : revision.getModifiedFiles()) { changes.add(createChange(root, file, firstParent, file, vcsRevisionNumber, FileStatus.MODIFIED)); } for (String file : revision.getAddedFiles()) { changes.add(createChange(root, null, null, file, vcsRevisionNumber, FileStatus.ADDED)); } for (String file : revision.getDeletedFiles()) { changes.add(createChange(root, file, firstParent, null, vcsRevisionNumber, FileStatus.DELETED)); } for (Map.Entry<String, String> copiedFile : revision.getMovedFiles().entrySet()) { changes .add(createChange(root, copiedFile.getKey(), firstParent, copiedFile.getValue(), vcsRevisionNumber, HgChangeProvider.RENAMED)); } result.add(new HgCommittedChangeList(myVcs, vcsRevisionNumber, revision.getBranchName(), revision.getCommitMessage(), revision.getAuthor(), revision.getRevisionDate(), changes)); } Collections.reverse(result); return result; }
getCommittedChanges
24,937
Change (VirtualFile root, @Nullable String fileBefore, @Nullable HgRevisionNumber revisionBefore, @Nullable String fileAfter, HgRevisionNumber revisionAfter, FileStatus aStatus) { HgContentRevision beforeRevision = fileBefore == null ? null : HgContentRevision.create(project, new HgFile(root, new File(root.getPath(), fileBefore)), revisionBefore); HgContentRevision afterRevision = fileAfter == null ? null : HgContentRevision.create(project, new HgFile(root, new File(root.getPath(), fileAfter)), revisionAfter); return new Change(beforeRevision, afterRevision, aStatus); }
createChange
24,938
VcsCommittedViewAuxiliary (@NotNull DecoratorManager manager, @Nullable RepositoryLocation location) { AnAction copyHashAction = new DumbAwareAction( HgBundle.messagePointer("action.DumbAware.HgCommittedChangesProvider.text.copy.hash"), HgBundle.messagePointer("action.DumbAware.HgCommittedChangesProvider.description.copy.hash.to.clipboard"), PlatformIcons.COPY_ICON) { @Override public void actionPerformed(@NotNull AnActionEvent e) { ChangeList[] changeLists = e.getData(VcsDataKeys.CHANGE_LISTS); if (changeLists != null && changeLists[0] instanceof HgCommittedChangeList) { HgRevisionNumber revisionNumber = ((HgCommittedChangeList)changeLists[0]).getRevisionNumber(); CopyPasteManager.getInstance().setContents(new StringSelection(revisionNumber.getChangeset())); } } }; return new VcsCommittedViewAuxiliary(Collections.singletonList(copyHashAction), () -> { }, Collections.singletonList(copyHashAction)); }
createActions
24,939
void (@NotNull AnActionEvent e) { ChangeList[] changeLists = e.getData(VcsDataKeys.CHANGE_LISTS); if (changeLists != null && changeLists[0] instanceof HgCommittedChangeList) { HgRevisionNumber revisionNumber = ((HgCommittedChangeList)changeLists[0]).getRevisionNumber(); CopyPasteManager.getInstance().setContents(new StringSelection(revisionNumber.getChangeset())); } }
actionPerformed
24,940
int () { return -1; }
getUnlimitedCountValue
24,941
boolean () { return false; }
supportsIncomingChanges
24,942
String () { return HgBundle.message("hg4idea.changelist.column.branch"); }
getTitle
24,943
Object (final HgCommittedChangeList changeList) { final String branch = changeList.getBranch(); return branch.isEmpty() ? "default" : branch; }
getValue
24,944
Comparator<HgCommittedChangeList> () { return BRANCH_COLUMN_COMPARATOR; }
getComparator
24,945
VirtualFile () { return myRoot; }
getRoot
24,946
String () { return myUrl; }
toPresentableString
24,947
String () { return toPresentableString(); }
toString
24,948
String () { return myUrl; }
getKey
24,949
VcsRevisionNumber (VirtualFile file) { VirtualFile vcsRoot = VcsUtil.getVcsRootFor(project, file); if (vcsRoot == null) { return null; } FilePath filePath = VcsUtil.getFilePath(file); return new HgWorkingCopyRevisionsCommand(project).parents(vcsRoot, filePath).first; }
getCurrentRevision
24,950
ItemLatestState (VirtualFile file) { VirtualFile vcsRoot = VcsUtil.getVcsRootFor(project, file); if (vcsRoot == null) { return null; } HgRevisionNumber revision = (HgRevisionNumber) getCurrentRevision(file); if (revision == null) { return null; } return new ItemLatestState(revision, file.exists(), true); }
getLastRevision
24,951
ItemLatestState (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); }
getLastRevision
24,952
VcsRevisionNumber (VirtualFile vcsRoot) { return new HgWorkingCopyRevisionsCommand(project).tip(vcsRoot); }
getLatestCommittedRevision
24,953
ContentRevision (VcsRevisionNumber revisionNumber, VirtualFile file) { if (file == null) { return null; } VirtualFile vcsRoot = VcsUtil.getVcsRootFor(project, file); if (vcsRoot == null) { return null; } HgRevisionNumber hgRevisionNumber = (HgRevisionNumber) revisionNumber; if (hgRevisionNumber.isWorkingVersion()) { throw new IllegalStateException("Should not compare against working copy"); } HgFile hgFile = new HgFile(vcsRoot, HgUtil.getOriginalFileName(VcsUtil.getFilePath(file), ChangeListManager.getInstance(project))); return HgContentRevision.create(project, hgFile, hgRevisionNumber); }
createFileContent
24,954
boolean () { return true; }
canCompareWithWorkingDir
24,955
String () { return null; }
getHelpId
24,956
String () { return HgBundle.message("hg4idea.commit"); }
getCheckinOperationName
24,957
boolean () { return getAmendService().isAmendCommitSupported(); }
isAmendCommitSupported
24,958
CancellablePromise<EditedCommitDetails> (@NotNull VirtualFile root) { return getAmendService().getAmendCommitDetails(root); }
getAmendCommitDetails
24,959
HgAmendCommitService () { return myProject.getService(HgAmendCommitService.class); }
getAmendService
24,960
List<VcsException> (@NotNull List<? extends Change> changes, @NotNull String commitMessage, @NotNull CommitContext commitContext, @NotNull Set<? super String> feedback) { List<VcsException> exceptions = new LinkedList<>(); Map<HgRepository, Set<HgFile>> repositoriesMap = getFilesByRepository(changes); addRepositoriesWithoutChanges(repositoriesMap, commitContext); boolean isAmend = isAmendCommitMode(commitContext); for (Map.Entry<HgRepository, Set<HgFile>> entry : repositoriesMap.entrySet()) { HgRepository repo = entry.getKey(); Set<HgFile> selectedFiles = entry.getValue(); boolean isCloseBranch = isCloseBranch(commitContext); boolean isCommitSubrepositories = isCommitSubrepositories(commitContext); HgCommitTypeCommand command = isMqNewPatch(commitContext) ? new HgQNewCommand(myProject, repo, commitMessage, isAmend) : new HgCommitCommand(myProject, repo, commitMessage, isAmend, isCloseBranch, isCommitSubrepositories && !selectedFiles.isEmpty()); if (isMergeCommit(repo.getRoot())) { //partial commits are not allowed during merges //verifyResult that all changed files in the repo are selected //If so, commit the entire repository //If not, abort Set<HgFile> changedFilesNotInCommit = getChangedFilesNotInCommit(repo.getRoot(), selectedFiles); boolean partial = !changedFilesNotInCommit.isEmpty(); if (partial) { final StringBuilder filesNotIncludedString = new StringBuilder(); for (HgFile hgFile : changedFilesNotInCommit) { filesNotIncludedString.append("<li>"); filesNotIncludedString.append(hgFile.getRelativePath()); filesNotIncludedString.append("</li>"); } if (!mayCommitEverything(filesNotIncludedString.toString())) { //abort return exceptions; } //firstly selected changes marked dirty in SingleChangeListCommitter -> doPostRefresh, so we need to mark others VcsDirtyScopeManager dirtyManager = VcsDirtyScopeManager.getInstance(myProject); for (HgFile hgFile : changedFilesNotInCommit) { dirtyManager.fileDirty(hgFile.toFilePath()); } } // else : all was included, or it was OK to commit everything, // so no need to set the files on the command, because then mercurial will complain } else { command.setFiles(selectedFiles); } try { command.executeInCurrentThread(); } catch (HgCommandException e) { exceptions.add(new VcsException(e)); } catch (VcsException e) { exceptions.add(e); } } // push if needed if (isPushAfterCommit(commitContext) && exceptions.isEmpty()) { List<HgRepository> preselectedRepositories = new ArrayList<>(repositoriesMap.keySet()); ModalityUiUtil.invokeLaterIfNeeded(ModalityState.defaultModalityState(), () -> { HgRepository selectedRepo = DvcsUtil.guessRepositoryForOperation(myProject, getRepositoryManager(myProject)); new VcsPushDialog(myProject, preselectedRepositories, selectedRepo).show(); }); } return exceptions; }
commit
24,961
boolean (VirtualFile repo) { return new HgWorkingCopyRevisionsCommand(myProject).parents(repo).size() > 1; }
isMergeCommit
24,962
Set<HgFile> (VirtualFile repo, Set<HgFile> selectedFiles) { List<HgRevisionNumber> parents = new HgWorkingCopyRevisionsCommand(myProject).parents(repo); HgStatusCommand statusCommand = new HgStatusCommand.Builder(true).unknown(false).ignored(false).baseRevision(parents.get(0)).build(myProject); Set<HgChange> allChangedFilesInRepo = statusCommand.executeInCurrentThread(repo); Set<HgFile> filesNotIncluded = new HashSet<>(); for (HgChange change : allChangedFilesInRepo) { HgFile beforeFile = change.beforeFile(); HgFile afterFile = change.afterFile(); if (!selectedFiles.contains(beforeFile)) { filesNotIncluded.add(beforeFile); } else if (!selectedFiles.contains(afterFile)) { filesNotIncluded.add(afterFile); } } return filesNotIncluded; }
getChangedFilesNotInCommit
24,963
boolean (final String filesNotIncludedString) { final int[] choice = new int[1]; Runnable runnable = () -> choice[0] = Messages.showOkCancelDialog( myProject, XmlStringUtil.wrapInHtml(HgBundle.message("hg4idea.commit.partial.merge.message", filesNotIncludedString)), HgBundle.message("hg4idea.commit.partial.merge.title"), null ); ApplicationManager.getApplication().invokeAndWait(runnable); return choice[0] == Messages.OK; }
mayCommitEverything
24,964
List<VcsException> (@NotNull List<? extends FilePath> files) { final List<HgFile> filesWithRoots = new ArrayList<>(); for (FilePath filePath : files) { VirtualFile vcsRoot = VcsUtil.getVcsRootFor(myProject, filePath); if (vcsRoot == null) { continue; } filesWithRoots.add(new HgFile(vcsRoot, filePath)); } new Task.Backgroundable(myProject, HgBundle.message("files.removing.progress")) { @Override public void run(@NotNull ProgressIndicator indicator) { new HgRemoveCommand(myProject).executeInCurrentThread(filesWithRoots); } }.queue(); return null; }
scheduleMissingFileForDeletion
24,965
void (@NotNull ProgressIndicator indicator) { new HgRemoveCommand(myProject).executeInCurrentThread(filesWithRoots); }
run
24,966
List<VcsException> (final @NotNull List<? extends VirtualFile> files) { new HgAddCommand(myProject).addWithProgress(files); return null; }
scheduleUnversionedFilesForAddition
24,967
boolean () { return false; }
isRefreshAfterCommitNeeded
24,968
void (Map<HgRepository, Set<HgFile>> result, ContentRevision contentRevision) { FilePath filePath = contentRevision.getFile(); // try to find repository from hgFile from change: to be able commit sub repositories as expected HgRepository repo = HgUtil.getRepositoryForFile(myProject, contentRevision instanceof HgCurrentBinaryContentRevision ? ((HgCurrentBinaryContentRevision)contentRevision).getRepositoryRoot() : ChangesUtil.findValidParentAccurately(filePath)); if (repo == null) { return; } Set<HgFile> hgFiles = result.get(repo); if (hgFiles == null) { hgFiles = new HashSet<>(); result.put(repo, hgFiles); } hgFiles.add(new HgFile(repo.getRoot(), filePath)); }
addFile
24,969
void (@NotNull Map<HgRepository, Set<HgFile>> repositoryMap, @NotNull CommitContext commitContext) { HgRepositoryManager repositoryManager = getRepositoryManager(myProject); for (VcsRoot root : getCommitWithoutChangesRoots(commitContext)) { HgRepository repository = root.getVcs() == myVcs ? repositoryManager.getRepositoryForRoot(root.getPath()) : null; if (repository != null && !repositoryMap.containsKey(repository)) { repositoryMap.put(repository, emptySet()); } } }
addRepositoriesWithoutChanges
24,970
List<HgRevisionNumber> (List<HgRevisionNumber> branchHeadsBeforePull, List<HgRevisionNumber> branchHeadsAfterPull) { List<HgRevisionNumber> originalBranchHeadsRemaining = new ArrayList<>(); for (HgRevisionNumber headAfterPull : branchHeadsAfterPull) { if (branchHeadsBeforePull.contains(headAfterPull)) { originalBranchHeadsRemaining.add(headAfterPull); } } return originalBranchHeadsRemaining; }
determingRemainingOriginalBranchHeads
24,971
List<HgRevisionNumber> (List<HgRevisionNumber> branchHeadsBeforePull, List<HgRevisionNumber> branchHeadsAfterPull) { List<HgRevisionNumber> pulledBranchHeads = new ArrayList<>(branchHeadsAfterPull); pulledBranchHeads.removeAll(branchHeadsBeforePull); return pulledBranchHeads; }
determinePulledBranchHeads
24,972
void (VirtualFile repo, UpdatedFiles updatedFiles, HgRevisionNumber newHead, ProgressIndicator indicator) { indicator.setText2(HgBundle.message("hg4idea.update.progress.updating.to.pulled.head")); HgRevisionNumber parentBeforeUpdate = new HgWorkingCopyRevisionsCommand(project).firstParent(repo); HgUpdateCommand updateCommand = new HgUpdateCommand(project, repoRoot); updateCommand.setRevision(newHead.getChangeset()); updateCommand.setClean(true); updateCommand.execute(); HgRevisionNumber commonParent = findCommonParent(newHead, parentBeforeUpdate); addUpdatedFiles(repo, updatedFiles, commonParent, newHead); }
updateToPulledHead
24,973
void (final UpdatedFiles updatedFiles) { new HgConflictResolver(project, updatedFiles).resolve(repoRoot); }
resolvePossibleConflicts
24,974
Set<HgChange> () { HgStatusCommand statusCommand = new HgStatusCommand.Builder(true).unknown(false).ignored(false).build(project); return statusCommand.executeInCurrentThread(repoRoot); }
getLocalChanges
24,975
HgCommandExitCode (@NotNull VirtualFile repo, @NotNull ProgressIndicator indicator) { indicator.setText2(HgBundle.message("hg4idea.progress.pull.with.update")); HgPullCommand hgPullCommand = new HgPullCommand(project, repo); final String defaultPath = HgUtil.getRepositoryDefaultPath(project, repo); hgPullCommand.setSource(defaultPath); return hgPullCommand.executeInCurrentThread(); }
pull
24,976
void (List<VcsException> exceptions, @Nls String possibleWarning) { if (!StringUtil.isEmptyOrSpaces(possibleWarning)) { reportWarning(exceptions, possibleWarning); } }
handlePossibleWarning
24,977
void (List<VcsException> exceptions, @Nls String warningMessage) { VcsException warningException = new VcsException(warningMessage); warningException.setIsWarning(true); exceptions.add(warningException); }
reportWarning
24,978
void (VirtualFile repo, UpdatedFiles updatedFiles, HgRevisionNumber parentBeforeUpdate, HgRevisionNumber parentAfterUpdate) { if (parentAfterUpdate == null || parentBeforeUpdate == null) { return; } if (parentAfterUpdate.equals(parentBeforeUpdate)) { // nothing to update => returning not to capture local uncommitted changes return; } HgStatusCommand statusCommand = new HgStatusCommand.Builder(true).ignored(false).unknown(false).baseRevision(parentBeforeUpdate).targetRevision( parentAfterUpdate).build(project); Set<HgChange> changes = statusCommand.executeInCurrentThread(repo); for (HgChange change : changes) { HgFileStatusEnum status = change.getStatus(); switch (status) { case ADDED -> addToGroup(updatedFiles, change, FileGroup.CREATED_ID); case MODIFIED -> addToGroup(updatedFiles, change, FileGroup.UPDATED_ID); case DELETED -> addToGroup(updatedFiles, change, FileGroup.REMOVED_FROM_REPOSITORY_ID); case COPY -> addToGroup(updatedFiles, change, FileGroup.CHANGED_ON_SERVER_ID); default -> { //do nothing } } } }
addUpdatedFiles
24,979
void (UpdatedFiles updatedFiles, HgChange change, String id) { updatedFiles.getGroupById(id).add(change.afterFile().getFile().getAbsolutePath(), HgVcs.VCS_NAME, null); }
addToGroup
24,980
void (UpdatedFiles updatedFiles) { }
fillGroups
24,981
UpdateSession (FilePath @NotNull [] contentRoots, UpdatedFiles updatedFiles, ProgressIndicator indicator, @NotNull Ref<SequentialUpdatesContext> context) { List<VcsException> exceptions = new LinkedList<>(); boolean result = true; for (FilePath contentRoot : contentRoots) { if (indicator != null) { indicator.checkCanceled(); } VirtualFile repository = ProjectLevelVcsManager.getInstance(project).getVcsRootFor(contentRoot); if (repository == null) { continue; } try { result &= ProgressManager.getInstance().computeInNonCancelableSection(() -> { HgUpdateConfigurationSettings updateConfiguration = project.getService(HgUpdateConfigurationSettings.class); HgUpdater updater = new HgRegularUpdater(project, repository, updateConfiguration); return updater.update(updatedFiles, indicator, exceptions); }); } catch (VcsException e) { //TODO include module name where exception occurred exceptions.add(e); } } return new UpdateSessionAdapter(exceptions, !result); }
updateDirectories
24,982
Configurable (Collection<FilePath> contentRoots) { HgUpdateConfigurationSettings updateConfiguration = project.getService(HgUpdateConfigurationSettings.class); return new UpdateConfigurable(updateConfiguration); }
createConfigurable
24,983
boolean (Collection<FilePath> roots) { return true; }
validateOptions
24,984
String () { return "reference.VersionControl.Mercurial.UpdateProject"; }
getHelpTopic
24,985
JComponent () { updateDialog = new HgUpdateDialog(); return updateDialog.getContentPanel(); }
createComponent
24,986
boolean () { return true; }
isModified
24,987
void () { updateDialog.applyTo(updateConfiguration); }
apply
24,988
void () { updateDialog.updateFrom(updateConfiguration); }
reset
24,989
void () { updateDialog = null; }
disposeUIResources
24,990
void (final VirtualFile repo) { final Map<HgFile, HgResolveStatusEnum> resolves = new HgResolveCommand(myProject).getListSynchronously(repo); final List<File> conflictFiles = new ArrayList<>(); for (HgFile hgFile : resolves.keySet()) { File file = hgFile.getFile(); if (resolves.get(hgFile) == HgResolveStatusEnum.UNRESOLVED) { conflictFiles.add(file); updateUpdatedFiles(file, true); } else { updateUpdatedFiles(file, false); } } if (conflictFiles.isEmpty()) return; final HgVcs vcs = HgVcs.getInstance(myProject); if (vcs == null) return; final List<VirtualFile> conflicts = sortVirtualFilesByPresentation(findVirtualFilesWithRefresh(conflictFiles)); ApplicationManager.getApplication().invokeAndWait( () -> AbstractVcsHelper.getInstance(myProject).showMergeDialog(conflicts, vcs.getMergeProvider())); }
resolve
24,991
void (@NotNull File file, boolean unresolved) { if (updatedFiles != null) { updatedFiles.getGroupById(FileGroup.UPDATED_ID).remove(file.getAbsolutePath()); //TODO get the correct revision to pass to the UpdatedFiles updatedFiles.getGroupById(unresolved ? FileGroup.MERGED_WITH_CONFLICT_ID : FileGroup.MERGED_ID) .add(file.getPath(), HgVcs.VCS_NAME, null); } }
updateUpdatedFiles
24,992
boolean (final Project project, VirtualFile repo) { Map<HgFile, HgResolveStatusEnum> resolves = new HgResolveCommand(project).getListSynchronously(repo); return ContainerUtil.exists(resolves.values(), resolveStatus -> resolveStatus == HgResolveStatusEnum.UNRESOLVED); }
hasConflicts
24,993
void (boolean shouldPull) { myState.shouldPull = shouldPull; }
setShouldPull
24,994
void (@NotNull HgUpdateType updateType) { myState.updateType = updateType; }
setUpdateType
24,995
void (boolean shouldCommitAfterMerge) { myState.shouldCommitAfterMerge = shouldCommitAfterMerge; }
setShouldCommitAfterMerge
24,996
boolean () { return myState.shouldPull; }
shouldPull
24,997
HgUpdateType () { return myState.updateType; }
getUpdateType
24,998
boolean () { return myState.updateType == HgUpdateType.MERGE && myState.shouldCommitAfterMerge; }
shouldCommitAfterMerge
24,999
void (@NotNull HgUpdateConfigurationSettings.State state) { myState = state; }
loadState