Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
42,000
void () { GitPushNativeResult branchResult = new GitPushNativeResult(UP_TO_DATE, "refs/heads/master"); GitPushNativeResult tagResult = new GitPushNativeResult(NEW_REF, "refs/tags/v0.1"); GitPushResultNotification notification = notification(convertFromNative(branchResult, singletonList(tagResult), 0, from("master"), to...
test_only_tags
42,001
void () { GitPushNativeResult branchSuccess = new GitPushNativeResult(SUCCESS, "refs/heads/master"); GitPushNativeResult branchUpToDate = new GitPushNativeResult(UP_TO_DATE, "refs/heads/master"); GitPushNativeResult tagResult = new GitPushNativeResult(NEW_REF, "refs/tags/v0.1"); final GitPushRepoResult comRes = convert...
test_two_repo_with_tags
42,002
void () { GitPushNativeResult branchResult = new GitPushNativeResult(UP_TO_DATE, "refs/heads/master"); GitPushNativeResult tag1 = new GitPushNativeResult(NEW_REF, "refs/tags/v0.1"); GitPushNativeResult tag2 = new GitPushNativeResult(NEW_REF, "refs/tags/v0.2"); GitPushResultNotification notification = notification(conve...
test_two_tags
42,003
GitPushRepoResult (GitPushNativeResult.Type nativeType, String from, String to, int commits) { return repoResult(nativeType, from, to, commits, null); }
repoResult
42,004
GitPushRepoResult (GitPushNativeResult.Type nativeType, String from, String to, int commits, @Nullable GitUpdateResult updateResult) { String reason = nativeType == REJECTED ? GitPushNativeResult.FETCH_FIRST_REASON : null; GitPushNativeResult nr = new GitPushNativeResult(nativeType, from, reason, null); return GitPushR...
repoResult
42,005
GitPushRepoResult (GitPushNativeResult.Type nativeType, String from, String to, String errorText) { return GitPushRepoResult.error(from(from), to(to), errorText); }
repoResult
42,006
GitPushSource (String from) { return GitPushSource.create(new GitLocalBranch(from)); }
from
42,007
GitRemoteBranch (String to) { int firstSlash = to.indexOf('/'); GitRemote remote = new GitRemote(to.substring(0, firstSlash), Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList()); return new GitStandardRemoteBranch(remote, to.substring(firstSlash + 1)); }
to
42,008
GitPushResultNotification (GitPushRepoResult singleResult) { return notification(Collections.singletonMap(repo("community"), singleResult)); }
notification
42,009
GitPushResultNotification (Map<GitRepository, GitPushRepoResult> map) { boolean wasUpdatePerformed = ContainerUtil.exists(map.values(), aNew -> aNew.getUpdateResult() != null); UpdatedFiles updatedFiles = UpdatedFiles.create(); if (wasUpdatePerformed) { updatedFiles.getTopLevelGroups().get(0).add("file.txt", "Git", nul...
notification
42,010
void (@NotNull NotificationType type, @NotNull String title, @NotNull String content, @NotNull GitPushResultNotification actual) { assertNotification(type, "", emulateTitle(title, content), actual); }
assertPushNotification
42,011
MockGitRepository (final String name) { final Ref<VirtualFile> root = Ref.create(); EdtTestUtil.runInEdtAndWait(() -> root.set(createChildData(PlatformTestUtil.getOrCreateProjectBaseDir(ourProject), name))); return new MockGitRepository(ourProject, root.get()); }
repo
42,012
void () { super.setUp(); addRemote("origin"); }
setUp
42,013
void () { GitPushTarget target = GitPushTarget.getFromPushSpec(repo, Objects.requireNonNull(this.repo.getCurrentBranch())); assertNull(target); }
test_no_push_spec
42,014
void () { setPushSpec("origin", "HEAD:refs/for/master"); assertSpecialTargetRef("refs/for/master", "origin"); }
test_refs_for_master
42,015
void () { setPushSpec("origin", "refs/heads/*:refs/for/*"); assertSpecialTargetRef("refs/for/master", "origin"); }
test_wildcard_special_ref
42,016
void () { addRemote("my/remote"); setPushSpec("my/remote", "HEAD:refs/for/master"); setTracking("master", "my/remote", "refs/heads/master"); assertSpecialTargetRef("refs/for/master", "my/remote"); }
test_complex_remote_name
42,017
void () { setPushSpec("origin", "refs/heads/*:refs/remotes/origin/*"); assertStandardRemoteBranch("master", Objects.requireNonNull(this.repo.getBranches().findBranchByName("origin/master"))); }
test_standard_fetch_refspec
42,018
void () { addRemote("github"); setPushSpec("origin", "HEAD:refs/for/origin"); setPushSpec("github", "HEAD:refs/for/github"); setTracking("master", "github", "refs/heads/master"); assertSpecialTargetRef("refs/for/github", "github"); }
test_tracked_remote_is_preferable_over_origin
42,019
void (@NotNull String remoteName) { git(String.format("remote add %s http://example.git", remoteName)); git(String.format("update-ref refs/remotes/%s/master HEAD", remoteName)); repo.update(); }
addRemote
42,020
void (@NotNull String remote, @NotNull String pushSpec) { git(String.format("config remote.%s.push %s", remote, pushSpec)); repo.update(); }
setPushSpec
42,021
void (@NotNull String branch, @NotNull String remote, @NotNull String remoteBranch) { git(String.format("config branch.%s.remote %s", branch, remote)); git(String.format("config branch.%s.merge %s", branch, remoteBranch)); repo.update(); }
setTracking
42,022
void (@NotNull String expectedRefName, @NotNull String expectedRemoteName) { GitPushTarget target = GitPushTarget.getFromPushSpec(repo, Objects.requireNonNull(this.repo.getCurrentBranch())); assertNotNull(target); assertTrue(target.isSpecialRef()); assertEquals(expectedRefName, target.getPresentation()); GitRemoteBranc...
assertSpecialTargetRef
42,023
void (@NotNull String nameForLocalOperations, @NotNull String nameForRemoteOperations, @NotNull String remoteName, @NotNull GitRemoteBranch actualRemoteBranch) { assertEquals(nameForLocalOperations, actualRemoteBranch.getNameForLocalOperations()); assertEquals(nameForRemoteOperations, actualRemoteBranch.getNameForRemot...
assertRemoteBranch
42,024
void (@NotNull String expectedPresentation, @NotNull GitBranch expectedBranch) { GitPushTarget target = GitPushTarget.getFromPushSpec(repo, Objects.requireNonNull(this.repo.getCurrentBranch())); assertNotNull(target); assertFalse(target.isSpecialRef()); assertEquals(expectedPresentation, target.getPresentation()); GitR...
assertStandardRemoteBranch
42,025
void () { assertInvalid("Stars should be in both parts of spec", "HEAD:refs/heads/*"); assertInvalid("Stars should be in both parts of spec", "refs/heads/*:refs/for/master"); assertInvalid("Star should be at the last position", "refs/for/*/branch:refs/for/*"); assertInvalid("Star should be at the last position", "refs/...
test_star_position
42,026
void () { assertTarget("master", "+refs/heads/*:refs/remotes/origin/*", "refs/remotes/origin/master"); }
test_branch_name_substitution
42,027
void () { assertTarget("qa/ticket1", "refs/heads/qa/*:refs/remotes/origin/qa/*", "refs/remotes/origin/qa/ticket1"); }
test_complex_branch_name_can_be_partially_wildcarded
42,028
void () { List<String> specs = Arrays.asList("+refs/heads/master:refs/remotes/origin/master", "refs/heads/qa/*:refs/remotes/origin/qa/*"); assertEquals("refs/remotes/origin/qa/ticket1", getTargetRef("qa/ticket1", specs)); assertEquals("refs/remotes/origin/master", getTargetRef("master", specs)); assertNull(getTargetRef...
test_one_of_several_specs_matches
42,029
String (@NotNull String sourceBranch, @NotNull List<String> specs) { GitRepository myRepo = Mockito.mock(GitRepository.class); return GitPushSpecParser.getTargetRef(myRepo, sourceBranch, specs); }
getTargetRef
42,030
void (@NotNull String sourceBranch, @NotNull String spec, @NotNull String expectedTarget) { assertEquals(expectedTarget, getTargetRef(sourceBranch, Collections.singletonList(spec))); }
assertTarget
42,031
void (@NotNull String message, @NotNull String spec) { assertNull(message, getTargetRef("master", Collections.singletonList(spec))); }
assertInvalid
42,032
void (@NotNull String message, @NotNull String spec) { assertNotNull(message, getTargetRef("master", Collections.singletonList(spec))); }
assertValid
42,033
Collection<Object[]> () { File pluginRoot = new File(PluginPathManager.getPluginHomePath("git4idea")); File dataDir = new File(new File(pluginRoot, "testData"), "repo"); File[] testCases = dataDir.listFiles(FileFilters.DIRECTORIES); return ContainerUtil.map(testCases, file -> new Object[] { file.getName(), file }); }
data
42,034
void () { if (myTempDir != null) { FileUtil.delete(myTempDir); } }
after
42,035
Branch (@NotNull String branch) { List<String> branchAndHash = StringUtil.split(branch, " "); return new Branch(branchAndHash.get(1), HashImpl.build(branchAndHash.get(0))); }
readBranchFromLine
42,036
void (@NotNull Branch expected, @NotNull GitLocalBranch actual, @NotNull Hash hash) { assertEquals(expected.name, actual.getName()); assertEquals("Incorrect hash of branch " + actual.getName(), expected.hash, hash); }
assertEqualBranches
42,037
void (Map<? extends GitBranch, Hash> actualBranches, Collection<Branch> expectedBranches) { VcsTestUtil.assertEqualCollections(actualBranches.entrySet(), expectedBranches, new VcsTestUtil.EqualityChecker<Map.Entry<? extends GitBranch, Hash>, Branch>() { @Override public boolean areEqual(Map.Entry<? extends GitBranch, H...
assertBranches
42,038
boolean (Map.Entry<? extends GitBranch, Hash> actual, Branch expected) { return branchesAreEqual(actual.getKey(), actual.getValue(), expected); }
areEqual
42,039
boolean (GitBranch actualBranch, Hash actualHash, Branch expected) { return actualBranch.getFullName().equals(expected.name) && actualHash.equals(expected.hash); }
branchesAreEqual
42,040
String () { return name; }
toString
42,041
GitUserRegistry (@NotNull Project project) { return project.getService(GitUserRegistry.class); }
getInstance
42,042
void () { myProject.getMessageBus().connect(this).subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, this); directoryMappingChanged(); }
activate
42,043
void () { myUserMap.clear(); }
dispose
42,044
void () { final VirtualFile[] roots = ProjectLevelVcsManager.getInstance(myProject).getRootsUnderVcs(GitVcs.getInstance(myProject)); final Collection<VirtualFile> rootsToCheck = ContainerUtil.filter(roots, root -> getUser(root) == null); if (!rootsToCheck.isEmpty()) { Runnable task = () -> { for (VirtualFile root : roo...
directoryMappingChanged
42,045
boolean () { return true; }
isRemote
42,046
Set<FilePath> () { Changes changesObject = getChangesObject(); if (changesObject instanceof UnparsedChanges) { Set<FilePath> result = new HashSet<>(); for (VcsFileStatusInfo statusInfo : ((UnparsedChanges)changesObject).getMergedStatuses()) { result.add(GitContentRevision.createPath(getRoot(), statusInfo.getFirstPath()...
getAffectedPaths
42,047
GitCommitRequirements () { return myRequirements; }
getRequirements
42,048
List<Change> (@NotNull Project project, @NotNull VcsShortCommitDetails commit, @NotNull List<VcsFileStatusInfo> changes, int parentIndex) { String parentHash = null; if (parentIndex < commit.getParents().size()) { parentHash = commit.getParents().get(parentIndex).asString(); } return git4idea.history.GitChangesParser.p...
parseStatusInfo
42,049
GitBranch () { return myLocal; }
getLocal
42,050
GitBranch () { return myRemote; }
getRemote
42,051
String () { return myRevisionHash; }
asString
42,052
String () { return DvcsUtil.getShortHash(myRevisionHash); }
toShortString
42,053
Date () { return myTimestamp; }
getTimestamp
42,054
String () { return myRevisionHash; }
getRev
42,055
String () { return toShortString(); }
getShortRev
42,056
int (VcsRevisionNumber crev) { if (this == crev) return 0; if (crev instanceof GitRevisionNumber other) { if (myRevisionHash.equals(other.myRevisionHash)) { return 0; } if (other.myRevisionHash.indexOf("[") > 0) { return myTimestamp.compareTo(other.myTimestamp); } // check for parent revs String otherName = null; Strin...
compareTo
42,057
boolean (Object obj) { if (this == obj) return true; if ((obj == null) || (obj.getClass() != getClass())) return false; GitRevisionNumber test = (GitRevisionNumber)obj; // TODO normalize revision string? return myRevisionHash.equals(test.myRevisionHash); }
equals
42,058
int () { return myRevisionHash.hashCode(); }
hashCode
42,059
String () { return myRevisionHash; }
toString
42,060
Date (@NonNls String value) { final long parsed; parsed = Long.parseLong(value.trim()); return new Date(parsed * 1000); }
parseTimestamp
42,061
Date (@NonNls String value, GitHandler handler, String gitOutput) { try { return parseTimestamp(value); } catch (NumberFormatException e) { LOG.error("annotate(). NFE. Handler: " + handler + ". Output: " + gitOutput, e); return new Date(); } }
parseTimestampWithNFEReport
42,062
boolean (@NotNull File folder) { try { return isGitRoot(folder.toPath()); } catch (InvalidPathException e) { LOG.warn(e.getMessage()); return false; } }
isGitRoot
42,063
boolean (@NotNull VirtualFile vFile) { try { return findGitRootFor(vFile.toNioPath()) != null; } catch (InvalidPathException e) { LOG.warn(e.getMessage()); return false; } }
isUnderGit
42,064
boolean (@NotNull FilePath path) { try { return findGitRootFor(Paths.get(path.getPath())) != null; } catch (InvalidPathException e) { LOG.warn(e.getMessage()); return false; } }
isUnderGit
42,065
boolean (Project project) { if (project.isDisposed()) { return true; } GitRepositoryManager manager = getRepositoryManager(project); return !manager.moreThanOneRoot(); }
justOneGitRepository
42,066
GitRemoteBranch (@NotNull GitRepository repository, @NotNull GitRemote remote, @NotNull @NonNls String branchName) { GitRemoteBranch remoteBranch = findRemoteBranch(repository, remote, branchName); return ObjectUtils.notNull(remoteBranch, new GitStandardRemoteBranch(remote, branchName)); }
findOrCreateRemoteBranch
42,067
Collection<VirtualFile> (@NotNull Collection<? extends GitRepository> repositories) { return ContainerUtil.map(repositories, Repository::getRoot); }
getRootsFromRepositories
42,068
Collection<GitRepository> (@NotNull GitRepositoryManager repositoryManager, @NotNull Collection<? extends VirtualFile> roots) { Collection<GitRepository> repositories = new ArrayList<>(roots.size()); for (VirtualFile root : roots) { GitRepository repo = repositoryManager.getRepositoryForRoot(root); if (repo == null) { ...
getRepositoriesFromRoots
42,069
GitRepositoryManager (@NotNull Project project) { return GitRepositoryManager.getInstance(project); }
getRepositoryManager
42,070
boolean (@Nullable VcsRoot root) { if (root == null) return false; AbstractVcs vcs = root.getVcs(); if (vcs == null) return false; return GitVcs.getKey().equals(vcs.getKeyInstanceMethod()); }
isGitVcsRoot
42,071
void (final Project project, @NonNls String revision, final VirtualFile file, final boolean local, final boolean revertable) { new Task.Backgroundable(project, GitBundle.message("changes.retrieving", revision)) { @Override public void run(@NotNull ProgressIndicator indicator) { indicator.setIndeterminate(true); try { V...
showSubmittedFiles
42,072
void (@NotNull ProgressIndicator indicator) { indicator.setIndeterminate(true); try { VirtualFile vcsRoot = getRootForFile(project, file); final CommittedChangeList changeList = GitChangeUtils.getRevisionChanges(project, vcsRoot, revision, true, local, revertable); UIUtil.invokeLaterIfNeeded( () -> AbstractVcsHelper.ge...
run
42,073
String (@NotNull VirtualFile root, @NotNull @NonNls String relativePath) { return StringUtil.trimEnd(root.getPath(), "/") + "/" + StringUtil.trimStart(relativePath, "/"); }
toAbsolute
42,074
Collection<String> (final @NotNull VirtualFile root, @NotNull Collection<@NonNls String> relativePaths) { return ContainerUtil.map(relativePaths, s -> toAbsolute(root, s)); }
toAbsolute
42,075
List<Change> (@NotNull Project project, @NotNull VirtualFile root, @NotNull Collection<@NonNls String> affectedPaths, boolean relativePaths) { ChangeListManagerEx changeListManager = ChangeListManagerEx.getInstanceEx(project); List<Change> affectedChanges = new ArrayList<>(); for (String path : affectedPaths) { String ...
findLocalChangesForPaths
42,076
void (@NotNull Project project, @NotNull Collection<@NonNls String> absolutePaths, @NotNull @NlsContexts.DialogTitle String title, @Nullable @NlsContexts.DialogMessage String description) { DialogBuilder builder = new DialogBuilder(project); builder.setCenterPanel(new GitSimplePathsBrowser(project, absolutePaths)); if ...
showPathsInDialog
42,077
String (@NotNull Collection<? extends GitRepository> repositories) { return StringUtil.join(repositories, repository -> repository.getPresentableUrl(), UIUtil.BR); }
joinToHtml
42,078
void (@NotNull Collection<? extends GitRepository> repositories) { for (GitRepository repository : repositories) { repository.update(); } }
updateRepositories
42,079
boolean (@NotNull Project project) { return !getRepositories(project).isEmpty(); }
hasGitRepositories
42,080
Collection<GitRepository> (@NotNull Project project) { return getRepositoryManager(project).getRepositories(); }
getRepositories
42,081
Collection<GitRepository> (@NotNull Project project, @NotNull Repository.State state) { return ContainerUtil.filter(getRepositories(project), repository -> repository.getState() == state); }
getRepositoriesInState
42,082
boolean (@NotNull @NonNls String oldPath, @NotNull @NonNls String newPath) { if (oldPath.equalsIgnoreCase(newPath)) { if (oldPath.equals(newPath)) { LOG.info("Comparing perfectly equal paths: " + newPath); } return true; } return false; }
isCaseOnlyChange
42,083
Collection<Change> (@NotNull ChangeListManager changeListManager, @NotNull Collection<? extends Change> originalChanges) { ObjectOpenHashSet<Change> allChanges = new ObjectOpenHashSet<>(changeListManager.getAllChanges()); return ContainerUtil.mapNotNull(originalChanges, allChanges::get); }
findCorrespondentLocalChanges
42,084
void (@NotNull VirtualFile root, @Nullable Collection<? extends Change> changes) { if (changes == null || Registry.is("git.refresh.vfs.total")) { refreshVfsInRoot(root); } else { RefreshVFsSynchronously.updateChanges(changes); } }
refreshVfs
42,085
void (@NotNull VirtualFile root) { refreshVfsInRoots(Collections.singleton(root)); }
refreshVfsInRoot
42,086
void (@NotNull Collection<VirtualFile> roots) { RefreshVFsSynchronously.trace("refresh roots " + roots); VfsUtil.markDirtyAndRefresh(false, true, false, roots.toArray(VirtualFile.EMPTY_ARRAY)); }
refreshVfsInRoots
42,087
void (@NotNull GitRepository repository, @Nullable Hash startHash) { repository.update(); refreshChangedVfs(repository, startHash); }
updateAndRefreshChangedVfs
42,088
void (@NotNull GitRepository repository, @Nullable Hash startHash) { Collection<Change> changes = null; if (startHash != null) { Hash currentHash = getHead(repository); if (currentHash != null) { RefreshVFsSynchronously.trace(String.format("changes: %s -> %s", startHash.asString(), currentHash.asString())); changes = G...
refreshChangedVfs
42,089
boolean (@NotNull @NonNls String rootDir) { try { return isGitRoot(Paths.get(rootDir)); } catch (InvalidPathException e) { LOG.warn(e.getMessage()); return false; } }
isGitRoot
42,090
boolean (@NotNull Path rootDir) { Path dotGit = rootDir.resolve(DOT_GIT); BasicFileAttributes attributes; try { attributes = Files.readAttributes(dotGit, BasicFileAttributes.class); } catch (IOException ignore) { return false; } if (attributes.isDirectory()) { try { BasicFileAttributes headExists = Files.readAttributes...
isGitRoot
42,091
void (@NotNull Project project, @NotNull VirtualFile ignoreFileRoot) { VcsImplUtil.generateIgnoreFileIfNeeded(project, GitVcs.getInstance(project), ignoreFileRoot); }
generateGitignoreFileIfNeeded
42,092
boolean (@NotNull @NonNls String revision) { return HASH_STRING_PATTERN.matcher(revision).matches(); }
isHashString
42,093
void (@NotNull String taskName, @NotNull List<? extends GitRepository> repos, @Nullable Runnable callInAwtLater) { myBrancher.checkout(taskName, false, repos, callInAwtLater); }
checkout
42,094
void (@NotNull String name, @NotNull List<? extends GitRepository> repositories) { myBrancher.checkoutNewBranch(name, repositories); }
checkoutAsNewBranch
42,095
String (GitRepository repository) { return repository.getCurrentBranchName(); }
getActiveBranch
42,096
void (@NotNull String branch, @NotNull List<? extends GitRepository> repositories) { myBrancher.merge(branch, GitBrancher.DeleteOnMergeOption.DELETE, repositories); }
mergeAndClose
42,097
boolean (@NotNull GitRepository repository, @NotNull TaskInfo info) { GitBranchesCollection branches = repository.getBranches(); return info.isRemote() ? branches.getRemoteBranches().stream().anyMatch(branch -> info.getName().equals(branch.getName())) : branches.findLocalBranch(info.getName()) != null; }
hasBranch
42,098
Iterable<TaskInfo> (@NotNull GitRepository repository) { GitBranchesCollection branches = repository.getBranches(); List<TaskInfo> list = new ArrayList<>(ContainerUtil.map(sortBranchesByName(branches.getLocalBranches()), (Function<GitBranch, TaskInfo>)branch -> new TaskInfo(branch.getName(), Collections.singleton( repo...
getAllBranches
42,099
boolean () { return true; }
isRemote