Page MenuHomeSoftware Heritage

WIP - Deprecate most of the /browse/origin/.* URLs
AbandonedPublicDraft

Authored by jayeshv on Oct 7 2021, 10:45 AM.

Details

Reviewers
None
Group Reviewers
Reviewers
Maniphest Tasks
T3608: Deprecate most of the /browse/origin/.* URLs
Summary

Many URLs defined in the origin view (urlconf) are redundant.
This fix redirects them to the corresponding object type URLs.
eg: /origin/directory will be redirected to /directory/<sha1>

Related to T3608

Test Plan
  • Test the following URLs

/browse/origin/directory/
/browse/origin/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/directory/
/browse/origin/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/directory/(?P<path>.+)/
/browse/origin/(?P<origin_url>.+)/directory/(?P<path>.+)/
/browse/origin/(?P<origin_url>.+)/directory/
/browse/origin/content/
/browse/origin/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/content/(?P<path>.+)/
/browse/origin/(?P<origin_url>.+)/content/(?P<path>.+)/
/browse/origin/(?P<origin_url>.+)/content/
/browse/origin/log/
/browse/origin/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/log/
/browse/origin/(?P<origin_url>.+)/log/
/browse/origin/branches/", view_name="browse-origin-branches
/browse/origin/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/branches/
/browse/origin/(?P<origin_url>.+)/branches/
/browse/origin/releases/
/browse/origin/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/releases/
/browse/origin/(?P<origin_url>.+)/releases/

Diff Detail

Repository
rDWAPPS Web applications
Branch
T3608
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 24274
Build 37887: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 37886: arc lint + arc unit

Unit TestsFailed

TimeTest
239 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.browse.views.test_origin::Tests / Python tests / test_browse_directory_snapshot_not_found
client = <django.test.client.Client object at 0x7efd5ea16668> mocker = <pytest_mock.plugin.MockerFixture object at 0x7efd5ea16160>
726 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.browse.views.test_origin::Tests / Python tests / test_browse_origin_content_directory_empty_snapshot[directory]
client = <django.test.client.Client object at 0x7efd6a9a9518> staff_user = <User: admin> archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7efd6a9a95f8>
221 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.browse.views.test_origin::Tests / Python tests / test_browse_origin_directory_no_visit
client = <django.test.client.Client object at 0x7efd5df9bc88> mocker = <pytest_mock.plugin.MockerFixture object at 0x7efd5de684e0>
238 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.browse.views.test_origin::Tests / Python tests / test_browse_origin_directory_not_found
client = <django.test.client.Client object at 0x7efd5f078128> @given(origin())
634 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.browse.views.test_origin::Tests / Python tests / test_browse_origin_directory_unknown_visit
client = <django.test.client.Client object at 0x7efd61559e10> mocker = <pytest_mock.plugin.MockerFixture object at 0x7efd61559748>
View Full Test Results (19 Failed · 589 Passed · 5 Skipped)

Event Timeline

Build has FAILED

Patch application report for D6430 (id=23358)

Rebasing onto cc60a4a5c8...

Current branch diff-target is up to date.
Changes applied before test
commit d68fdbd2a79967d2be79d16b91cea315dff34d58
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Oct 7 10:35:41 2021 +0200

    Deprecate most of the /browse/origin/.* URLs
    
    Many URLs defined in the origin view (urlconf) are redundant.
    This fix redirects them to the corresponding object type URLs.
    eg: /origin/directory will be redirected to /directory/<sha1>
    
    Related to T3608

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1145/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1145/console

Harbormaster returned this revision to the author for changes because remote builds failed.Oct 7 2021, 11:07 AM
Harbormaster failed remote builds in B24274: Diff 23358!

Please proceed one view at at a time by diff to ease reviews, start with content, then directory, ...

swh/web/browse/views/origin.py
23–28

That code is not needed, views exception handling is done at a global level by a django middleware. Every caught NotFoundExc will return a 404.

Build has FAILED

Patch application report for D6430 (id=23366)

Rebasing onto 0da4e46ae3...

First, rewinding head to replay your work on top of it...
Applying: Deprecate most of the /browse/origin/.* URLs
Applying: more re-factoring
Changes applied before test
commit 473930b796906e1a419655fd357ffb8e1f65c8b8
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Oct 7 11:51:10 2021 +0200

    more re-factoring

commit e3b15af0705f966b442b2cd68c0241a95f92bc11
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Oct 7 10:35:41 2021 +0200

    Deprecate most of the /browse/origin/.* URLs
    
    Many URLs defined in the origin view (urlconf) are redundant.
    This fix redirects them to the corresponding object type URLs.
    eg: /origin/directory will be redirected to /directory/<sha1>
    
    Related to T3608

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1146/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1146/console

Harbormaster returned this revision to the author for changes because remote builds failed.Oct 7 2021, 12:13 PM

Please proceed one view at at a time by diff to ease reviews, start with content, then directory, ...