tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [10/16] incubator-tinkerpop git commit: Allow :remote close to close even when in remote eval mode.
Date Thu, 10 Mar 2016 13:24:16 GMT
Allow :remote close to close even when in remote eval mode.

It first exits remote eval and then executes the close operation on the remote.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/1c757a7d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/1c757a7d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/1c757a7d

Branch: refs/heads/tp31
Commit: 1c757a7d8dfc73a2030af02c1bffbdd21812c00d
Parents: afeffc4
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Wed Mar 9 14:44:19 2016 -0500
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Wed Mar 9 16:15:01 2016 -0500

----------------------------------------------------------------------
 .../gremlin/console/commands/RemoteCommand.groovy         | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1c757a7d/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/RemoteCommand.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/RemoteCommand.groovy
b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/RemoteCommand.groovy
index 5662356..d192b7b 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/RemoteCommand.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/RemoteCommand.groovy
@@ -110,15 +110,23 @@ class RemoteCommand extends ComplexCommandSupport {
 
     def Object do_close = {
         if (mediator.remotes.size() == 0) return "Please add a remote first with [connect]"
+
+        // the console is in remote evaluation mode.  closing at this point will needs to
exit that mode and then
+        // kill the remote itself
+        def line = !mediator.localEvaluation ? swapEvalautionMode() : ""
+
         def removed = mediator.removeCurrent()
         removed.close()
-        return "Removed - $removed"
+        return line.isEmpty() ? "Removed - $removed" : "$line and removed - $removed"
     }
 
     def Object do_console = {
         if (mediator.remotes.size() == 0) return "Please add a remote first with [connect]"
         if (!mediator.currentRemote().allowRemoteConsole()) return "The ${mediator.currentRemote()}
is not compatible with 'connect' - use ':>' instead"
+        return swapEvalautionMode()
+    }
 
+    private String swapEvalautionMode() {
         mediator.localEvaluation = !mediator.localEvaluation
         if (mediator.localEvaluation)
             return "Exited remote console - all commands will be evaluated locally"


Mime
View raw message