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 8d01b2751009df98b9559f744b1862a0181c4f02
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed Mar 11 16:56:45 2026 +0000

    Make the revision number optional in the form to add ignores
---
 atr/models/safe.py    | 16 +++++++++++++++-
 atr/shared/ignores.py |  2 +-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/atr/models/safe.py b/atr/models/safe.py
index 9ec73067..c71daf27 100644
--- a/atr/models/safe.py
+++ b/atr/models/safe.py
@@ -19,7 +19,9 @@ from __future__ import annotations
 
 import string
 import unicodedata
-from typing import Any, Final
+from typing import Annotated, Any, Final
+
+import pydantic
 
 _ALPHANUM: Final = frozenset(string.ascii_letters + string.digits + "-")
 _NUMERIC: Final = frozenset(string.digits)
@@ -121,6 +123,18 @@ class VersionName(Alphanumeric):
             raise ValueError("A version should end with an alphanumeric 
character")
 
 
+def _empty_to_none(v: object) -> object:
+    if isinstance(v, str) and (not v):
+        return None
+    return v
+
+
+type OptionalRevisionNumber = Annotated[
+    RevisionNumber | None,
+    pydantic.BeforeValidator(_empty_to_none),
+]
+
+
 def _assert_standard_safe_syntax(value: str) -> None:
     if unicodedata.normalize("NFC", value) != value:
         raise ValueError("Value must be NFC-normalized")
diff --git a/atr/shared/ignores.py b/atr/shared/ignores.py
index 56cb0b84..947c86eb 100644
--- a/atr/shared/ignores.py
+++ b/atr/shared/ignores.py
@@ -44,7 +44,7 @@ class IgnoreStatus(enum.Enum):
 class AddIgnoreForm(form.Form):
     variant: ADD = form.value(ADD)
     release_glob: str = form.label("Release pattern", default="")
-    revision_number: safe.RevisionNumber = form.label("Revision number 
(literal)", default="")
+    revision_number: safe.OptionalRevisionNumber = form.label("Revision number 
(literal)", default="")
     checker_glob: str = form.label("Checker pattern", default="")
     primary_rel_path_glob: str = form.label("Primary rel path pattern", 
default="")
     member_rel_path_glob: str = form.label("Member rel path pattern", 
default="")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to