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/08/10 14:41:27 UTC
(tooling-trusted-releases) branch sbp updated (a87e329a -> d221aa18)
This is an automated email from the ASF dual-hosted git repository.
sbp pushed a change to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
discard a87e329a Add a helper for exporting from SVN
new d221aa18 Add a helper for exporting from SVN
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (a87e329a)
\
N -- N -- N refs/heads/sbp (d221aa18)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
atr/svn/__init__.py | 5 ++++-
tests/unit/test_svn_export.py | 27 +++++++++++++++++++++++++--
2 files changed, 29 insertions(+), 3 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org
(tooling-trusted-releases) 01/01: Add a helper for exporting from SVN
Posted by sb...@apache.org.
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
commit d221aa18cf95a4ab4acb030cfcd07b9c9f7d3b66
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Mon Aug 10 15:25:46 2026 +0100
Add a helper for exporting from SVN
---
atr/svn/__init__.py | 16 ++++++++
tests/unit/test_svn_export.py | 88 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 104 insertions(+)
diff --git a/atr/svn/__init__.py b/atr/svn/__init__.py
index a31a8346..935471e6 100644
--- a/atr/svn/__init__.py
+++ b/atr/svn/__init__.py
@@ -175,6 +175,22 @@ def error_message(exc: CommandExecutionError) -> str:
return f"svn exited with code {exc.returncode}"
+async def export(
+ url: str,
+ revision: int | None,
+ destination: pathlib.Path,
+ timeout_seconds: float = EXPORT_TIMEOUT_SECONDS,
+) -> None:
+ arguments = ["export", "--non-interactive", "--ignore-externals", "--ignore-keywords"]
+ if revision is not None:
+ arguments.extend(["-r", str(revision)])
+ pegged_url = f"{url}@{revision}"
+ else:
+ pegged_url = f"{url}@"
+ arguments.extend(["--", pegged_url, str(destination)])
+ await run_command("svn", *arguments, timeout_seconds=timeout_seconds)
+
+
async def get_diff(path: pathlib.Path, revision: int) -> str:
log.debug(f"running svn diff for '{path}': r{revision}")
svn_token = config.get().SVN_TOKEN
diff --git a/tests/unit/test_svn_export.py b/tests/unit/test_svn_export.py
new file mode 100644
index 00000000..1622f605
--- /dev/null
+++ b/tests/unit/test_svn_export.py
@@ -0,0 +1,88 @@
+# 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 pathlib
+import shutil
+import unittest.mock as mock
+
+import pytest
+
+import atr.svn as svn
+
+requires_svn = pytest.mark.skipif(
+ (shutil.which("svn") is None) or (shutil.which("svnadmin") is None),
+ reason="The Subversion command line tools are not available",
+)
+
+
+@requires_svn
+async def test_export_pinned_revision_of_deleted_path(tmp_path: pathlib.Path) -> None:
+ repository = tmp_path / "repository"
+ await svn.run_command("svnadmin", "create", str(repository))
+ url = f"file://{repository}/release"
+ source = tmp_path / "source"
+ source.mkdir()
+ (source / "artifact.tar.gz").write_bytes(b"artifact bytes")
+ await svn.run_command("svn", "import", str(source), url, "--non-interactive", "-m", "Import")
+ await svn.run_command("svn", "rm", url, "--non-interactive", "-m", "Remove")
+ destination = tmp_path / "export"
+
+ await svn.export(url, 1, destination)
+
+ assert (destination / "artifact.tar.gz").read_bytes() == b"artifact bytes"
+
+
+async def test_export_pins_revision(tmp_path: pathlib.Path, monkeypatch: pytest.MonkeyPatch) -> None:
+ run_command = mock.AsyncMock(return_value="")
+ monkeypatch.setattr(svn, "run_command", run_command)
+ destination = tmp_path / "dest"
+
+ await svn.export("file:///repo/example", 42, destination)
+
+ run_command.assert_awaited_once_with(
+ "svn",
+ "export",
+ "--non-interactive",
+ "--ignore-externals",
+ "--ignore-keywords",
+ "-r",
+ "42",
+ "--",
+ "file:///repo/example@42",
+ str(destination),
+ timeout_seconds=svn.EXPORT_TIMEOUT_SECONDS,
+ )
+
+
+async def test_export_without_revision(tmp_path: pathlib.Path, monkeypatch: pytest.MonkeyPatch) -> None:
+ run_command = mock.AsyncMock(return_value="")
+ monkeypatch.setattr(svn, "run_command", run_command)
+ destination = tmp_path / "dest"
+
+ await svn.export("file:///repo/example", None, destination, timeout_seconds=10.0)
+
+ run_command.assert_awaited_once_with(
+ "svn",
+ "export",
+ "--non-interactive",
+ "--ignore-externals",
+ "--ignore-keywords",
+ "--",
+ "file:///repo/example@",
+ str(destination),
+ timeout_seconds=10.0,
+ )
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org