Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
24,600
byte[] () { if (myRevisionNumber.isWorkingVersion()) return VcsUtil.getFileByteContent(myHgFile.getFile()); final HgFile fileToCat = HgUtil.getFileNameInTargetRevision(myProject, myRevisionNumber, myHgFile); return HgUtil.loadContent(myProject, myRevisionNumber, fileToCat); }
getContentAsBytes
24,601
FilePath () { if (filePath == null) { filePath = myHgFile.toFilePath(); } return filePath; }
getFile
24,602
HgRevisionNumber () { return myRevisionNumber; }
getRevisionNumber
24,603
boolean (Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } HgContentRevision revision = (HgContentRevision)o; if (!myHgFile.equals(revision.myHgFile)) { return false; } if (!myRevisionNumber.equals(revision.myRevisionNumber)) { return false; } return true; }
equals
24,604
int () { return Objects.hash(myHgFile, myRevisionNumber); }
hashCode
24,605
int (VcsRevisionNumber o) { return NULL.compareTo(o); }
compareTo
24,606
String () { return NULL.asString(); }
asString
24,607
HgRevisionNumber (@NotNull String revision,@NotNull String changeset,@NotNull String author,@NotNull String commitMessage) { return new HgRevisionNumber(revision, changeset, author, commitMessage, Collections.emptyList()); }
getInstance
24,608
HgRevisionNumber (@NotNull String revision,@NotNull String changeset) { return new HgRevisionNumber(revision, changeset, "", "", Collections.emptyList()); }
getInstance
24,609
HgRevisionNumber (@NotNull String revision,@NotNull String changeset,@NotNull List<? extends HgRevisionNumber> parents) { return new HgRevisionNumber(revision, changeset, "", "", parents); }
getInstance
24,610
HgRevisionNumber (@NotNull String revision) { return new HgRevisionNumber(revision, "", "", "", Collections.emptyList()); }
getLocalInstance
24,611
long () { return java.lang.Long.parseLong(revision); }
getRevisionAsLong
24,612
boolean () { return isWorkingVersion; }
isWorkingVersion
24,613
String () { if (revision.isEmpty()) { return changeset; } return revision + ":" + changeset; }
asString
24,614
int (VcsRevisionNumber o) { // boundary cases if (this == o) { return 0; } if (!(o instanceof HgRevisionNumber other)) { return -1; } if (changeset.equals(other.changeset)) { return 0; } // One of the revisions is local. Local is "greater" than any from the history. if (changeset.isEmpty()) { return 1; } if (other.changeset.isEmpty()) { return -1; } // compare revision numbers. final int revCompare = java.lang.Long.valueOf(getRevisionNumber()).compareTo(java.lang.Long.valueOf(other.getRevisionNumber())); if (revCompare != 0) { return revCompare; } else if (getShortHash(changeset).equals(getShortHash(other.changeset))) { //if local revision numbers are equal then it's enough to compare 12 symbols hash; collisions couldn't occur return 0; } // If they are equal, the working revision is greater. if (isWorkingVersion) { return other.isWorkingVersion ? 0 : 1; } else { return other.isWorkingVersion ? -1 : 0; } }
compareTo
24,615
String (@NotNull String changeset) { return changeset.substring(0, SHORT_HASH_SIZE); }
getShortHash
24,616
String () { if (isWorkingVersion) { return revision.substring(0, revision.length()-1); } return revision; }
getRevisionNumber
24,617
int () { // if short revision number is not empty, then short changeset is enough, a.e. annotations return Objects.hash(revision, revision.isEmpty() ? changeset : getShortHash(changeset)); }
hashCode
24,618
boolean (Object object) { if (object == this) { return true; } if (!(object instanceof HgRevisionNumber that)) { return false; } return compareTo(that) == 0; }
equals
24,619
String () { return asString(); }
toString
24,620
String () { return mySubject; }
getSubject
24,621
String () { return DISPLAY_NAME.get(); }
getDisplayName
24,622
String () { return SHORT_DISPLAY_NAME.get(); }
getShortName
24,623
HgProjectSettings () { return HgProjectSettings.getInstance(myProject); }
getProjectSettings
24,624
ChangeProvider () { return changeProvider; }
getChangeProvider
24,625
DiffProvider () { return diffProvider; }
getDiffProvider
24,626
VcsHistoryProvider () { return historyProvider; }
getVcsHistoryProvider
24,627
VcsHistoryProvider () { return getVcsHistoryProvider(); }
getVcsBlockHistoryProvider
24,628
AnnotationProvider () { return annotationProvider; }
getAnnotationProvider
24,629
MergeProvider () { return myMergeProvider; }
getMergeProvider
24,630
UpdateEnvironment () { return null; }
getIntegrateEnvironment
24,631
boolean () { return false; }
fileListenerIsSynchronous
24,632
CommittedChangesProvider () { return committedChangesProvider; }
getCommittedChangesProvider
24,633
boolean () { return true; }
allowsNestedRoots
24,634
boolean (VirtualFile dir) { return HgUtil.getNearestHgRoot(dir) != null; }
isVersionedDirectory
24,635
File () { if (myPromptHooksExtensionFile == null || !myPromptHooksExtensionFile.exists()) { // check that hooks are available myPromptHooksExtensionFile = HgUtil.getTemporaryPythonFile("prompthooks"); if (myPromptHooksExtensionFile == null || !myPromptHooksExtensionFile.exists()) { LOG.error( "prompthooks.py Mercurial extension is not found. Please reinstall " + ApplicationNamesInfo.getInstance().getProductName()); } } return myPromptHooksExtensionFile; }
getPromptHooksExtensionFile
24,636
void () { Disposable disposable = Disposer.newDisposable(); myDisposable = disposable; // validate hg executable on start and update hg version checkExecutableAndVersion(); // updaters and listeners HgRemoteStatusUpdater remoteStatusUpdater = new HgRemoteStatusUpdater(this); Disposer.register(disposable, remoteStatusUpdater); myHgRemoteStatusUpdater = remoteStatusUpdater; HgVFSListener VFSListener = HgVFSListener.createInstance(this); Disposer.register(disposable, VFSListener); // ignore temporary files final String ignoredPattern = FileTypeManager.getInstance().getIgnoredFilesList(); if (!ignoredPattern.contains(ORIG_FILE_PATTERN)) { final String newPattern = ignoredPattern + (ignoredPattern.endsWith(";") ? "" : ";") + ORIG_FILE_PATTERN; HgUtil.runWriteActionLater(() -> FileTypeManager.getInstance().setIgnoredFilesList(newPattern)); } }
activate
24,637
void () { if (!ApplicationManager.getApplication().isUnitTestMode() && getExecutableValidator().checkExecutableAndNotifyIfNeeded()) { checkVersion(); } }
checkExecutableAndVersion
24,638
void () { if (myDisposable != null) { Disposer.dispose(myDisposable); myDisposable = null; } }
deactivate
24,639
void (@NotNull @Nls String message, @NotNull ConsoleViewContentType contentType) { if (message.length() > MAX_CONSOLE_OUTPUT_SIZE) { message = message.substring(0, MAX_CONSOLE_OUTPUT_SIZE); } ProjectLevelVcsManager.getInstance(myProject).addMessageToConsoleWindow(message, contentType); }
showMessageInConsole
24,640
HgExecutableValidator () { synchronized (myExecutableValidatorLock) { if (myExecutableValidator == null) { myExecutableValidator = new HgExecutableValidator(myProject); } return myExecutableValidator; } }
getExecutableValidator
24,641
List<CommitExecutor> () { if (exists(HgUtil.getRepositoryManager(myProject).getRepositories(), r -> r.getRepositoryConfig().isMqUsed())) { return List.of(myCommitAndPushExecutor, myMqNewExecutor); } return List.of(myCommitAndPushExecutor); }
getCommitExecutors
24,642
VcsKey () { return ourKey; }
getKey
24,643
VcsType () { return VcsType.distributed; }
getType
24,644
void (@Nullable VirtualFile targetDirectory) { new Task.Backgroundable(myProject, HgBundle.message("progress.title.enabling.hg"), true) { @Override public void run(@NotNull ProgressIndicator indicator) { new HgIntegrationEnabler(HgVcs.this, targetDirectory).detectAndEnable(); } }.queue(); }
enableIntegration
24,645
void (@NotNull ProgressIndicator indicator) { new HgIntegrationEnabler(HgVcs.this, targetDirectory).detectAndEnable(); }
run
24,646
CheckoutProvider () { return new HgCheckoutProvider(); }
getCheckoutProvider
24,647
void () { final String executable = HgExecutableManager.getInstance().getHgExecutable(myProject); VcsNotifier vcsNotifier = VcsNotifier.getInstance(myProject); final String SETTINGS_LINK = "settings"; final String UPDATE_LINK = "update"; NotificationListener linkAdapter = new NotificationListener.Adapter() { @Override protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) { if (SETTINGS_LINK.equals(e.getDescription())) { ShowSettingsUtil.getInstance().showSettingsDialog(myProject, HgProjectConfigurable.class); } else if (UPDATE_LINK.equals(e.getDescription())) { BrowserUtil.browse("http://mercurial.selenic.com"); } } }; try { myVersion = HgVersion.identifyVersion(myProject, executable); //if version is not supported, but have valid hg executable if (!myVersion.isSupported()) { LOG.info("Unsupported Hg version: " + myVersion); String message = HgBundle.message("hg4idea.version.update", SETTINGS_LINK, myVersion, HgVersion.MIN, UPDATE_LINK); vcsNotifier.notifyError(UNSUPPORTED_VERSION, HgBundle.message("hg4idea.version.unsupported"), message, linkAdapter); } else if (myVersion.hasUnsupportedExtensions()) { String unsupportedExtensionsAsString = myVersion.getUnsupportedExtensions().toString(); LOG.warn("Unsupported Hg extensions: " + unsupportedExtensionsAsString); String message = HgBundle.message("hg4idea.version.unsupported.ext", unsupportedExtensionsAsString); vcsNotifier.notifyWarning(UNSUPPORTED_EXT, HgBundle.message("hg4idea.version.unsupported"), message); } } catch (Exception e) { if (getExecutableValidator().checkExecutableAndNotifyIfNeeded()) { //sometimes not hg application has version command, but we couldn't parse an answer as valid hg, // so parse(output) throw ParseException, but hg and git executable seems to be valid in this case final String reason = (e.getCause() != null ? e.getCause() : e).getMessage(); String message = HgBundle.message("hg4idea.unable.to.run.hg", executable); vcsNotifier.notifyError(UNABLE_TO_RUN_EXEC, message, HgBundle.message("hg4idea.exec.not.found", reason, SETTINGS_LINK), linkAdapter ); } } }
checkVersion
24,648
void (@NotNull Notification notification, @NotNull HyperlinkEvent e) { if (SETTINGS_LINK.equals(e.getDescription())) { ShowSettingsUtil.getInstance().showSettingsDialog(myProject, HgProjectConfigurable.class); } else if (UPDATE_LINK.equals(e.getDescription())) { BrowserUtil.browse("http://mercurial.selenic.com"); } }
hyperlinkActivated
24,649
HgVersion () { return myVersion; }
getVersion
24,650
Hash () { return myHash; }
getHash
24,651
String () { return myName; }
getName
24,652
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HgNameWithHashInfo info = (HgNameWithHashInfo)o; return (myName.equals(info.myName)) && myHash.equals(info.myHash); }
equals
24,653
int () { return Objects.hash(myName, myHash); }
hashCode
24,654
State () { return myState; }
getState
24,655
void (@NotNull State state) { myState = state; }
loadState
24,656
HgProjectSettings (@NotNull Project project) { return project.getService(HgProjectSettings.class); }
getInstance
24,657
void (@Nullable String path) { myState.PATH_TO_EXECUTABLE = path; }
setHgExecutable
24,658
boolean () { return myState.OVERRIDE_APPLICATION_PATH_TO_EXECUTABLE; }
isHgExecutableOverridden
24,659
void (boolean overridden) { myState.OVERRIDE_APPLICATION_PATH_TO_EXECUTABLE = overridden; }
setHgExecutableOverridden
24,660
void (@NotNull String recentRootPath) { myState.RECENT_HG_ROOT_PATH = recentRootPath; }
setRecentRootPath
24,661
boolean () { return myState.CHECK_INCOMING_OUTGOING; }
isCheckIncomingOutgoing
24,662
void (boolean checkIncomingOutgoing) { if (myState.CHECK_INCOMING_OUTGOING != checkIncomingOutgoing) { myState.CHECK_INCOMING_OUTGOING = checkIncomingOutgoing; BackgroundTaskUtil.syncPublisher(myProject, HgVcs.INCOMING_OUTGOING_CHECK_TOPIC).updateVisibility(); } }
setCheckIncomingOutgoing
24,663
Value () { return myState.ROOT_SYNC; }
getSyncSetting
24,664
void (@NotNull Value syncSetting) { myState.ROOT_SYNC = syncSetting; }
setSyncSetting
24,665
boolean () { return myState.SWAP_SIDES_IN_COMPARE_BRANCHES; }
shouldSwapSidesInCompareBranches
24,666
void (boolean value) { myState.SWAP_SIDES_IN_COMPARE_BRANCHES = value; }
setSwapSidesInCompareBranches
24,667
boolean () { return myState.myIgnoreWhitespacesInAnnotations; }
isWhitespacesIgnoredInAnnotations
24,668
void (boolean ignoreWhitespacesInAnnotations) { if (myState.myIgnoreWhitespacesInAnnotations != ignoreWhitespacesInAnnotations) { myState.myIgnoreWhitespacesInAnnotations = ignoreWhitespacesInAnnotations; BackgroundTaskUtil.syncPublisher(myProject, VcsAnnotationRefresher.LOCAL_CHANGES_CHANGED).configurationChanged(HgVcs.getKey()); } }
setIgnoreWhitespacesInAnnotations
24,669
DvcsBranchSettings () { return myState.BRANCH_SETTINGS; }
getBranchSettings
24,670
DvcsRememberedInputs () { return ApplicationManager.getApplication().getService(HgRememberedInputs.class); }
getInstance
24,671
boolean (@Nullable String name) { return !StringUtil.isEmptyOrSpaces(name) && !containsIllegalSymbols(name) && !hasConflictsWithAnotherNames(name); }
checkInput
24,672
boolean (@Nullable String name) { myErrorText = myRepository.getAllPatchNames().contains(name) ? HgBundle.message("action.hg4idea.mq.duplicated.name", name) : null; return myErrorText != null; }
hasConflictsWithAnotherNames
24,673
void (final Project project, final VirtualFile file) { VfsUtil.markDirtyAndRefresh(true, true, false, file); VcsDirtyScopeManager.getInstance(project).dirDirtyRecursively(file); }
markDirectoryDirty
24,674
void (final @NotNull Runnable runnable) { ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(runnable)); }
runWriteActionLater
24,675
boolean (@Nullable VirtualFile dir) { return dir != null && dir.findChild(DOT_HG) != null; }
isHgRoot
24,676
Set<VirtualFile> (@NotNull Project project, @NotNull Collection<? extends FilePath> filePaths) { HashSet<VirtualFile> roots = new HashSet<>(); for (FilePath path : filePaths) { ContainerUtil.addIfNotNull(roots, getHgRootOrNull(project, path)); } return roots; }
hgRoots
24,677
HgFile (Project project, HgRevisionNumber vcsRevisionNumber, HgFile localHgFile) { //get file name in target revision if it was moved/renamed // if file was moved but not committed then hg status would return nothing, so it's better to point working dir as '.' revision HgStatusCommand statCommand = new HgStatusCommand.Builder(false).copySource(true).baseRevision(vcsRevisionNumber). targetRevision(HgRevisionNumber.getInstance("", ".")).build(project); Set<HgChange> changes = statCommand.executeInCurrentThread(localHgFile.getRepo(), Collections.singletonList(localHgFile.toFilePath())); for (HgChange change : changes) { if (change.afterFile().equals(localHgFile)) { return change.beforeFile(); } } return localHgFile; }
getFileNameInTargetRevision
24,678
FilePath (@NotNull FilePath filePath, ChangeListManager changeListManager) { Change change = changeListManager.getChange(filePath); if (change == null) { return filePath; } FileStatus status = change.getFileStatus(); if (status == HgChangeProvider.COPIED || status == HgChangeProvider.RENAMED) { ContentRevision beforeRevision = change.getBeforeRevision(); assert beforeRevision != null : "If a file's status is copied or renamed, there must be an previous version"; return beforeRevision.getFile(); } else { return filePath; } }
getOriginalFileName
24,679
List<Change> (final @NotNull Project project, final @NotNull VirtualFile root, final @NotNull FilePath path, final @Nullable HgRevisionNumber revNum1, final @Nullable HgRevisionNumber revNum2) { HgStatusCommand statusCommand; if (revNum1 != null) { //rev2==null means "compare with local version" statusCommand = new HgStatusCommand.Builder(true).ignored(false).unknown(false).copySource(!path.isDirectory()).baseRevision(revNum1) .targetRevision(revNum2).build(project); } else { LOG.assertTrue(revNum2 != null, "revision1 and revision2 can't both be null. Path: " + path); //rev1 and rev2 can't be null both// //get initial changes// statusCommand = new HgStatusCommand.Builder(true).ignored(false).unknown(false).copySource(false).baseRevision(revNum2) .build(project); } Collection<HgChange> hgChanges = statusCommand.executeInCurrentThread(root, Collections.singleton(path)); return createChanges(project, root, revNum1, revNum2, hgChanges); }
getDiff
24,680
List<Change> (@NotNull Project project, @NotNull VirtualFile root, @Nullable HgRevisionNumber revNum1, @Nullable HgRevisionNumber revNum2, Collection<HgChange> hgChanges) { List<Change> changes = new ArrayList<>(); //convert output changes to standard Change class for (HgChange hgChange : hgChanges) { FileStatus status = convertHgDiffStatus(hgChange.getStatus()); if (status != FileStatus.UNKNOWN) { changes.add(HgHistoryUtil.createChange(project, root, hgChange.beforeFile().getRelativePath(), revNum1, hgChange.afterFile().getRelativePath(), revNum2, status)); } } return changes; }
createChanges
24,681
FileStatus (@NotNull HgFileStatusEnum hgstatus) { if (hgstatus.equals(HgFileStatusEnum.ADDED)) { return FileStatus.ADDED; } else if (hgstatus.equals(HgFileStatusEnum.DELETED)) { return FileStatus.DELETED; } else if (hgstatus.equals(HgFileStatusEnum.MODIFIED)) { return FileStatus.MODIFIED; } else if (hgstatus.equals(HgFileStatusEnum.COPY)) { return HgChangeProvider.COPIED; } else if (hgstatus.equals(HgFileStatusEnum.UNVERSIONED)) { return FileStatus.UNKNOWN; } else if (hgstatus.equals(HgFileStatusEnum.IGNORED)) { return FileStatus.IGNORED; } else { return FileStatus.UNKNOWN; } }
convertHgDiffStatus
24,682
HgRepositoryManager (@NotNull Project project) { return project.getService(HgRepositoryManager.class); }
getRepositoryManager
24,683
Collection<String> (@NotNull Project project, @NotNull VirtualFile root) { HgRepository hgRepository = getRepositoryManager(project).getRepositoryForRootQuick(root); assert hgRepository != null : "Repository can't be null for root " + root.getName(); return hgRepository.getRepositoryConfig().getPaths(); }
getRepositoryPaths
24,684
boolean (@NotNull Project project, @Nullable String executable) { try { if (StringUtil.isEmptyOrSpaces(executable)) { return false; } HgCommandResult result = getVersionOutput(project, executable); return result.getExitValue() == 0 && !result.getRawOutput().isEmpty(); } catch (Throwable e) { LOG.info("Error during hg executable validation: ", e); return false; } }
isExecutableValid
24,685
List<String> (Collection<? extends HgNameWithHashInfo> namesWithHashes) { //return names without duplication (actually for several heads in one branch) List<String> names = new ArrayList<>(); for (HgNameWithHashInfo hash : namesWithHashes) { if (!names.contains(hash.getName())) { names.add(hash.getName()); } } return names; }
getNamesWithoutHashes
24,686
List<String> (Collection<? extends HgNameWithHashInfo> namesWithHashes) { return StreamEx.of(getNamesWithoutHashes(namesWithHashes)).sorted(StringUtil::naturalCompare).toList(); }
getSortedNamesWithoutHashes
24,687
Couple<String> (@NotNull String authorString) { //special characters should be retained for properly filtering by username. For Mercurial "a.b" username is not equal to "a b" // Vasya Pupkin <vasya.pupkin@jetbrains.com> -> Vasya Pupkin , vasya.pupkin@jetbrains.com int startEmailIndex = authorString.indexOf('<'); int startDomainIndex = authorString.indexOf('@'); int endEmailIndex = authorString.indexOf('>'); String userName; String email; if (0 < startEmailIndex && startEmailIndex < startDomainIndex && startDomainIndex < endEmailIndex) { email = authorString.substring(startEmailIndex + 1, endEmailIndex); userName = authorString.substring(0, startEmailIndex).trim(); } // vasya.pupkin@email.com || <vasya.pupkin@email.com> else if (!authorString.contains(" ") && startDomainIndex > 0) { //simple e-mail check. john@localhost userName = ""; if (startEmailIndex >= 0 && startDomainIndex > startEmailIndex && startDomainIndex < endEmailIndex) { email = authorString.substring(startEmailIndex + 1, endEmailIndex).trim(); } else { email = authorString; } } else { userName = authorString.trim(); email = ""; } return Couple.of(userName, email); }
parseUserNameAndEmail
24,688
Set<String> (@NotNull List<String> errorLines) { // hg version command execute with null start directory, // but hgrc configuration file may be related to one of repository then extension may be failed to import too //before fixed use command exit value instead if errors.isEmpty //todo store all unsupported extensions for all repository and notify once Set<String> extensions = new HashSet<>(); if (errorLines.isEmpty()) { return extensions; } for (String line : errorLines) { Matcher matcher = HG_UNSUPPORTED_EXTENSION.matcher(line); if (matcher.matches()) { extensions.add(matcher.group(1)); } } return extensions; }
parseUnsupportedExtensions
24,689
int (@NotNull Matcher matcher, int group) { if (group > matcher.groupCount() + 1) { return 0; } final String match = matcher.group(group); if (StringUtil.isEmptyOrSpaces(match)) { return 0; } return Integer.parseInt(match); }
getIntGroup
24,690
boolean () { return compareTo(MIN) >= 0; }
isSupported
24,691
boolean () { return compareTo(AMEND_SUPPORTED) >= 0; }
isAmendSupported
24,692
boolean () { return compareTo(BUILT_IN_FUNCTION_SUPPORTED) >= 0; }
isBuiltInFunctionSupported
24,693
boolean () { return compareTo(LARGEFILES_WITH_FOLLOW_SUPPORTED) >= 0; }
isLargeFilesWithFollowSupported
24,694
boolean () { return compareTo(PARENT_REVISION_TEMPLATES_SUPPORTED) >= 0; }
isParentRevisionTemplateSupported
24,695
boolean () { return compareTo(IGNORE_WHITESPACE_DIFF_IN_ANNOTATIONS) >= 0; }
isIgnoreWhitespaceDiffInAnnotationsSupported
24,696
boolean () { return compareTo(BRANCH_HEADS_BASE_SERVED_FILE_EXIST) >= 0 && compareTo(BRANCH2_FILE_EXIST) < 0; }
hasBranchHeadsBaseServed
24,697
boolean () { return compareTo(BRANCH2_FILE_EXIST) >= 0; }
hasBranch2
24,698
boolean () { return !myUnsupportedExtensions.isEmpty(); }
hasUnsupportedExtensions
24,699
Set<String> () { return myUnsupportedExtensions; }
getUnsupportedExtensions