Index: trunk/ippTasks/detrend.process.pro
===================================================================
--- trunk/ippTasks/detrend.process.pro	(revision 23480)
+++ trunk/ippTasks/detrend.process.pro	(revision 28557)
@@ -51,8 +51,27 @@
 end
 
+macro detproc.revert.off
+  task detrend.process.revert
+    active false
+  end
+  task detrend.processexp.revert
+    active false
+  end
+end
+
+macro detproc.revert.on
+  task detrend.process.revert
+    active true
+  end
+  task detrend.processexp.revert
+    active true
+  end
+end
 
 # these variables will cycle through the known database names
 $detPendingProcessedImfile_DB = 0
 $detPendingProcessedExp_DB = 0
+$detPendingProcessedImfile_revert_DB = 0
+$detPendingProcessedExp_revert_DB = 0
 
 # select images ready for copy 
@@ -313,2 +332,94 @@
   end
 end
+
+task detrend.process.revert
+  host         local
+
+  periods      -poll 60.0
+  periods      -exec 1800.0
+  periods      -timeout 120.0
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/revert.log
+
+  task.exec
+ 
+    $run = dettool -revertprocessedimfile -all 
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$detPendingProcessedImfile_revert_DB
+      $run = $run -dbname $DB:$detPendingProcessedImfile_revert_DB
+      $detPendingProcessedImfile_revert_DB ++
+      if ($detPendingProcessedImfile_revert_DB >= $DB:n) set detPendingProcessedImfile_revert_DB = 0
+    end
+    echo $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 detrend.processexp.revert
+  host         local
+
+  periods      -poll 60.0
+  periods      -exec 1800.0
+  periods      -timeout 120.0
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/revert.log
+
+  task.exec
+  
+    $run = dettool -revertprocessedexp -all 
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$detPendingProcessedExp_revert_DB
+      $run = $run -dbname $DB:$detPendingProcessedExp_revert_DB
+      $detPendingProcessedExp_revert_DB ++
+      if ($detPendingProcessedExp_revert_DB >= $DB:n) set detPendingProcessedExp_revert_DB = 0
+    end
+    echo $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
