Skip to content

Commit 8554534

Browse files
DvirDukhanCopilot
andcommitted
chore(t17): deprecation warning on CamelCase git_repo_name aliases
Per @galshubeli's review on #675: single-arg GitRepoName('foo') used to return '{foo}_git' but now returns '{foo}:<DEFAULT_BRANCH>_git' — a silent shape change for anyone still on the alias. Make it loud with DeprecationWarning so leftover callers find out before they query a graph that no longer exists. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9dfc721 commit 8554534

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

api/git_utils/git_utils.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,32 @@ def legacy_git_repo_name(repo_name):
3333

3434

3535
# Backwards-compatible CamelCase aliases (deprecated, will be removed).
36-
GitRepoName = git_repo_name
37-
LegacyGitRepoName = legacy_git_repo_name
36+
# Behavior note: callers of the *old* ``GitRepoName(repo)`` got
37+
# ``"{repo}_git"``. The new function (and these aliases) return
38+
# ``"{repo}:<branch>_git"`` — defaulting ``branch`` to ``DEFAULT_BRANCH``
39+
# when omitted. That is a silent shape change for the legacy single-arg
40+
# call, so we emit DeprecationWarning to surface it.
41+
42+
def GitRepoName(repo_name, branch=None): # noqa: N802 — preserved name
43+
import warnings
44+
warnings.warn(
45+
"GitRepoName is deprecated; use git_repo_name(repo_name, branch). "
46+
"Note: single-arg calls now return '{repo}:<DEFAULT_BRANCH>_git', "
47+
"not the pre-T17 '{repo}_git' shape.",
48+
DeprecationWarning,
49+
stacklevel=2,
50+
)
51+
return git_repo_name(repo_name, branch)
52+
53+
54+
def LegacyGitRepoName(repo_name): # noqa: N802 — preserved name
55+
import warnings
56+
warnings.warn(
57+
"LegacyGitRepoName is deprecated; use legacy_git_repo_name.",
58+
DeprecationWarning,
59+
stacklevel=2,
60+
)
61+
return legacy_git_repo_name(repo_name)
3862

3963
def is_ignored(file_path: str, ignore_list: List[str]) -> bool:
4064
"""

0 commit comments

Comments
 (0)