]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitaSync.ml
first snapshot of separate compilation
[helm.git] / helm / matita / matitaSync.ml
index 42e8f1c404f0747552a2ffb3f2dda8b5b809457e..660be6c10b76856a78fef83800945ccbf16ee03e 100644 (file)
@@ -223,8 +223,31 @@ let alias_diff ~from status =
     status.aliases Map.empty
 
 let remove uri =
-  let path = Http_getter.resolve' uri in
-  remove_object_from_disk uri path;
-  remove_coercion uri;
-  ignore(MatitaDb.remove_uri uri)
+  let derived_uris_of_uri uri =
+    UriManager.innertypesuri_of_uri uri ::
+    UriManager.annuri_of_uri uri ::
+    (match UriManager.bodyuri_of_uri uri with
+    | None -> []
+    | Some u -> [u])
+  in
+  let to_remove =
+    uri :: 
+    (if UriManager.uri_is_ind uri then MatitaDb.xpointers_of_ind uri else []) @
+    derived_uris_of_uri uri   
+  in   
+  List.iter 
+    (fun uri -> 
+      (try
+        let path = 
+          let path = Http_getter.resolve' (UriManager.strip_xpointer uri) in
+          assert (String.sub path 0 7 = "file://");
+          String.sub path 7 (String.length path - 7)
+        in
+        remove_object_from_disk uri path; 
+      with
+        Http_getter_types.Key_not_found _ -> Http_getter.unregister' uri);
+      remove_coercion uri; 
+      ignore(MatitaDb.remove_uri uri))
+  to_remove
+