diff --git a/docs/endpoints/status.rst b/docs/endpoints/status.rst --- a/docs/endpoints/status.rst +++ b/docs/endpoints/status.rst @@ -59,8 +59,6 @@ The deposit has been successfully loaded into the Software Heritage archive swh:1:dir:d83b7dda887dc790f7207608474650d4344b8df9 swh:1:dir:d83b7dda887dc790f7207608474650d4344b8df9;origin=https://forge.softwareheritage.org/source/jesuisgpl/;visit=swh:1:snp:68c0d26104d47e278dd6be07ed61fafb561d0d20;anchor=swh:1:rev:e76ea49c9ffbb7f73611087ba6e999b19e5d71eb;path=/ - swh:1:rev:e76ea49c9ffbb7f73611087ba6e999b19e5d71eb - swh:1:rev:e76ea49c9ffbb7f73611087ba6e999b19e5d71eb;origin=https://forge.softwareheritage.org/source/jesuisgpl/ Rejected deposit: diff --git a/docs/getting-started.rst b/docs/getting-started.rst --- a/docs/getting-started.rst +++ b/docs/getting-started.rst @@ -270,8 +270,7 @@ When the deposit has been loaded into the archive, the status will be marked ``done``. In the response, will also be available the -, , , -. For example: +, . For example: .. code:: json @@ -280,8 +279,6 @@ 'deposit_status': 'done', 'deposit_swh_id': 'swh:1:dir:d83b7dda887dc790f7207608474650d4344b8df9', 'deposit_swh_id_context': 'swh:1:dir:d83b7dda887dc790f7207608474650d4344b8df9;origin=https://forge.softwareheritage.org/source/jesuisgpl/;visit=swh:1:snp:68c0d26104d47e278dd6be07ed61fafb561d0d20;anchor=swh:1:rev:e76ea49c9ffbb7f73611087ba6e999b19e5d71eb;path=/', - 'deposit_swh_anchor_id': 'swh:1:rev:e76ea49c9ffbb7f73611087ba6e999b19e5d71eb', - 'deposit_swh_anchor_id_context': 'swh:1:rev:e76ea49c9ffbb7f73611087ba6e999b19e5d71eb;origin=https://forge.softwareheritage.org/source/jesuisgpl/', 'deposit_status_detail': 'The deposit has been successfully \ loaded into the Software Heritage archive' } diff --git a/swh/deposit/api/deposit_status.py b/swh/deposit/api/deposit_status.py --- a/swh/deposit/api/deposit_status.py +++ b/swh/deposit/api/deposit_status.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2018 The Software Heritage developers +# Copyright (C) 2017-2020 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -51,8 +51,6 @@ "status", "swh_id", "swh_id_context", - "swh_anchor_id", - "swh_anchor_id_context", "external_id", ) for k in keys: diff --git a/swh/deposit/api/private/deposit_update_status.py b/swh/deposit/api/private/deposit_update_status.py --- a/swh/deposit/api/private/deposit_update_status.py +++ b/swh/deposit/api/private/deposit_update_status.py @@ -97,12 +97,6 @@ "path": "/", }, ) - - # backward compatibility for now - deposit.swh_anchor_id = rev_id - deposit.swh_anchor_id_context = persistent_identifier( - REVISION, revision_id, metadata={"origin": origin_url} - ) else: # rejected deposit.status = status diff --git a/swh/deposit/cli/admin.py b/swh/deposit/cli/admin.py --- a/swh/deposit/cli/admin.py +++ b/swh/deposit/cli/admin.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2019 The Software Heritage developers +# Copyright (C) 2017-2020 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -261,8 +261,6 @@ # Reset the deposit's state deposit.swh_id = None deposit.swh_id_context = None - deposit.swh_anchor_id = None - deposit.swh_anchor_id_context = None deposit.status = DEPOSIT_STATUS_VERIFIED deposit.save() diff --git a/swh/deposit/client.py b/swh/deposit/client.py --- a/swh/deposit/client.py +++ b/swh/deposit/client.py @@ -390,8 +390,6 @@ "deposit_status_detail", "deposit_swh_id", "deposit_swh_id_context", - "deposit_swh_anchor_id", - "deposit_swh_anchor_id_context", "deposit_external_id", ], ) diff --git a/swh/deposit/migrations/0019_auto_20200519_1035.py b/swh/deposit/migrations/0019_auto_20200519_1035.py new file mode 100644 --- /dev/null +++ b/swh/deposit/migrations/0019_auto_20200519_1035.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.23 on 2020-05-19 10:35 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("deposit", "0018_migrate_swhids"), + ] + + operations = [ + migrations.RemoveField(model_name="deposit", name="swh_anchor_id",), + migrations.RemoveField(model_name="deposit", name="swh_anchor_id_context",), + ] diff --git a/swh/deposit/models.py b/swh/deposit/models.py --- a/swh/deposit/models.py +++ b/swh/deposit/models.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2018 The Software Heritage developers +# Copyright (C) 2017-2020 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -127,8 +127,6 @@ # SWH's loading result identifier swh_id = models.TextField(blank=True, null=True) swh_id_context = models.TextField(blank=True, null=True) - swh_anchor_id = models.TextField(blank=True, null=True) - swh_anchor_id_context = models.TextField(blank=True, null=True) # Deposit's status regarding loading status = models.TextField(choices=DEPOSIT_STATUS, default=DEPOSIT_STATUS_PARTIAL) status_detail = JSONField(null=True) diff --git a/swh/deposit/templates/deposit/status.xml b/swh/deposit/templates/deposit/status.xml --- a/swh/deposit/templates/deposit/status.xml +++ b/swh/deposit/templates/deposit/status.xml @@ -6,7 +6,5 @@ {{ status_detail }} {% if swh_id is not None %}{{ swh_id }}{% endif %} {% if swh_id_context is not None %}{{ swh_id_context }}{% endif %} - {% if swh_anchor_id is not None %}{{ swh_anchor_id }}{% endif %} - {% if swh_anchor_id_context is not None %}{{ swh_anchor_id_context }}{% endif %} {% if external_id is not None %}{{ external_id }}{% endif %} diff --git a/swh/deposit/tests/api/test_deposit_private_update_status.py b/swh/deposit/tests/api/test_deposit_private_update_status.py --- a/swh/deposit/tests/api/test_deposit_private_update_status.py +++ b/swh/deposit/tests/api/test_deposit_private_update_status.py @@ -61,8 +61,6 @@ expected_swh_id_context = ( f"{dir_id};origin={origin_url};" + f"visit={snp_id};anchor={rev_id};path=/" ) - expected_swh_anchor_id = rev_id - expected_swh_anchor_id_context = f"{rev_id};origin={origin_url}" response = authenticated_client.put( url, content_type="application/json", data=json.dumps(full_body_info), @@ -74,8 +72,6 @@ assert deposit.status == expected_status assert deposit.swh_id == expected_swh_id assert deposit.swh_id_context == expected_swh_id_context - assert deposit.swh_anchor_id == expected_swh_anchor_id - assert deposit.swh_anchor_id_context == expected_swh_anchor_id_context # Reset deposit deposit = ready_deposit_verified @@ -104,8 +100,6 @@ assert deposit.swh_id is None assert deposit.swh_id_context is None - assert deposit.swh_anchor_id is None - assert deposit.swh_anchor_id_context is None # Reset status deposit = ready_deposit_verified diff --git a/swh/deposit/tests/api/test_deposit_status.py b/swh/deposit/tests/api/test_deposit_status.py --- a/swh/deposit/tests/api/test_deposit_status.py +++ b/swh/deposit/tests/api/test_deposit_status.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2019 The Software Heritage developers +# Copyright (C) 2017-2020 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -118,7 +118,3 @@ assert r["deposit_swh_id"] == deposit.swh_id assert deposit.swh_id_context is not None assert r["deposit_swh_id_context"] == deposit.swh_id_context - assert deposit.swh_anchor_id is not None - assert r["deposit_swh_anchor_id"] == deposit.swh_anchor_id - assert deposit.swh_anchor_id_context is not None - assert r["deposit_swh_anchor_id_context"] == deposit.swh_anchor_id_context diff --git a/swh/deposit/tests/conftest.py b/swh/deposit/tests/conftest.py --- a/swh/deposit/tests/conftest.py +++ b/swh/deposit/tests/conftest.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 The Software Heritage developers +# Copyright (C) 2019-2020 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -21,6 +21,7 @@ from swh.scheduler import get_scheduler from swh.scheduler.tests.conftest import * # noqa +from swh.model.identifiers import DIRECTORY, persistent_identifier, REVISION, SNAPSHOT from swh.deposit.config import setup_django_for from swh.deposit.parsers import parse_xml from swh.deposit.config import SWHDefaultConfig @@ -403,11 +404,21 @@ external_id="external-id-complete", deposit_status=DEPOSIT_STATUS_LOAD_SUCCESS, ) - _swh_id_context = "https://hal.archives-ouvertes.fr/hal-01727745" - deposit.swh_id = "swh:1:dir:42a13fc721c8716ff695d0d62fc851d641f3a12b" - deposit.swh_id_context = "%s;%s" % (deposit.swh_id, _swh_id_context) - deposit.swh_anchor_id = "swh:rev:1:548b3c0a2bb43e1fca191e24b5803ff6b3bc7c10" - deposit.swh_anchor_id_context = "%s;%s" % (deposit.swh_anchor_id, _swh_id_context) + origin = "https://hal.archives-ouvertes.fr/hal-01727745" + directory_id = "42a13fc721c8716ff695d0d62fc851d641f3a12b" + revision_id = "548b3c0a2bb43e1fca191e24b5803ff6b3bc7c10" + snapshot_id = "e5e82d064a9c3df7464223042e0c55d72ccff7f0" + deposit.swh_id = persistent_identifier(DIRECTORY, directory_id) + deposit.swh_id_context = persistent_identifier( + DIRECTORY, + directory_id, + metadata={ + "origin": origin, + "visit": persistent_identifier(SNAPSHOT, snapshot_id), + "anchor": persistent_identifier(REVISION, revision_id), + "path": "/", + }, + ) deposit.save() return deposit