@Test(dependsOnMethods = "testUpdateConfig") public void testDeleteConfig() throws IOException, GitAPIException, URISyntaxException { // delete a config file testFlowFile.delete(); // flow catalog has 1 entry before the config is deleted Collection<Spec> specs = this.flowCatalog.getSpecs(); Assert.assertTrue(specs.size() == 1); // add, commit, push DirCache ac = this.gitForPush.rm().addFilepattern(formConfigFilePath(this.testGroupDir.getName(), this.testFlowFile.getName())) .call(); RevCommit cc = this.gitForPush.commit().setMessage("Fourth commit").call(); this.gitForPush.push().setRemote("origin").setRefSpecs(this.masterRefSpec).call(); this.gitConfigMonitor.processGitConfigChanges(); specs = this.flowCatalog.getSpecs(); Assert.assertTrue(specs.size() == 0); }
@Signature public void rm(String filePattern, boolean cached) throws GitAPIException { getWrappedObject() .rm() .addFilepattern(filePattern) .setCached(cached) .call(); }
/** * Return a command object to execute a {@code rm} command * * @see <a href= * "http://www.kernel.org/pub/software/scm/git/docs/git-rm.html" >Git * documentation about rm</a> * @return a {@link org.eclipse.jgit.api.RmCommand} used to collect all * optional parameters and to finally execute the {@code rm} command */ public RmCommand rm() { return new RmCommand(repo); }
checkCallable(); DirCache dc = null; if (delete(path)) { actuallyDeletedFiles.add(relativePath); setCallable(false); } catch (IOException e) { throw new JGitInternalException(
/** * Only remove the specified files from the index. * * @param cached * {@code true} if files should only be removed from index, * {@code false} if files should also be deleted from the working * directory * @return {@code this} * @since 2.2 */ public RmCommand setCached(boolean cached) { checkCallable(); this.cached = cached; return this; }
checkCallable(); DirCache dc = null; if (delete(path)) { actuallyDeletedFiles.add(relativePath); setCallable(false); } catch (IOException e) { throw new JGitInternalException(
/** * Add file name pattern of files to be removed * * @param filepattern * repository-relative path of file to remove (with * <code>/</code> as separator) * @return {@code this} */ public RmCommand addFilepattern(String filepattern) { checkCallable(); filepatterns.add(filepattern); return this; }
@Test (dependsOnMethods = "testUpdateNode") public void testRemoveEdge() throws GitAPIException, IOException { // delete a config file edge1File.delete(); //Node1 has 1 edge before delete Set<FlowEdge> edgeSet = this.flowGraph.getEdges("node1"); Assert.assertEquals(edgeSet.size(), 1); // delete, commit, push DirCache ac = this.gitForPush.rm().addFilepattern(formEdgeFilePath(this.edge1Dir.getParentFile().getName(), this.edge1Dir.getName(), this.edge1File.getName())).call(); RevCommit cc = this.gitForPush.commit().setMessage("Edge remove commit").call(); this.gitForPush.push().setRemote("origin").setRefSpecs(this.masterRefSpec).call(); this.gitFlowGraphMonitor.processGitConfigChanges(); //Check if edge1 has been deleted from the graph edgeSet = this.flowGraph.getEdges("node1"); Assert.assertTrue(edgeSet.size() == 0); }
public boolean removeFile() { try { switch (mOperationType) { case DELETE: File fileToDelete = FsUtils.joinPath(mRepo.getDir(), mFilePattern); FsUtils.deleteFile(fileToDelete); break; case REMOVE_CACHED: mRepo.getGit().rm().setCached(true).addFilepattern(mFilePattern).call(); break; case REMOVE_FORCE: mRepo.getGit().rm().addFilepattern(mFilePattern).call(); break; } } catch (StopTaskException e) { return false; } catch (Throwable e) { setException(e); return false; } return true; }
checkCallable(); DirCache dc = null; delete(path); setCallable(false); } catch (IOException e) { throw new JGitInternalException(
/** * Only remove the specified files from the index. * * @param cached * true if files should only be removed from index, false if * files should also be deleted from the working directory * @return {@code this} * @since 2.2 */ public RmCommand setCached(boolean cached) { checkCallable(); this.cached = cached; return this; }
/** * Returns a command object to execute a {@code rm} command * * @see <a * href="http://www.kernel.org/pub/software/scm/git/docs/git-rm.html" * >Git documentation about rm</a> * @return a {@link RmCommand} used to collect all optional parameters and * to finally execute the {@code rm} command */ public RmCommand rm() { return new RmCommand(repo); }
@Test (dependsOnMethods = "testRemoveEdge") public void testRemoveNode() throws GitAPIException, IOException { //delete node files node1File.delete(); node2File.delete(); //Ensure node1 and node2 are present in the graph before delete DataNode node1 = this.flowGraph.getNode("node1"); Assert.assertNotNull(node1); DataNode node2 = this.flowGraph.getNode("node2"); Assert.assertNotNull(node2); // delete, commit, push this.gitForPush.rm().addFilepattern(formNodeFilePath(this.node1Dir.getName(), this.node1File.getName())).call(); this.gitForPush.rm().addFilepattern(formNodeFilePath(this.node2Dir.getName(), this.node2File.getName())).call(); this.gitForPush.commit().setMessage("Node remove commit").call(); this.gitForPush.push().setRemote("origin").setRefSpecs(this.masterRefSpec).call(); this.gitFlowGraphMonitor.processGitConfigChanges(); //Check if node1 and node 2 have been deleted from the graph node1 = this.flowGraph.getNode("node1"); Assert.assertNull(node1); node2 = this.flowGraph.getNode("node2"); Assert.assertNull(node2); }
public boolean removeFile() { try { switch (mOperationType) { case DELETE: File fileToDelete = FsUtils.joinPath(mRepo.getDir(), mFilePattern); FsUtils.deleteFile(fileToDelete); break; case REMOVE_CACHED: mRepo.getGit().rm().setCached(true).addFilepattern(mFilePattern).call(); break; case REMOVE_FORCE: mRepo.getGit().rm().addFilepattern(mFilePattern).call(); break; } } catch (StopTaskException e) { return false; } catch (Throwable e) { setException(e); return false; } return true; }
/** * Only remove the specified files from the index. * * @param cached * {@code true} if files should only be removed from index, * {@code false} if files should also be deleted from the working * directory * @return {@code this} * @since 2.2 */ public RmCommand setCached(boolean cached) { checkCallable(); this.cached = cached; return this; }
/** * Return a command object to execute a {@code rm} command * * @see <a href= * "http://www.kernel.org/pub/software/scm/git/docs/git-rm.html" >Git * documentation about rm</a> * @return a {@link org.eclipse.jgit.api.RmCommand} used to collect all * optional parameters and to finally execute the {@code rm} command */ public RmCommand rm() { return new RmCommand(repo); }
this.gitForPush.rm().addFilepattern(formNodeFilePath(this.node1Dir.getName(), this.node1File.getName())).call(); this.gitForPush.rm().addFilepattern(formEdgeFilePath(this.edge1Dir.getParentFile().getName(), this.edge1Dir.getName(), this.edge1File.getName())).call(); this.gitForPush.commit().setMessage("Delete node1 and edge1 commit").call(); this.gitForPush.push().setRemote("origin").setRefSpecs(this.masterRefSpec).call();
case MISSING_AND_CHANGED: if (rm == null) rm = git.rm().setCached(true); rm.addFilepattern(entry.getPath()); break; rm.call(); } catch (NoFilepatternException e) {
/** * @param filepattern * repository-relative path of file to remove (with * <code>/</code> as separator) * @return {@code this} */ public RmCommand addFilepattern(String filepattern) { checkCallable(); filepatterns.add(filepattern); return this; }
@Override public void delete(File testDefinitionDirectory) throws Exception { for (File file : testDefinitionDirectory.listFiles()) { git.rm().addFilepattern(testDefinitionsDirectory + "/" + testDefinitionDirectory.getName() + "/" + file.getName()).call(); } }