Index: trunk/ippTasks/diff.pro
===================================================================
--- trunk/ippTasks/diff.pro	(revision 26960)
+++ trunk/ippTasks/diff.pro	(revision 26961)
@@ -40,4 +40,7 @@
     active true
   end
+  task diff.revert
+    active false
+  end
 end
 
@@ -53,4 +56,19 @@
     active false
   end
+  task diff.revert
+    active false
+  end
+end
+
+macro diff.revert.on
+  task diff.revert
+    active true
+  end
+end
+
+macro diff.revert.off
+  task diff.revert
+    active false
+  end
 end
 
@@ -76,4 +94,7 @@
 ### Load tasks for doing the differences
 ### Tasks are loaded into diffSkyfile.
+
+$diff_revert_DB = 0
+
 task	       diff.skycell.load
   host         local
@@ -380,2 +401,48 @@
 #   end
 # end
+
+task diff.revert
+  host         local
+
+  periods      -poll 5.0
+  periods      -exec 60.0
+  periods      -timeout 120.0
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/revert.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    $run = difftool -revertdiffskyfile 
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$diff_revert_DB
+      $run = $run -dbname $DB:$diff_revert_DB
+      $diff_revert_DB ++
+      if ($diff_revert_DB >= $DB:n) set diff_revert_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
Index: trunk/ippTasks/dist.pro
===================================================================
--- trunk/ippTasks/dist.pro	(revision 26960)
+++ trunk/ippTasks/dist.pro	(revision 26961)
@@ -55,4 +55,7 @@
     active true
   end
+  task diff.revert
+    active false
+  end
 end
 
@@ -68,4 +71,7 @@
   end
   task dist.advance.run
+    active false
+  end
+  task diff.revert
     active false
   end
Index: trunk/ippTasks/stack.pro
===================================================================
--- trunk/ippTasks/stack.pro	(revision 26960)
+++ trunk/ippTasks/stack.pro	(revision 26961)
@@ -36,4 +36,7 @@
     active true
   end
+  task stack.revert
+    active false
+  end
 end
 
@@ -46,5 +49,24 @@
     active false
   end
-end
+  task stack.revert
+    active false
+  end
+end
+
+macro stack.revert.on
+  task stack.revert
+    active true
+  end
+end
+
+macro stack.revert.off
+  task stack.revert
+    active false
+  end
+end
+
+
+
+
 
 # macro stack.cleanup.on
@@ -66,5 +88,5 @@
 # end
 
-
+$stack_revert_DB = 0
 ### Load tasks for doing the stack
 ### Tasks are loaded into stackSumSkyfile.
@@ -123,4 +145,7 @@
   end
 end
+
+
+
 
 ### Run tasks for calculating the stack overlaps
@@ -316,2 +341,49 @@
 #   end
 # end
+
+task stack.revert
+  host         local
+
+  periods      -poll 5.0
+  periods      -exec 60.0
+  periods      -timeout 120.0
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/revert.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    $run = stacktool -revertsumskyfile
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$stack_revert_DB
+      $run = $run -dbname $DB:$stack_revert_DB
+      $stack_revert_DB ++
+      if ($stack_revert_DB >= $DB:n) set stack_revert_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
+
