You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ga...@apache.org on 2008/11/17 21:18:34 UTC
svn commit: r718359 - in
/hadoop/pig/branches/types/src/org/apache/pig/tools: grunt/GruntParser.java
pigscript/parser/PigScriptParser.jj
Author: gates
Date: Mon Nov 17 12:18:33 2008
New Revision: 718359
URL: http://svn.apache.org/viewvc?rev=718359&view=rev
Log:
PIG-535 Added rmf command to grunt, which is equivalent to rm -f in unix, that is, it does not error out if the indicated file/directory is not present to
remove. Contributed by Ian Holsman.
Modified:
hadoop/pig/branches/types/src/org/apache/pig/tools/grunt/GruntParser.java
hadoop/pig/branches/types/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj
Modified: hadoop/pig/branches/types/src/org/apache/pig/tools/grunt/GruntParser.java
URL: http://svn.apache.org/viewvc/hadoop/pig/branches/types/src/org/apache/pig/tools/grunt/GruntParser.java?rev=718359&r1=718358&r2=718359&view=diff
==============================================================================
--- hadoop/pig/branches/types/src/org/apache/pig/tools/grunt/GruntParser.java (original)
+++ hadoop/pig/branches/types/src/org/apache/pig/tools/grunt/GruntParser.java Mon Nov 17 12:18:33 2008
@@ -439,15 +439,19 @@
mPigServer.registerQuery(cmd, start);
}
- protected void processRemove(String path) throws IOException
+ protected void processRemove(String path, String options ) throws IOException
{
ElementDescriptor dfsPath = mDfs.asElement(path);
if (!dfsPath.exists()) {
- throw new IOException("File or directory " + path + " does not exist.");
+ if (options == null || !options.equalsIgnoreCase("force")) {
+ throw new IOException("File or directory " + path + " does not exist.");
+ }
}
+ else {
- dfsPath.delete();
+ dfsPath.delete();
+ }
}
private PigServer mPigServer;
Modified: hadoop/pig/branches/types/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj
URL: http://svn.apache.org/viewvc/hadoop/pig/branches/types/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj?rev=718359&r1=718358&r2=718359&view=diff
==============================================================================
--- hadoop/pig/branches/types/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj (original)
+++ hadoop/pig/branches/types/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj Mon Nov 17 12:18:33 2008
@@ -94,7 +94,7 @@
abstract protected void processPig(String cmd) throws IOException;
- abstract protected void processRemove(String path) throws IOException;
+ abstract protected void processRemove(String path, String opt) throws IOException;
abstract protected void processIllustrate(String alias) throws IOException;
@@ -139,6 +139,7 @@
TOKEN: {<QUIT: "quit">}
TOKEN: {<REGISTER: "register">}
TOKEN: {<REMOVE: "rm">}
+TOKEN: {<REMOVEFORCE: "rmf">}
TOKEN: {<SET: "set">}
TOKEN: {<ILLUSTRATE: "illustrate">}
@@ -435,8 +436,14 @@
<REMOVE>
(
t1 = GetPath()
- {processRemove(t1.image);}
- )+
+ {processRemove(t1.image, null);}
+ )+
+ |
+ <REMOVEFORCE>
+ (
+ t1 = GetPath()
+ {processRemove(t1.image, "force");}
+ )+
|
<SCRIPT_DONE>
{quit();}