diff --git a/edkrepo/commands/arguments/sync_args.py b/edkrepo/commands/arguments/sync_args.py index 2c0833c..8321f23 100644 --- a/edkrepo/commands/arguments/sync_args.py +++ b/edkrepo/commands/arguments/sync_args.py @@ -14,4 +14,5 @@ COMMAND_DESCRIPTION = 'Updates the local copy of the current combination\'s target branches by pulling the latest changes from the server. Does not update local branches.' FETCH_HELP = 'Performs a fetch only sync, no changes will be made to the local workspace.' UPDATE_LOCAL_MANIFEST_HELP = 'Updates the local copy of the project manifest file prior to performing sync operations.' -OVERRIDE_HELP = 'Ignore warnings and proceed with sync operations.' \ No newline at end of file +OVERRIDE_HELP = 'Ignore warnings and proceed with sync operations.' +TAG_HELP = 'Enables tags to be pulled and TC_* tags to be removed. Using this flag will result in a significantly longer sync time.' diff --git a/edkrepo/commands/sync_command.py b/edkrepo/commands/sync_command.py index 511ba1f..611ae95 100644 --- a/edkrepo/commands/sync_command.py +++ b/edkrepo/commands/sync_command.py @@ -22,7 +22,7 @@ from edkrepo.commands.edkrepo_command import EdkrepoCommand from edkrepo.commands.edkrepo_command import SubmoduleSkipArgument, SourceManifestRepoArgument import edkrepo.commands.arguments.sync_args as arguments -import edkrepo.commands.humble.sync_command as humble +import edkrepo.commands.humble.sync_humble as humble from edkrepo.common.edkrepo_exception import EdkrepoException, EdkrepoManifestNotFoundException from edkrepo.common.edkrepo_exception import EdkrepoManifestChangedException from edkrepo.common.humble import SPARSE_RESET, SPARSE_CHECKOUT, INCLUDED_FILE_NAME @@ -76,6 +76,10 @@ def get_metadata(self): 'positional' : False, 'required' : False, 'help-text' : arguments.OVERRIDE_HELP}) + args.append({'name' : 'tags', + 'short-name' : 't', + 'required' : False, + 'help-text': arguments.TAG_HELP}) args.append(SubmoduleSkipArgument) args.append(SourceManifestRepoArgument) return metadata @@ -167,6 +171,11 @@ def run_command(self, args, config): manifest_repo = manifest.general_config.source_manifest_repo global_manifest_path = get_manifest_repo_path(manifest_repo, config) for repo_to_sync in repo_sources_to_sync: + if not args.fetch: + ui_functions.print_info_msg(humble.SYNCING.format(repo_to_sync.root, repo.active_branch), header = False) + else: + ui_functions.print_info_msg(humble.FETCHING.format(repo_to_sync.root, repo.active_branch), header = False) + local_repo_path = os.path.join(workspace_path, repo_to_sync.root) # Update any hooks if global_manifest_directory is not None: @@ -174,6 +183,8 @@ def run_command(self, args, config): repo = Repo(local_repo_path) #Fetch notes repo.remotes.origin.fetch("refs/notes/*:refs/notes/*") + if args.tags: + repo.git.execute(['git', 'fetch', '--tags']) if repo_to_sync.patch_set: patchset_branch_creation_flow(repo_to_sync, repo, workspace_path, manifest, global_manifest_path, args.override) elif repo_to_sync.commit is None and repo_to_sync.tag is None: @@ -182,10 +193,7 @@ def run_command(self, args, config): repo.remotes.origin.fetch("refs/heads/{0}:refs/remotes/origin/{0}".format(repo_to_sync.branch)) #The new branch may not exist in the heads list yet if it is a new branch repo.git.checkout(repo_to_sync.branch) - if not args.fetch: - ui_functions.print_info_msg(humble.SYNCING.format(repo_to_sync.root, repo.active_branch), header = False) - else: - ui_functions.print_info_msg(humble.FETCHING.format(repo_to_sync.root, repo.active_branch), header = False) + try: repo.remotes.origin.fetch() except GitCommandError as e: