private List<String> getProjectLabels(Job<?, ?> project) { final URIish sourceRepository = getSourceRepoURLDefault(project); GitLabConnectionProperty connectionProperty = project.getProperty(GitLabConnectionProperty.class); if (connectionProperty != null && connectionProperty.getClient() != null) { return GitLabProjectLabelsService.instance().getLabels(connectionProperty.getClient(), sourceRepository.toString()); } else { LOGGER.log(Level.WARNING, "getProjectLabels: gitlabHostUrl hasn't been configured globally. Job {0}.", project.getFullName()); return Collections.emptyList(); } }
private List<String> getProjectBranches(Job<?, ?> project) { final URIish sourceRepository = getSourceRepoURLDefault(project); GitLabConnectionProperty connectionProperty = project.getProperty(GitLabConnectionProperty.class); if (connectionProperty != null && connectionProperty.getClient() != null) { return GitLabProjectBranchesService.instance().getBranches(connectionProperty.getClient(), sourceRepository.toString()); } else { LOGGER.log(Level.WARNING, "getProjectBranches: gitlabHostUrl hasn't been configured globally. Job {0}.", project.getFullName()); return Collections.emptyList(); } }
public static ArrayMemory valueOf(OperationResult value) { ArrayMemory memory = new ArrayMemory(); memory.refOfIndex("advertisedRefs").assign(valueOfRefs(value.getAdvertisedRefs())); memory.refOfIndex("messages").assign(value.getMessages()); memory.refOfIndex("peerUserAgent").assign(value.getPeerUserAgent()); memory.refOfIndex("uri").assign(value.getURI().toString()); return memory; }
private URL toURL(URIish urish) throws MalformedURLException { String uriString = urish.toString(); if (!uriString.endsWith("/")) { //$NON-NLS-1$ uriString += '/'; } return new URL(uriString); }
void write(Writer pw) throws IOException { final String type; final String name; if (sourceName.startsWith(R_HEADS)) { type = "branch"; //$NON-NLS-1$ name = sourceName.substring(R_HEADS.length()); } else if (sourceName.startsWith(R_TAGS)) { type = "tag"; //$NON-NLS-1$ name = sourceName.substring(R_TAGS.length()); } else if (sourceName.startsWith(R_REMOTES)) { type = "remote branch"; //$NON-NLS-1$ name = sourceName.substring(R_REMOTES.length()); } else { type = ""; //$NON-NLS-1$ name = sourceName; } pw.write(newValue.name()); pw.write('\t'); if (notForMerge) pw.write("not-for-merge"); //$NON-NLS-1$ pw.write('\t'); pw.write(type); pw.write(" '"); //$NON-NLS-1$ pw.write(name); pw.write("' of "); //$NON-NLS-1$ pw.write(sourceURI.toString()); pw.write("\n"); //$NON-NLS-1$ } }
Transport tn = proto.open(uri, local, remoteName); tn.prePush = Hooks.prePush(local, tn.hookOutRedirect); tn.prePush.setRemoteLocation(uri.toString()); tn.prePush.setRemoteName(remoteName); return tn;
private void setURI(final URIish u) { try { eventDepth++; if (eventDepth == 1) { uri = u; uriText.setText(uri.toString()); checkPage(); } } finally { eventDepth--; } }
private String getFirstGitURI(RemoteConfig remoteRepository) { List<URIish> urIs = remoteRepository.getURIs(); if (urIs == null || urIs.isEmpty()) { throw new GitException("Error performing push tag command, repository URIs are null or empty."); } return urIs.get(0).toString(); }
@Override public String getKey() { String name = getScmName(); if (name != null) { return name; } StringBuilder b = new StringBuilder("git"); for (RemoteConfig cfg : getRepositories()) { for (URIish uri : cfg.getURIs()) { b.append(' ').append(uri.toString()); } } return b.toString(); }
private static String getServer(URI scmUri) { GitURI gitURI = new GitURI(scmUri); return gitURI.getRepository().toString(); } }
private URL getResultFromNamedRepository(GitChangeSet changeSet) throws MalformedURLException { GitSCM scm = getScmFromProject(changeSet); return new URL(scm.getRepositoryByName(getRepoUrl()).getURIs().get(0).toString()); }
static String getDestinationString(RepositorySelection repoSelection) { final String destination; if (repoSelection.isConfigSelected()) destination = repoSelection.getConfigName(); else destination = repoSelection.getURI(true).toString(); return destination; }
private void saveFingerprint(URIish uri, String fingerprint) { String url = uri.toString(); try { TeamSettings.set(url + "!" + KEY_FINGERPRINT_SUFFIX, fingerprint); } catch (Exception e) { Core.getMainWindow().displayErrorRB(e, "TEAM_ERROR_SAVE_CREDENTIALS", null, "TF_ERROR"); } }
public GitRepositoryInfo getGitRepositoryInfo() { GitRepositoryInfo info = new GitRepositoryInfo(uri.toString()); info.setCredentials(user, password); info.setShouldSaveCredentialsInSecureStore(storeInSecureStore); uriProposalHandler.updateProposals(); return info; }
private String getSourceString() { final RepositorySelection repoSelection = repoPage.getSelection(); if (repoSelection.isConfigSelected()) return repoSelection.getConfigName(); return repoSelection.getURI(false).toString(); } }
private Credentials loadCredentials(URIish uri) { String url = uri.toString(); Credentials credentials = new Credentials(); credentials.username = TeamSettings.get(url + "!" + KEY_USERNAME_SUFFIX); credentials.password = TeamUtils.decodePassword(TeamSettings.get(url + "!" + KEY_PASSWORD_SUFFIX)); return credentials; }
private void saveCredentials(URIish uri, Credentials credentials) { String url = uri.toString(); try { TeamSettings.set(url + "!" + KEY_USERNAME_SUFFIX, credentials.username); TeamSettings.set(url + "!" + KEY_PASSWORD_SUFFIX, TeamUtils.encodePassword(credentials.password)); } catch (Exception e) { Core.getMainWindow().displayErrorRB(e, "TEAM_ERROR_SAVE_CREDENTIALS", null, "TF_ERROR"); } }
public void widgetSelected(final SelectionEvent e) { final int idx = scheme.getSelectionIndex(); pushURI = pushURI.setScheme(scheme.getItem(idx)); if (Protocol.SSH.handles(pushURI)) pushURI = pushURI.setPort(GERRIT_DEFAULT_SSH_PORT); else pushURI = pushURI.setPort(-1); uriText.setText(pushURI.toString()); scheme.setToolTipText(Protocol.values()[idx].getTooltip()); } });
private void addOrigin() throws URISyntaxException, GitAPIException { RemoteAddCommand add = git.remoteAdd(); add.setName("origin"); String uri = "https://example.org/repo"; add.setUri(new URIish(uri)); add.call(); assertEquals("origin", git.remoteList().call().iterator().next().getName()); assertEquals(uri, git.remoteList().call().iterator().next().getURIs().iterator().next().toString()); } }