@@ -2146,55 +2146,44 @@ def manage_repo():
21462146 global db_release
21472147 repo_local_path .mkdir (parents = True , exist_ok = True )
21482148
2149- try :
2150- if not args .skip :
2151- print (f"Updating { repo_name } ..." )
2152- if repo_path .is_dir ():
2153- rname , bname = getRepoBranchName (repo_path )
2154-
2155- # Get new tags from the remote
2156- git_cmds = [
2157- ["git" , "-C" , repo_path , "clean" , "-fdx" ],
2158- ["git" , "-C" , repo_path , "fetch" ],
2159- [
2160- "git" ,
2161- "-C" ,
2162- repo_path ,
2163- "reset" ,
2164- "--hard" ,
2165- f"{ rname } /{ bname } " ,
2166- ],
2167- ]
2168- else :
2169- # Clone it as it does not exists yet
2170- git_cmds = [["git" , "-C" , repo_local_path , "clone" , gh_url ]]
2171-
2172- for cmd in git_cmds :
2173- subprocess .check_output (cmd ).decode ("utf-8" )
2149+ if not args .skip :
2150+ print (f"Updating { repo_name } ..." )
21742151 if repo_path .is_dir ():
2175- # Get tag
2176- sha1_id = (
2177- subprocess .check_output (
2178- ["git" , "-C" , repo_path , "rev-list" , "--tags" , "--max-count=1" ]
2179- )
2180- .decode ("utf-8" )
2181- .strip ()
2182- )
2183- version_tag = (
2184- subprocess .check_output (
2185- ["git" , "-C" , repo_path , "describe" , "--tags" , sha1_id ]
2186- )
2187- .decode ("utf-8" )
2188- .strip ()
2189- )
2190- subprocess .check_output (
2191- ["git" , "-C" , repo_path , "checkout" , version_tag ],
2192- stderr = subprocess .DEVNULL ,
2193- )
2194- db_release = version_tag
2195- return True
2196- except subprocess .CalledProcessError as e :
2197- print (f"Command { e .cmd } failed with error code { e .returncode } " )
2152+ rname , bname = getRepoBranchName (repo_path )
2153+
2154+ # Get new tags from the remote
2155+ git_cmds = [
2156+ ["git" , "-C" , repo_path , "clean" , "-fdx" ],
2157+ ["git" , "-C" , repo_path , "fetch" ],
2158+ [
2159+ "git" ,
2160+ "-C" ,
2161+ repo_path ,
2162+ "reset" ,
2163+ "--hard" ,
2164+ f"{ rname } /{ bname } " ,
2165+ ],
2166+ ]
2167+ else :
2168+ # Clone it as it does not exists yet
2169+ git_cmds = [["git" , "-C" , repo_local_path , "clone" , gh_url ]]
2170+
2171+ for cmd in git_cmds :
2172+ execute_cmd (cmd , None )
2173+ if repo_path .is_dir ():
2174+ # Get tag
2175+ sha1_id = execute_cmd (
2176+ ["git" , "-C" , repo_path , "rev-list" , "--tags" , "--max-count=1" ], None
2177+ )
2178+ version_tag = execute_cmd (
2179+ ["git" , "-C" , repo_path , "describe" , "--tags" , sha1_id ], None
2180+ )
2181+ execute_cmd (
2182+ ["git" , "-C" , repo_path , "checkout" , version_tag ],
2183+ subprocess .DEVNULL ,
2184+ )
2185+ db_release = version_tag
2186+ return True
21982187 return False
21992188
22002189
0 commit comments