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]>
  • Loading branch information
ashedesimone committed Mar 17, 2023
1 parent 33252d4 commit 1d41b6f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions edkrepo/commands/sync_command.py
Original file line number Diff line number Diff line change
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': sync_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 1d41b6f

Please sign in to comment.