Skip to content

Commit a5b859b

Browse files
ashedesimonekevinsun49
authored andcommitted
EdkRepo: Add --tags flag to sync command
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 #134 Signed-off-by: Ashley E Desimone <[email protected]> Reviewed-by: Kevin Sun <[email protected]>
1 parent 33252d4 commit a5b859b

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

edkrepo/commands/arguments/sync_args.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
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.'
1515
FETCH_HELP = 'Performs a fetch only sync, no changes will be made to the local workspace.'
1616
UPDATE_LOCAL_MANIFEST_HELP = 'Updates the local copy of the project manifest file prior to performing sync operations.'
17-
OVERRIDE_HELP = 'Ignore warnings and proceed with sync operations.'
17+
OVERRIDE_HELP = 'Ignore warnings and proceed with sync operations.'
18+
TAG_HELP = 'Enables tags to be pulled and TC_* tags to be removed. Using this flag will result in a significantly longer sync time.'

edkrepo/commands/sync_command.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from edkrepo.commands.edkrepo_command import EdkrepoCommand
2323
from edkrepo.commands.edkrepo_command import SubmoduleSkipArgument, SourceManifestRepoArgument
2424
import edkrepo.commands.arguments.sync_args as arguments
25-
import edkrepo.commands.humble.sync_command as humble
25+
import edkrepo.commands.humble.sync_humble as humble
2626
from edkrepo.common.edkrepo_exception import EdkrepoException, EdkrepoManifestNotFoundException
2727
from edkrepo.common.edkrepo_exception import EdkrepoManifestChangedException
2828
from edkrepo.common.humble import SPARSE_RESET, SPARSE_CHECKOUT, INCLUDED_FILE_NAME
@@ -76,6 +76,10 @@ def get_metadata(self):
7676
'positional' : False,
7777
'required' : False,
7878
'help-text' : arguments.OVERRIDE_HELP})
79+
args.append({'name' : 'tags',
80+
'short-name' : 't',
81+
'required' : False,
82+
'help-text': arguments.TAG_HELP})
7983
args.append(SubmoduleSkipArgument)
8084
args.append(SourceManifestRepoArgument)
8185
return metadata
@@ -167,13 +171,20 @@ def run_command(self, args, config):
167171
manifest_repo = manifest.general_config.source_manifest_repo
168172
global_manifest_path = get_manifest_repo_path(manifest_repo, config)
169173
for repo_to_sync in repo_sources_to_sync:
174+
if not args.fetch:
175+
ui_functions.print_info_msg(humble.SYNCING.format(repo_to_sync.root, repo.active_branch), header = False)
176+
else:
177+
ui_functions.print_info_msg(humble.FETCHING.format(repo_to_sync.root, repo.active_branch), header = False)
178+
170179
local_repo_path = os.path.join(workspace_path, repo_to_sync.root)
171180
# Update any hooks
172181
if global_manifest_directory is not None:
173182
update_hooks(hooks_add, hooks_update, hooks_uninstall, local_repo_path, repo_to_sync, config, global_manifest_directory)
174183
repo = Repo(local_repo_path)
175184
#Fetch notes
176185
repo.remotes.origin.fetch("refs/notes/*:refs/notes/*")
186+
if args.tags:
187+
repo.git.execute(['git', 'fetch', '--tags'])
177188
if repo_to_sync.patch_set:
178189
patchset_branch_creation_flow(repo_to_sync, repo, workspace_path, manifest, global_manifest_path, args.override)
179190
elif repo_to_sync.commit is None and repo_to_sync.tag is None:
@@ -182,10 +193,7 @@ def run_command(self, args, config):
182193
repo.remotes.origin.fetch("refs/heads/{0}:refs/remotes/origin/{0}".format(repo_to_sync.branch))
183194
#The new branch may not exist in the heads list yet if it is a new branch
184195
repo.git.checkout(repo_to_sync.branch)
185-
if not args.fetch:
186-
ui_functions.print_info_msg(humble.SYNCING.format(repo_to_sync.root, repo.active_branch), header = False)
187-
else:
188-
ui_functions.print_info_msg(humble.FETCHING.format(repo_to_sync.root, repo.active_branch), header = False)
196+
189197
try:
190198
repo.remotes.origin.fetch()
191199
except GitCommandError as e:

0 commit comments

Comments
 (0)