List of usage examples for org.eclipse.jgit.api CleanCommand setPaths
public CleanCommand setPaths(Set<String> paths)
From source file:com.rimerosolutions.ant.git.tasks.CleanTask.java
License:Apache License
@Override public void doExecute() { try {/* ww w. j a va2 s . com*/ CleanCommand cleanCommand = git.clean(); if (!pathList.isEmpty()) { cleanCommand.setPaths(pathList); } cleanCommand.setDryRun(dryRun).setIgnore(ignore).setCleanDirectories(cleanDirectories).call(); } catch (Exception e) { throw new GitBuildException("Unexpected exception: " + e.getMessage(), e); } }
From source file:org.ajoberstar.gradle.git.tasks.GitClean.java
License:Apache License
/** * Reset the changes as configured.//w w w . ja v a 2 s . c om * If {@code paths} is set, only the specified * paths will be cleaned. Otherwise all paths * will be. */ @TaskAction public void reset() { final CleanCommand cmd = getGit().clean(); cmd.setPaths(getPaths()); try { cmd.call(); } catch (GitAPIException e) { throw new GradleException("Problem with clean.", e); } //TODO add progress monitor to log progress to Gradle status bar }
From source file:org.eclipse.egit.ui.internal.clean.CleanRepositoryPage.java
License:Open Source License
/** * Do the cleaning with the selected values. *///from w w w. j av a 2 s. c om public void finish() { try { final Set<String> itemsToClean = getItemsToClean(); getContainer().run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(UIText.CleanRepositoryPage_cleaningItems, IProgressMonitor.UNKNOWN); Git git = Git.wrap(repository); CleanCommand command = git.clean().setDryRun(false); command.setCleanDirectories(cleanDirectories); command.setIgnore(!includeIgnored); command.setPaths(itemsToClean); try { command.call(); } catch (GitAPIException ex) { Activator.logError("cannot call clean command!", ex); //$NON-NLS-1$ } try { IProject[] projects = ProjectUtil.getProjectsContaining(repository, itemsToClean); ProjectUtil.refreshResources(projects, new SubProgressMonitor(monitor, 1)); } catch (CoreException e) { // could not refresh... not a "real" problem } monitor.done(); } }); } catch (Exception e) { Activator.logError("Unexpected exception while cleaning", e); //$NON-NLS-1$ } }