* [edk2-staging/EdkRepo] [PATCH 0/2] EdkRepo: Remove duplicate function definitions
@ 2020-05-01 20:39 Ashley E Desimone
2020-05-01 20:39 ` [edk2-staging/EdkRepo] [PATCH 1/2] EdkRepo: Remove duplicate definition of generate_name_for_obsolete_backup Ashley E Desimone
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Ashley E Desimone @ 2020-05-01 20:39 UTC (permalink / raw)
To: devel
Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
Prince Agyeman
Remove the duplicate definition of functions in
common_repo_functions.py and update imports to use
the definitions in workspace_maintenance.py.
Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Ashley E Desimone (2):
EdkRepo: Remove duplicate definition of
generate_name_for_obsolete_backup
EdkRepo: Remove duplicate definitions of case_insensitive_single_match
and case_insensitive_equal
edkrepo/commands/clone_command.py | 3 ++-
edkrepo/commands/sync_command.py | 3 ++-
edkrepo/common/common_repo_functions.py | 35 +--------------------------------
3 files changed, 5 insertions(+), 36 deletions(-)
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [edk2-staging/EdkRepo] [PATCH 1/2] EdkRepo: Remove duplicate definition of generate_name_for_obsolete_backup
2020-05-01 20:39 [edk2-staging/EdkRepo] [PATCH 0/2] EdkRepo: Remove duplicate function definitions Ashley E Desimone
@ 2020-05-01 20:39 ` Ashley E Desimone
2020-05-01 20:39 ` [edk2-staging/EdkRepo] [PATCH 2/2] EdkRepo: Remove duplicate definitions of case_insensitive_single_match and case_insensitive_equal Ashley E Desimone
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ashley E Desimone @ 2020-05-01 20:39 UTC (permalink / raw)
To: devel
Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
Prince Agyeman
Remove the duplicate definition of generate_name_for_obsolete_backup from
common_repo_functions.py and update imports to use the definition in
workspace_maintenance.py
Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
edkrepo/commands/sync_command.py | 3 ++-
edkrepo/common/common_repo_functions.py | 21 ---------------------
2 files changed, 2 insertions(+), 22 deletions(-)
diff --git a/edkrepo/commands/sync_command.py b/edkrepo/commands/sync_command.py
index cb9dc4b..82f5247 100644
--- a/edkrepo/commands/sync_command.py
+++ b/edkrepo/commands/sync_command.py
@@ -34,12 +34,13 @@ from edkrepo.common.humble import SYNC_REBASE_CALC_FAIL
from edkrepo.common.pathfix import get_actual_path
from edkrepo.common.common_repo_functions import pull_latest_manifest_repo, clone_repos, sparse_checkout_enabled
from edkrepo.common.common_repo_functions import reset_sparse_checkout, sparse_checkout, verify_manifest_data
-from edkrepo.common.common_repo_functions import generate_name_for_obsolete_backup, checkout_repos, check_dirty_repos
+from edkrepo.common.common_repo_functions import checkout_repos, check_dirty_repos
from edkrepo.common.common_repo_functions import update_editor_config
from edkrepo.common.common_repo_functions import update_repo_commit_template, get_latest_sha
from edkrepo.common.common_repo_functions import has_primary_repo_remote, fetch_from_primary_repo, in_sync_with_primary
from edkrepo.common.common_repo_functions import update_hooks, maintain_submodules, combinations_in_manifest
from edkrepo.common.common_repo_functions import write_included_config, remove_included_config
+from edkrepo.common.workspace_maintenance.workspace_maintenance import generate_name_for_obsolete_backup
from edkrepo.common.ui_functions import init_color_console
from edkrepo.config.config_factory import get_workspace_path, get_workspace_manifest, get_edkrepo_global_data_directory
from edkrepo_manifest_parser.edk_manifest import CiIndexXml, ManifestXml
diff --git a/edkrepo/common/common_repo_functions.py b/edkrepo/common/common_repo_functions.py
index 2aa5f5f..a333489 100644
--- a/edkrepo/common/common_repo_functions.py
+++ b/edkrepo/common/common_repo_functions.py
@@ -393,27 +393,6 @@ def checkout_repos(verbose, override, repos_to_checkout, workspace_path, manifes
if repo_to_checkout.enable_submodule:
maintain_submodules(repo_to_checkout, repo, verbose)
-
-
-def generate_name_for_obsolete_backup(absolute_path):
- if not os.path.exists(absolute_path):
- raise ValueError("{} does not exist".format(absolute_path))
- original_name = os.path.basename(absolute_path)
- dir_name = os.path.dirname(absolute_path)
- unique_name = ""
- unique_name_found = False
- index = 1
- while not unique_name_found:
- if index == 1:
- unique_name = "{}_old".format(original_name)
- else:
- unique_name = "{}_old{}".format(original_name, index)
- if not os.path.exists(os.path.join(dir_name, unique_name)):
- unique_name_found = True
- index += 1
- return unique_name
-
-
def verify_manifest_data(global_manifest_directory, config, verbose=False, verify_all=False, verify_proj=None, verify_archived=False):
# Validate the project individual project selected
if verify_proj:
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [edk2-staging/EdkRepo] [PATCH 2/2] EdkRepo: Remove duplicate definitions of case_insensitive_single_match and case_insensitive_equal
2020-05-01 20:39 [edk2-staging/EdkRepo] [PATCH 0/2] EdkRepo: Remove duplicate function definitions Ashley E Desimone
2020-05-01 20:39 ` [edk2-staging/EdkRepo] [PATCH 1/2] EdkRepo: Remove duplicate definition of generate_name_for_obsolete_backup Ashley E Desimone
@ 2020-05-01 20:39 ` Ashley E Desimone
2020-05-05 7:41 ` [edk2-staging/EdkRepo] [PATCH 0/2] EdkRepo: Remove duplicate function definitions Nate DeSimone
2020-05-05 8:06 ` Nate DeSimone
3 siblings, 0 replies; 5+ messages in thread
From: Ashley E Desimone @ 2020-05-01 20:39 UTC (permalink / raw)
To: devel
Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
Prince Agyeman
Remove duplicate definitions of and update imports of
case_insensitive_single_match and case_insensitive_equal
to point to the definitions in workspace_maintenance.py
Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
edkrepo/commands/clone_command.py | 3 ++-
edkrepo/common/common_repo_functions.py | 14 +-------------
2 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/edkrepo/commands/clone_command.py b/edkrepo/commands/clone_command.py
index 701a853..cd65fe6 100644
--- a/edkrepo/commands/clone_command.py
+++ b/edkrepo/commands/clone_command.py
@@ -14,12 +14,13 @@ from edkrepo.commands.edkrepo_command import EdkrepoCommand
from edkrepo.commands.edkrepo_command import SubmoduleSkipArgument
import edkrepo.commands.arguments.clone_args as arguments
from edkrepo.common.common_repo_functions import pull_latest_manifest_repo, clone_repos, sparse_checkout, verify_manifest_data
-from edkrepo.common.common_repo_functions import case_insensitive_single_match, update_editor_config
+from edkrepo.common.common_repo_functions import update_editor_config
from edkrepo.common.common_repo_functions import write_included_config, write_conditional_include
from edkrepo.common.common_repo_functions import find_project_in_index, combinations_in_manifest
from edkrepo.common.edkrepo_exception import EdkrepoInvalidParametersException, EdkrepoManifestInvalidException
from edkrepo.common.humble import CLONE_INVALID_WORKSPACE, CLONE_INVALID_PROJECT_ARG, CLONE_INVALID_COMBO_ARG
from edkrepo.common.humble import SPARSE_CHECKOUT, CLONE_INVALID_LOCAL_ROOTS
+from edkrepo.common.workspace_maintenance.workspace_maintenance import case_insensitive_single_match
from edkrepo_manifest_parser.edk_manifest import CiIndexXml, ManifestXml
diff --git a/edkrepo/common/common_repo_functions.py b/edkrepo/common/common_repo_functions.py
index a333489..485aa26 100644
--- a/edkrepo/common/common_repo_functions.py
+++ b/edkrepo/common/common_repo_functions.py
@@ -60,6 +60,7 @@ from edkrepo.common.edkrepo_exception import EdkrepoNotFoundException, EdkrepoGi
from edkrepo.common.edkrepo_exception import EdkrepoFoundMultipleException, EdkrepoHookNotFoundException
from edkrepo.common.edkrepo_exception import EdkrepoGitConfigSetupException, EdkrepoManifestInvalidException
from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import pull_single_manifest_repo
+from edkrepo.common.workspace_maintenance.workspace_maintenance import case_insensitive_single_match
from edkrepo.common.ui_functions import init_color_console
from edkrepo_manifest_parser import edk_manifest
from edkrepo_manifest_parser.edk_manifest_validation import validate_manifestrepo
@@ -571,19 +572,6 @@ def checkout(combination_or_sha, verbose=False, override=False, log=None):
print(SPARSE_CHECKOUT)
sparse_checkout(workspace_path, current_repos, manifest)
-
-def case_insensitive_equal(str1, str2):
- return unicodedata.normalize("NFKD", str1.casefold()) == unicodedata.normalize("NFKD", str2.casefold())
-
-
-def case_insensitive_single_match(str1, str_list):
- matches = [x for x in str_list if case_insensitive_equal(str1, x)]
- if len(matches) == 0:
- raise EdkrepoNotFoundException(GEN_A_NOT_IN_B.format(str1, str_list))
- elif len(matches) > 1:
- raise EdkrepoFoundMultipleException(GEN_FOUND_MULT_A_IN_B.format(str1, str_list))
- return matches[0]
-
def get_latest_sha(repo, branch, remote_or_url='origin'):
try:
(latest_sha, ref) = repo.git.ls_remote(remote_or_url, 'refs/heads/{}'.format(branch)).split()
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [edk2-staging/EdkRepo] [PATCH 0/2] EdkRepo: Remove duplicate function definitions
2020-05-01 20:39 [edk2-staging/EdkRepo] [PATCH 0/2] EdkRepo: Remove duplicate function definitions Ashley E Desimone
2020-05-01 20:39 ` [edk2-staging/EdkRepo] [PATCH 1/2] EdkRepo: Remove duplicate definition of generate_name_for_obsolete_backup Ashley E Desimone
2020-05-01 20:39 ` [edk2-staging/EdkRepo] [PATCH 2/2] EdkRepo: Remove duplicate definitions of case_insensitive_single_match and case_insensitive_equal Ashley E Desimone
@ 2020-05-05 7:41 ` Nate DeSimone
2020-05-05 8:06 ` Nate DeSimone
3 siblings, 0 replies; 5+ messages in thread
From: Nate DeSimone @ 2020-05-05 7:41 UTC (permalink / raw)
To: Desimone, Ashley E, devel@edk2.groups.io
Cc: Pandya, Puja, Bjorge, Erik C, Bret Barkelew, Agyeman, Prince
For the series...
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Desimone, Ashley E <ashley.e.desimone@intel.com>
Sent: Friday, May 1, 2020 1:40 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH 0/2] EdkRepo: Remove duplicate function definitions
Remove the duplicate definition of functions in common_repo_functions.py and update imports to use the definitions in workspace_maintenance.py.
Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Ashley E Desimone (2):
EdkRepo: Remove duplicate definition of
generate_name_for_obsolete_backup
EdkRepo: Remove duplicate definitions of case_insensitive_single_match
and case_insensitive_equal
edkrepo/commands/clone_command.py | 3 ++-
edkrepo/commands/sync_command.py | 3 ++-
edkrepo/common/common_repo_functions.py | 35 +--------------------------------
3 files changed, 5 insertions(+), 36 deletions(-)
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [edk2-staging/EdkRepo] [PATCH 0/2] EdkRepo: Remove duplicate function definitions
2020-05-01 20:39 [edk2-staging/EdkRepo] [PATCH 0/2] EdkRepo: Remove duplicate function definitions Ashley E Desimone
` (2 preceding siblings ...)
2020-05-05 7:41 ` [edk2-staging/EdkRepo] [PATCH 0/2] EdkRepo: Remove duplicate function definitions Nate DeSimone
@ 2020-05-05 8:06 ` Nate DeSimone
3 siblings, 0 replies; 5+ messages in thread
From: Nate DeSimone @ 2020-05-05 8:06 UTC (permalink / raw)
To: Desimone, Ashley E, devel@edk2.groups.io
Cc: Pandya, Puja, Bjorge, Erik C, Bret Barkelew, Agyeman, Prince
Pushed as 9120b007~..48a58d54
-----Original Message-----
From: Desimone, Ashley E <ashley.e.desimone@intel.com>
Sent: Friday, May 1, 2020 1:40 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH 0/2] EdkRepo: Remove duplicate function definitions
Remove the duplicate definition of functions in common_repo_functions.py and update imports to use the definitions in workspace_maintenance.py.
Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Ashley E Desimone (2):
EdkRepo: Remove duplicate definition of
generate_name_for_obsolete_backup
EdkRepo: Remove duplicate definitions of case_insensitive_single_match
and case_insensitive_equal
edkrepo/commands/clone_command.py | 3 ++-
edkrepo/commands/sync_command.py | 3 ++-
edkrepo/common/common_repo_functions.py | 35 +--------------------------------
3 files changed, 5 insertions(+), 36 deletions(-)
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-05-05 8:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-01 20:39 [edk2-staging/EdkRepo] [PATCH 0/2] EdkRepo: Remove duplicate function definitions Ashley E Desimone
2020-05-01 20:39 ` [edk2-staging/EdkRepo] [PATCH 1/2] EdkRepo: Remove duplicate definition of generate_name_for_obsolete_backup Ashley E Desimone
2020-05-01 20:39 ` [edk2-staging/EdkRepo] [PATCH 2/2] EdkRepo: Remove duplicate definitions of case_insensitive_single_match and case_insensitive_equal Ashley E Desimone
2020-05-05 7:41 ` [edk2-staging/EdkRepo] [PATCH 0/2] EdkRepo: Remove duplicate function definitions Nate DeSimone
2020-05-05 8:06 ` Nate DeSimone
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox