private FetchResult fetch(Repository clonedRepo, URIish u) throws URISyntaxException, org.eclipse.jgit.api.errors.TransportException, IOException, GitAPIException { // create the remote config and save it RemoteConfig config = new RemoteConfig(clonedRepo.getConfig(), remote); config.addURI(u); final String dst = (bare ? Constants.R_HEADS : Constants.R_REMOTES + config.getName() + '/') + '*'; boolean fetchAll = cloneAllBranches || branchesToClone == null || branchesToClone.isEmpty(); config.setFetchRefSpecs(calculateRefSpecs(fetchAll, dst)); config.update(clonedRepo.getConfig()); clonedRepo.getConfig().save(); // run the fetch command FetchCommand command = new FetchCommand(clonedRepo); command.setRemote(remote); command.setProgressMonitor(monitor); command.setTagOpt(fetchAll ? TagOpt.FETCH_TAGS : TagOpt.AUTO_FOLLOW); configure(command); return command.call(); }
@Override public boolean performFinish() { if (pushMode) { config.setPushRefSpecs(page.getRefSpecs()); } else { config.setFetchRefSpecs(page.getRefSpecs()); config.setTagOpt(page.getTagOpt()); } return true; } }
private void saveConfig() { final RemoteConfig rc = repoPage.getSelection().getConfig(); rc.setFetchRefSpecs(refSpecPage.getRefSpecs()); rc.setTagOpt(refSpecPage.getTagOpt()); final StoredConfig config = localDb.getConfig(); rc.update(config); try { config.save(); } catch (final IOException e) { ErrorDialog.openError(getShell(), UIText.FetchWizard_cantSaveTitle, UIText.FetchWizard_cantSaveMessage, new Status( IStatus.WARNING, Activator.getPluginId(), e .getMessage(), e)); // Continue, it's not critical. } }
private FetchResult fetch(Repository clonedRepo, URIish u) throws URISyntaxException, org.eclipse.jgit.api.errors.TransportException, IOException, GitAPIException { // create the remote config and save it RemoteConfig config = new RemoteConfig(clonedRepo.getConfig(), remote); config.addURI(u); final String dst = (bare ? Constants.R_HEADS : Constants.R_REMOTES + config.getName() + '/') + '*'; boolean fetchAll = cloneAllBranches || branchesToClone == null || branchesToClone.isEmpty(); config.setFetchRefSpecs(calculateRefSpecs(fetchAll, dst)); config.update(clonedRepo.getConfig()); clonedRepo.getConfig().save(); // run the fetch command FetchCommand command = new FetchCommand(clonedRepo); command.setRemote(remote); command.setProgressMonitor(monitor); command.setTagOpt(fetchAll ? TagOpt.FETCH_TAGS : TagOpt.AUTO_FOLLOW); configure(command); return command.call(); }