Skip to content

Commit

Permalink
Merge branch 'main' into logger
Browse files Browse the repository at this point in the history
  • Loading branch information
hrsh25 authored Dec 20, 2022
2 parents 142a850 + ae8186c commit 4e02dd6
Show file tree
Hide file tree
Showing 11 changed files with 611 additions and 98 deletions.
13 changes: 6 additions & 7 deletions edkrepo/commands/checkout_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
# Standard modules
import sys
import os

# Third-Party modules

# Our modules
from edkrepo.commands.edkrepo_command import EdkrepoCommand, OverrideArgument
Expand All @@ -20,6 +15,7 @@
from edkrepo.common.common_repo_functions import checkout, combination_is_in_manifest
from edkrepo.common.edkrepo_exception import EdkrepoInvalidParametersException
from edkrepo.config.config_factory import get_workspace_manifest
from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import get_manifest_repo_path


class CheckoutCommand(EdkrepoCommand):
Expand All @@ -42,7 +38,10 @@ def get_metadata(self):
return metadata

def run_command(self, args, config):
if combination_is_in_manifest(args.Combination, get_workspace_manifest()):
checkout(args.Combination, args.verbose, args.override, get_repo_cache_obj(config))
manifest = get_workspace_manifest()
manifest_repo = manifest.general_config.source_manifest_repo
global_manifest_path = get_manifest_repo_path(manifest_repo, config)
if combination_is_in_manifest(args.Combination, manifest):
checkout(args.Combination, global_manifest_path, args.verbose, args.override, get_repo_cache_obj(config))
else:
raise EdkrepoInvalidParametersException(humble.NO_COMBO.format(args.Combination))
9 changes: 5 additions & 4 deletions edkrepo/commands/clone_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
from edkrepo.common.workspace_maintenance.workspace_maintenance import case_insensitive_single_match
from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import pull_all_manifest_repos, find_project_in_all_indices
from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import list_available_manifest_repos
from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import find_source_manifest_repo
from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import find_source_manifest_repo, get_manifest_repo_path
from edkrepo.common.workspace_maintenance.humble.manifest_repos_maintenance_humble import PROJ_NOT_IN_REPO, SOURCE_MANIFEST_REPO_NOT_FOUND
from edkrepo.common.logger import get_logger
import edkrepo.common.ui_functions as ui_functions
from edkrepo_manifest_parser.edk_manifest import CiIndexXml, ManifestXml
from edkrepo_manifest_parser.edk_manifest import ManifestXml
from project_utils.submodule import maintain_submodules
from edkrepo.config.tool_config import SUBMODULE_CACHE_REPO_NAME

Expand Down Expand Up @@ -78,7 +78,6 @@ def run_command(self, args, config):
logger = get_logger()
pull_all_manifest_repos(config['cfg_file'], config['user_cfg_file'], False)

name_or_manifest = args.ProjectNameOrManifestFile
workspace_dir = args.Workspace
# Check to see if requested workspace exists. If not create it. If so check for empty
if workspace_dir == '.':
Expand Down Expand Up @@ -108,6 +107,8 @@ def run_command(self, args, config):
except EdkrepoManifestNotFoundException:
raise EdkrepoInvalidParametersException(CLONE_INVALID_PROJECT_ARG)

manifest_repository_path = get_manifest_repo_path(manifest_repo, config)

# If this manifest is in a defined manifest repository validate the manifest within the manifest repo
if manifest_repo in cfg:
verify_single_manifest(config['cfg_file'], manifest_repo, global_manifest_path)
Expand Down Expand Up @@ -178,7 +179,7 @@ def run_command(self, args, config):
cache_obj = get_repo_cache_obj(config)
if cache_obj is not None:
add_missing_cache_repos(cache_obj, manifest, args.verbose)
clone_repos(args, workspace_dir, repo_sources_to_clone, project_client_side_hooks, config, manifest, cache_obj)
clone_repos(args, workspace_dir, repo_sources_to_clone, project_client_side_hooks, config, manifest, manifest_repository_path, cache_obj)

# Init submodules
if not args.skip_submodule:
Expand Down
5 changes: 4 additions & 1 deletion edkrepo/commands/combo_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@ def run_command(self, args, config):
sources = manifest.get_repo_sources(combo)
length = len(max([source.root for source in sources], key=len))
for source in sources:
logger.info(" {} : {}".format(source.root.ljust(length), source.branch))
if source.branch:
logger.info(" {} : {}".format(source.root.ljust(length), source.branch))
elif source.patch_set:
logger.info(" {} : {}".format(source.root.ljust(length), source.patch_set))
11 changes: 1 addition & 10 deletions edkrepo/commands/f2f_cherry_pick_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from git import Repo
from colorama import Fore

from edkrepo.common.common_repo_functions import sparse_checkout_enabled, get_full_path
from edkrepo.common.common_repo_functions import sparse_checkout_enabled, get_full_path, get_unique_branch_name
from edkrepo.common.logger import get_logger
from edkrepo.commands.edkrepo_command import EdkrepoCommand
from edkrepo.common.edkrepo_exception import EdkrepoAbortCherryPickException, EdkrepoInvalidParametersException, EdkrepoWorkspaceInvalidException
Expand Down Expand Up @@ -428,15 +428,6 @@ def get_common_folder_name(folder1, folder2, config):
else:
return ''

def get_unique_branch_name(branch_name_prefix, repo):
branch_names = [x.name for x in repo.heads]
if branch_name_prefix not in branch_names:
return branch_name_prefix
index = 1
while True:
branch_name = "{}-{}".format(branch_name_prefix, index)
if branch_name not in branch_names:
return branch_name

def cherry_pick_operations_to_include_folder_list(cherry_pick_operations):
include_folder_list = []
Expand Down
Loading

0 comments on commit 4e02dd6

Please sign in to comment.