Skip to content

Commit

Permalink
EdkRepo: Add --tags flag to sync command
Browse files Browse the repository at this point in the history
Add support for fetching tags.

Additionally move messages indicating that the sync
is starting for a repo to the begining of that process
to improve messaging.

Fixes tianocore#134

Signed-off-by: Ashley E Desimone <[email protected]>
Reviewed-by: Kevin Sun <[email protected]>
  • Loading branch information
ashedesimone authored and kevinsun49 committed Apr 11, 2023
1 parent 33252d4 commit a5b859b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
3 changes: 2 additions & 1 deletion edkrepo/commands/arguments/sync_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
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.'
18 changes: 13 additions & 5 deletions edkrepo/commands/sync_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -167,13 +171,20 @@ 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:
update_hooks(hooks_add, hooks_update, hooks_uninstall, local_repo_path, repo_to_sync, config, global_manifest_directory)
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:
Expand All @@ -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:
Expand Down

0 comments on commit a5b859b

Please sign in to comment.