From: <svn...@op...> - 2009-10-17 15:29:48
|
Author: bellmich Date: Sat Oct 17 17:29:25 2009 New Revision: 1343 URL: http://libsyncml.opensync.org/changeset/1343 Log: A delete is a delete is a delete. Modified: trunk/tools/syncml-ds-tool.c Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Fri Oct 16 18:26:49 2009 (r1342) +++ trunk/tools/syncml-ds-tool.c Sat Oct 17 17:29:25 2009 (r1343) @@ -1478,72 +1478,30 @@ } } } else { - /* The item was locally deleted. */ - if (index_digest && strcmp(index_digest, item_digest) == 0) - { - /* The change was locally known - * but the item is away. - */ - printf("\tThe item was already locally deleted.\n"); - g_key_file_remove_key(datastore->index, "last_index", safeUID, NULL); - } else { - /* The item was locally different - * but it was already deleted. - * This is a classical conflict. - */ - if (localWinsConflicts) - { - printf("\tConflict: Remote replace command is ignored.\n"); - printf("\tConflict: Local deletion wins conflict.\n"); - g_key_file_remove_key(datastore->index, "last_index", safeUID, NULL); - } else { - printf("\tConflict: Local deletion is ignored.\n"); - printf("\tConflict: Remote replace command wins conflict.\n"); - doWrite = TRUE; - SmlMapItem *map = sml_map_item_new(); - if (!sml_map_item_set_remote(map, uid, error)) - goto error; - SmlLocation *local = sml_location_new(); - sml_location_set_uri(local, safeUID); - if (!sml_map_item_set_local(map, local, error)) - goto error; - if (!sml_data_sync_data_store_session_add_mapping(session, map, NULL, error)) - goto error; - g_object_unref(map); - g_object_unref(local); - g_key_file_set_string(datastore->index, "map", safeUID, orgUID); - g_key_file_set_string(datastore->index, "reverse_map", orgUID, safeUID); - } - } + /* The item was locally deleted. + * If you need to restore it + * then you must add it again. + * A normal synchronization is no backup. + * You can only restore it if you do a slow sync. + * So the change will be committed but not executed. + */ + printf("\tThe item was already locally deleted.\n"); } break; case SML_CHANGE_DELETE: if (g_file_test(absolute_uid, G_FILE_TEST_EXISTS)) { - if (strcmp(file_digest, index_digest) == 0) - { - /* All local changes are synchronized. - * So the deletion can be executed. - */ - printf("\tThe item will be deleted.\n"); - doWrite = TRUE; - } else { - /* The item is not synchronized - * but the item should be deleted. - * This is a classical conflict. - */ - if (localWinsConflicts) - { - printf("\tConflict: Remote delete command is ignored.\n"); - printf("\tConflict: Local changed item wins conflict.\n"); - } else { - printf("\tConflict: Local changed item is ignored.\n"); - printf("\tConflict: Remote delete command wins conflict.\n"); - doWrite = TRUE; - } - } + /* The item was deleted on the remote device. + * If you need to restore it + * then you must add it again. + * A normal synchronization is no backup. + * You can only restore it if you do a slow sync. + * So the change will be executed. + */ + printf("\tThe item will be deleted.\n"); + doWrite = TRUE; } else { - /* The item was locally deleted. */ + /* The item was already locally deleted. */ printf("\tThe item was already locally deleted.\n"); g_key_file_remove_key(datastore->index, "last_index", safeUID, NULL); } |