private boolean doDeleteRemote( @NotNull String branchName, @NotNull Collection<GitRepository> repositories) { Couple<String> pair = splitNameOfRemoteBranch(branchName); String remoteName = pair.getFirst(); String branch = pair.getSecond(); GitCompoundResult result = new GitCompoundResult(myProject); for (GitRepository repository : repositories) { GitCommandResult res; GitRemote remote = getRemoteByName(repository, remoteName); if (remote == null) { String error = "Couldn't find remote by name: " + remoteName; LOG.error(error); res = GitCommandResult.error(error); } else { res = pushDeletion(repository, remote, branch); if (!res.success() && isAlreadyDeletedError(res.getErrorOutputAsJoinedString())) { res = myGit.remotePrune(repository, remote); } } result.append(repository, res); repository.update(); } if (!result.totalSuccess()) { VcsNotifier.getInstance(myProject) .notifyError( "Failed to delete remote branch " + branchName, result.getErrorOutputWithReposIndication()); } return result.totalSuccess(); }
/** * Makes the password database key for the URL: inserts the login after the scheme: * http://login@url. */ @NotNull private static String makeKey(@NotNull String url, @Nullable String login) { if (login == null) { return url; } Couple<String> pair = UriUtil.splitScheme(url); String scheme = pair.getFirst(); if (!StringUtil.isEmpty(scheme)) { return scheme + URLUtil.SCHEME_SEPARATOR + login + "@" + pair.getSecond(); } return login + "@" + url; }
private boolean isValidLibrary( @NotNull File file, @NotNull final String name, @Nullable Ref<Couple<String>> cache) { Couple<String> info = parseLibrary(file); if (info == null) { return false; } if (Comparing.equal(info.getFirst(), name)) { if (cache != null) { cache.set(info); } return true; } return false; }
@NotNull @Override public Map<String, String> getAvailableSystemLibraries() { Map<String, String> map = new TreeMap<String, String>(); File[] directoriesForLibraries = getFilesForLibraries(); for (File childFile : directoriesForLibraries) { if (!FileUtilRt.getExtension(childFile.getName()).equals("dll")) { continue; } Couple<String> info = parseLibrary(childFile); if (info == null) { continue; } map.put(info.getFirst(), info.getSecond()); } return map; }