Index: trunk/ippTools/share/warptool_setskyfiletoupdate.sql
===================================================================
--- trunk/ippTools/share/warptool_setskyfiletoupdate.sql	(revision 27737)
+++ trunk/ippTools/share/warptool_setskyfiletoupdate.sql	(revision 28022)
@@ -1,4 +1,7 @@
 UPDATE warpRun
     JOIN warpSkyfile USING(warp_id)
+    LEFT JOIN magicDSRun ON (stage_id = warp_id AND stage = 'warp')
+    LEFT JOIN magicDSFile ON (magicDSRun.magic_ds_id = magicDSFile.magic_ds_id
+                              AND component = skycell_id)
 SET warpRun.state = 'update', 
     warpSkyfile.data_state = 'update'
@@ -7,2 +10,5 @@
     AND (warpRun.state = 'cleaned' OR warpRun.state = 'update')
     AND (warpSkyfile.data_state = 'cleaned')
+    AND (warpRun.magicked = 0
+      OR (magicDSRun.state = 'cleaned' OR magicDSRun.state = 'new')
+      AND magicDSFile.component IS NULL)
