Index: trunk/ippTasks/magic.pro
===================================================================
--- trunk/ippTasks/magic.pro	(revision 25419)
+++ trunk/ippTasks/magic.pro	(revision 26856)
@@ -14,4 +14,6 @@
 $magicToTree_DB = 0
 $magicToProcess_DB = 0
+$magicRevertTree_DB = 0
+$magicRevertNode_DB = 0
 
 ### Check status of tasks
@@ -28,4 +30,13 @@
 
 ### Turn tasks on
+macro magic.revert.on
+  task magic.revert.node
+    active true
+  end
+  task magic.revert.tree
+    active true
+  end
+end
+
 macro magic.on
   task magic.tree.load
@@ -40,4 +51,14 @@
   task magic.process.run
     active true
+  end
+  magic.revert.on
+end
+
+macro magic.revert.off
+  task magic.revert.node
+    active false
+  end
+  task magic.revert.tree
+    active false
   end
 end
@@ -57,4 +78,5 @@
     active false
   end
+  magic.revert.off
 end
 
@@ -328,2 +350,93 @@
   end
 end
+
+task magic.revert.node
+  host         local
+
+  periods      -poll 5.0
+  periods      -exec 60.0
+  periods      -timeout 120.0
+  npending     1
+
+  stdout NULL
+  stderr $LOGSUBDIR/revertnode.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    $run = magictool -revertnode
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$magicRevertNode_DB
+      $run = $run -dbname $DB:$magicRevertNode_DB
+      $magicRevertNode_DB ++
+      if ($magicRevertNode_DB >= $DB:n) set magicRevertNode_DB = 0
+    end
+    add_poll_labels run
+    command $run
+  end
+
+  # success
+  task.exit    0
+  end
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+
+  task.exit    crash
+    showcommand crash
+  end
+
+  # operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
+task magic.revert.tree
+  host         local
+
+  periods      -poll 5.0
+  periods      -exec 60.0
+  periods      -timeout 120.0
+  npending     1
+
+  stdout NULL
+  stderr $LOGSUBDIR/reverttree.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    $run = magictool -reverttree
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$magicRevertTree_DB
+      $run = $run -dbname $DB:$magicRevertTree_DB
+      $magicRevertTree_DB ++
+      if ($magicRevertTree_DB >= $DB:n) set magicRevertTree_DB = 0
+    end
+    add_poll_labels run
+    command $run
+  end
+
+  # success
+  task.exit    0
+  end
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+
+  task.exit    crash
+    showcommand crash
+  end
+
+  # operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
