@@ -146,24 +146,35 @@ def main() -> None:
146146 help = ('sync the given repo and all repos that depend on it; '
147147 'the default is torch_xla' ),
148148 )
149+ arg_parser .add_argument (
150+ '--all' ,
151+ '-a' ,
152+ action = 'store_true' ,
153+ help = ('sync all repos (pytorch, vision, and torch_xla); shorthand for '
154+ '--base_repo pytorch' ),
155+ )
149156
150157 args = arg_parser .parse_args ()
151158
152- success = True
153- if args .base_repo == _PYTORCH_REPO :
154- if not sync_repo (_PYTORCH_REPO ):
155- success = False
159+ sync_pytorch = args .all or args .base_repo == _PYTORCH_REPO
160+ sync_vision = sync_pytorch or args .base_repo == _VISION_REPO
156161
157- if args .base_repo in (_PYTORCH_REPO , _VISION_REPO ):
158- # The torchvision repo is optional, so skip it if it doesn't exist.
159- if os .path .isdir (_VISION_DIR ) and not sync_repo (_VISION_REPO ):
160- success = False
162+ failed_repos : list [str ] = []
163+ if sync_pytorch and not sync_repo (_PYTORCH_REPO ):
164+ failed_repos .append (_PYTORCH_REPO )
165+
166+ if (sync_vision and
167+ # The torchvision repo is optional, so skip it if it doesn't exist.
168+ os .path .isdir (_VISION_DIR ) and not sync_repo (_VISION_REPO )):
169+ failed_repos .append (_VISION_REPO )
161170
162171 if not sync_repo (_TORCH_XLA_REPO ):
163- success = False
172+ failed_repos . append ( _TORCH_XLA_REPO )
164173
165- if not success :
166- logger .error ('Failed to sync some repos.' )
174+ # Print the failed repos last, so that the error is not buried in
175+ # the middle of the messages.
176+ if failed_repos :
177+ logger .error (f'Failed to sync repos: { ", " .join (failed_repos )} .' )
167178 sys .exit (1 )
168179
169180 logger .info ('All repos synced successfully.' )
0 commit comments