-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EdkRepo: Add --tags flag to sync command #150
Conversation
This causes an installation error:
You may need to use 'arguments' instead of 'sync_arguments', and add 'TAG_HELP' to edkrepo/commands/arguments/sync_args.py |
075b5a2
to
0dce084
Compare
I have verified that the latest version of this PR has the correct imports. Thanks for pointing this out. |
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edkrepo sync
Error: local variable 'repo' referenced before assignment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you change 'repo.active_branch' to "repo_to_sync.branch" on line 177 and 179, it won't fail for the case where the repo is on a tag or commit instead of a branch. The info message will say 'None branch' though, followed by the existing warning message that the repo is not on a branch.
Syncing Edk2Platforms to latest None branch...
No need to sync repo Edk2Platforms since it is in detached HEAD state
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edkrepo sync --fetch
Error: local variable 'repo' referenced before assignment
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed on main already. removed from patch file for testing.
7b03d01
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.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"and TC_* tags to be removed"
The code below does "git fetch --tags"; I don't think that will remove any tags unless --force is used. Update TAG_HELP string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Help string updated
edkrepo/commands/sync_command.py
Outdated
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repo is assigned here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move repo assignment and local path calculation to the start of the for loop
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]>
"edkrepo sync" and "edkrepo sync -u" failing on multiple cloned projects using main branch + this patch.
|
The humble.SYNCING message used to occur after a "repo.git.checkout(repo_to_sync.branch)" is done. Possibly you could replace the repo.active_branch in the info message with repo_to_sync.branch to avoid the error. |
repo.remotes.origin.fetch("refs/notes/*:refs/notes/*") | ||
if args.tags: | ||
repo.git.execute(['git', 'fetch', '--tags']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may want to put "git fetch --tags" into a try/except block.
As is, if this line fails, the whole edkrepo sync commands stops, but we might be able to reduce it to a warning.
For example, if a user local tag conflicts with remote tag of the same name, GitCommandError exception occurs.
"raise GitCommandError(command, status, stderr_value, stdout_value)"
"! [rejected] tagname -> tagname (would clobber existing tag)"
"The git command: git fetch --tags failed to complete successfully with the following errors."
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