Skip to content

Commit d12d7f9

Browse files
authored
[JENKINS-68100] Support updating @Deprecated and @RestrictedSince TODOs (jenkinsci#7238)
1 parent 7eaf554 commit d12d7f9

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

update-since-todo.py

+21-4
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,26 @@ def analyze_file(file, lineno, commits_and_tags, dry_run=False):
5353
print(f"\tfirst tag was {first_tag}")
5454
commits_and_tags[line_sha] = first_tag
5555
if not dry_run:
56+
since_version = first_tag.replace("jenkins-", "")
5657
update_file(
5758
file,
5859
int(lineno),
5960
"@since TODO",
60-
"@since " + first_tag.replace("jenkins-", ""),
61+
f"@since {since_version}",
6162
)
63+
update_file(
64+
file,
65+
int(lineno),
66+
'@Deprecated(since = "TODO")',
67+
f'@Deprecated(since = "{since_version}")',
68+
)
69+
update_file(
70+
file,
71+
int(lineno),
72+
'@RestrictedSince("TODO")',
73+
f'@RestrictedSince("{since_version}")',
74+
)
75+
6276
else:
6377
print(
6478
"\tNot updating file, no tag found. "
@@ -78,7 +92,8 @@ def analyze_files(commits_and_tags, dry_run=False):
7892
GIT,
7993
"grep",
8094
"--line-number",
81-
"@since TODO",
95+
"-E",
96+
'@since TODO|@Deprecated\\(since = "TODO"\\)|@RestrictedSince\\("TODO"\\)',
8297
"--",
8398
"*.java",
8499
"*.jelly",
@@ -111,12 +126,14 @@ def display_results(commits_and_tags):
111126

112127
def main():
113128
"""
114-
Update '@since TODO' entries with actual Jenkins release versions.
129+
Update '@since TODO', '@Deprecated(since = "TODO")', and '@RestrictedSince("TODO")' entries
130+
with actual Jenkins release versions.
115131
116132
This script is a developer tool, to be used by maintainers.
117133
"""
118134
parser = argparse.ArgumentParser(
119-
description="Update '@since TODO' entries with actual Jenkins release versions."
135+
description="Update '@since TODO', '@Deprecated(since = \"TODO\")', and '@RestrictedSince(\"TODO\")' entries "
136+
"with actual Jenkins release versions. "
120137
)
121138
parser.add_argument("-n", "--dry-run", help="Dry run", action="store_true")
122139
args = parser.parse_args()

0 commit comments

Comments
 (0)