You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2026/09/04 12:30:19 UTC
(tooling-trusted-releases) branch sbp updated: Improve the documentation for SVN imports
This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
The following commit(s) were added to refs/heads/sbp by this push:
new 8bfa69e8 Improve the documentation for SVN imports
8bfa69e8 is described below
commit 8bfa69e8dd98bfc29490c40bdf45eef9345239b5
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Fri Sep 4 13:29:55 2026 +0100
Improve the documentation for SVN imports
---
atr/get/upload.py | 8 ++++++++
atr/post/upload.py | 19 ++---------------
atr/shared/upload.py | 10 ++++++++-
tests/unit/test_svn_import_base_path.py | 36 +++++++++++++++++++++++++++++++++
4 files changed, 55 insertions(+), 18 deletions(-)
diff --git a/atr/get/upload.py b/atr/get/upload.py
index d92bd94f..aad3c30c 100644
--- a/atr/get/upload.py
+++ b/atr/get/upload.py
@@ -21,6 +21,7 @@ from typing import Literal
import htpy
import atr.blueprints.get as get
+import atr.constants as constants
import atr.db as db
import atr.form as form
import atr.get.compose as compose
@@ -49,6 +50,7 @@ async def selected(
async with db.session() as data:
release = await session.release(project_key, version_key, data=data)
user_ssh_keys = await data.ssh_key(asf_uid=session.uid).all()
+ svn_base_path = shared.upload.svn_import_base_path(release.project, shared.upload.SvnArea.DEV)
block = htm.Block()
@@ -98,6 +100,12 @@ async def selected(
htm.em["Evaluate files"],
" page for this draft once the task is queued.",
]
+ svn_base_url = f"{constants.SVN_DIST_ROOT_URL}/{svn_base_path!s}/"
+ block.p[
+ "The SVN path is relative to ",
+ htm.a(href=svn_base_url)[htm.code[svn_base_url]],
+ ".",
+ ]
await form.render_block(
block,
diff --git a/atr/post/upload.py b/atr/post/upload.py
index bc11b118..1211c965 100644
--- a/atr/post/upload.py
+++ b/atr/post/upload.py
@@ -134,14 +134,6 @@ async def _add_files(
)
-def _construct_svn_url(
- committee_key: str, area: shared.upload.SvnArea, path: safe.RelPath, *, is_podling: bool
-) -> safe.RelPath:
- if is_podling:
- return path.prepend(f"{area.value}/incubator/{committee_key}")
- return path.prepend(f"{area.value}/{committee_key}")
-
-
def _log_access_error(error: storage.AccessError, status: int) -> None:
if status >= 500:
log.error("Upload storage access server error", exc_info=(type(error), error, error.__traceback__))
@@ -163,15 +155,8 @@ async def _svn_import(
async with db.session() as data:
release = await session.release(project_key, version_key, data=data)
- is_podling = (release.project.committee is not None) and release.project.committee.is_podling
- committee_key = release.project.committee_key or str(project_key)
-
- svn_url = _construct_svn_url(
- committee_key,
- svn_area, # pyright: ignore[reportArgumentType]
- svn_path,
- is_podling=is_podling,
- )
+ svn_url = svn_path.prepend(str(shared.upload.svn_import_base_path(release.project, svn_area)))
+
async with storage.write(session) as write:
wacp = await write.as_project_committee_participant(project_key)
await wacp.release.import_from_svn(
diff --git a/atr/shared/upload.py b/atr/shared/upload.py
index 27bc94e0..236e4cb6 100644
--- a/atr/shared/upload.py
+++ b/atr/shared/upload.py
@@ -20,6 +20,7 @@ from typing import Annotated, Literal
import atr.form as form
import atr.models.safe as safe
+import atr.models.sql as sql
type ADD_FILES = Literal["add_files"]
type SVN_IMPORT = Literal["svn_import"]
@@ -44,7 +45,7 @@ class SvnImportForm(form.Form):
# )
svn_path: safe.RelPath = form.label(
"SVN path",
- "Path within the committee's svn:dist directory, e.g. 'java-library/4_0_4' or '3.1.5rc1'.",
+ "The part after the base URL shown above, for example '0.7.2-rc.1' or 'java-library/4_0_4'.",
required=True,
)
revision: str = form.label(
@@ -62,3 +63,10 @@ type UploadForm = Annotated[
AddFilesForm | SvnImportForm,
form.DISCRIMINATOR,
]
+
+
+def svn_import_base_path(project: sql.Project, area: SvnArea) -> safe.RelPath:
+ committee_key = project.committee_key or project.key
+ if (project.committee is not None) and project.committee.is_podling:
+ return safe.RelPath(f"{area.value}/incubator/{committee_key}")
+ return safe.RelPath(f"{area.value}/{committee_key}")
diff --git a/tests/unit/test_svn_import_base_path.py b/tests/unit/test_svn_import_base_path.py
new file mode 100644
index 00000000..4dce5043
--- /dev/null
+++ b/tests/unit/test_svn_import_base_path.py
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import pytest
+
+import atr.models.sql as sql
+import atr.shared.upload as upload
+
+
+@pytest.mark.parametrize(
+ ("committee_key", "is_podling", "expected"),
+ [
+ ("example", True, "dev/incubator/example"),
+ ("example", False, "dev/example"),
+ (None, False, "dev/example-component"),
+ ],
+)
+def test_svn_import_base_path(committee_key: str | None, is_podling: bool, expected: str) -> None:
+ committee = sql.Committee(key=committee_key, is_podling=is_podling) if committee_key else None
+ project = sql.Project(key="example-component", committee_key=committee_key, committee=committee)
+
+ assert str(upload.svn_import_base_path(project, upload.SvnArea.DEV)) == expected
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org