File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 1+ import logging
12import os
23import sys
34from typing import (
910from azul import (
1011 config ,
1112)
13+ from azul .logging import (
14+ configure_script_logging ,
15+ )
1216
1317"""
1418Ensure that the currently checked out branch matches the selected deployment
1519"""
1620
21+ log = logging .getLogger (__name__ )
22+
1723
1824def default_deployment (branch : str | None ) -> str | None :
1925 deployments = config .shared_deployments_for_branch (branch )
@@ -83,9 +89,17 @@ def target_branch() -> str | None:
8389 except KeyError :
8490 pass
8591 else :
86- return branch
92+ if branch :
93+ log .info ('Target branch is %r as defined in %r' , branch , variable )
94+ return branch
8795 repo = git .Repo (config .project_root )
88- return None if repo .head .is_detached else repo .head .reference .name
96+ if repo .head .is_detached :
97+ branch = None
98+ log .info ('Target branch is %r because HEAD is detached' , branch )
99+ else :
100+ branch = repo .head .reference .name
101+ log .info ('Target branch is %r because it is checked out' , branch )
102+ return branch
89103
90104
91105def main (argv ):
@@ -109,4 +123,5 @@ def main(argv):
109123
110124
111125if __name__ == '__main__' :
126+ configure_script_logging (log )
112127 main (sys .argv [1 :])
You can’t perform that action at this time.
0 commit comments