<s> """<STR_LIT>""" <EOL> import sys <EOL> from qisys import ui <EOL> import qisys . parsers <EOL> import qisrc . git <EOL> import qisrc . sync <EOL> import qisrc . parsers <EOL> import qisys . parallel <EOL> import threading <EOL> def configure_parser ( parser ) : <EOL> """<STR_LIT>""" <EOL> qisys . parsers . worktree_parser ( parser ) <EOL> qisys . parsers . project_parser ( parser ) <EOL> qisys . parsers . parallel_parser ( parser , default = <NUM_LIT:1> ) <EOL> group = parser . add_argument_group ( "<STR_LIT>" ) <EOL> group . add_argument ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> group . add_argument ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> def print_overview ( total , skipped , failed ) : <EOL> out = [ ui . green , "<STR_LIT>" , ui . white , total - skipped - failed ] <EOL> if skipped : <EOL> out . append ( ui . yellow ) <EOL> else : <EOL> out . append ( ui . blue ) <EOL> out . extend ( ( "<STR_LIT>" , ui . white , skipped ) ) <EOL> if failed : <EOL> out . append ( ui . red ) <EOL> else : <EOL> out . append ( ui . blue ) <EOL> out . extend ( ( "<STR_LIT>" , ui . white , failed ) ) <EOL> ui . info ( * out ) <EOL> @ ui . timer ( "<STR_LIT>" ) <EOL> def do ( args ) : <EOL> """<STR_LIT>""" <EOL> reset = args . reset <EOL> git_worktree = qisrc . parsers . get_git_worktree ( args ) <EOL> sync_ok = git_worktree . sync ( ) <EOL> if not sync_ok : <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> git_projects = qisrc . parsers . get_git_projects ( git_worktree , args , <EOL> default_all = True , <EOL> use_build_deps = True ) <EOL> if not git_projects : <EOL> qisrc . worktree . on_no_matching_projects ( git_worktree , groups = args . groups ) <EOL> return <EOL> git_worktree . configure_projects ( git_projects ) <EOL> skipped = list ( ) <EOL> failed = list ( ) <EOL> ui . info ( ui . green , "<STR_LIT>" ) <EOL> max_src = max ( len ( x . src ) for x in git_projects ) <EOL> i = [ <NUM_LIT:0> ] <EOL> lock = threading . Lock ( ) <EOL> def do_sync ( git_project ) : <EOL> if reset : <EOL> ( status , out ) = git_project . reset ( ) <EOL> else : <EOL> ( status , out ) = git_project . sync ( rebase_devel = args . rebase_devel ) <EOL> with lock : <EOL> ui . info_count ( i [ <NUM_LIT:0> ] , len ( git_projects ) , <EOL> ui . blue , git_project . src . ljust ( max_src ) ) <EOL> if status is None : <EOL> ui . info ( ui . brown , "<STR_LIT>" ) <EOL> skipped . append ( ( git_project . src , out ) ) <EOL> if status is False : <EOL> ui . info ( ui . red , "<STR_LIT>" ) <EOL> failed . append ( ( git_project . src , out ) ) <EOL> if out : <EOL> ui . info ( ui . indent ( out + "<STR_LIT>" , num = <NUM_LIT:2> ) ) <EOL> i [ <NUM_LIT:0> ] += <NUM_LIT:1> <EOL> qisys . parallel . foreach ( git_projects , do_sync , n_jobs = args . num_jobs ) <EOL> print_overview ( len ( git_projects ) , len ( skipped ) , len ( failed ) ) <EOL> if failed or skipped : <EOL> sys . exit ( <NUM_LIT:1> ) </s>
