From nobody Fri Apr 19 18:30:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61542+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61542+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1592614983; cv=none; d=zohomail.com; s=zohoarc; b=FKIjyt9V4hcN215Os/1wD+sjlTmXBXg1pW/u3KcBM0HrB1eFbwgm+ncsZAQRkAi0dwlhKz2/jC64CqeewBYfhyWntPkZrfUZOXFnyN1jqOjf0Q5zGep91YqlIQSBJSIXvxo8mxGeShmBC7IsjWATWBD+XU0dR5uQ0N6vJRNC6Mo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592614983; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=ajXKO2Q2TAhjFnnLYAeEzYD7LbLqpX1sYm2kMQYqV5g=; b=b+2Mc0sglLQs2cZcQKCc9aBanr49LTZ7lLvBZ1l8kEj2pwuf496rNeyVOWKUx083bJLbwx6Z54KFGTuQc9G/dyxE0Bzi2L3EQqo5X1oLVw2CEsvoDkjTy0jpVZdInmgkZrnMvTarNfUcV/LT2d2nJCZvMrNAiblmPKy6UxXgtw4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61542+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592614983046462.811211278727; Fri, 19 Jun 2020 18:03:03 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id bgXSYY1788612xCUH4GCPEls; Fri, 19 Jun 2020 18:03:02 -0700 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.2986.1592614981812170262 for ; Fri, 19 Jun 2020 18:03:01 -0700 IronPort-SDR: kXmNW76AUhOqbkPrzVhCm2g6mDh4osED9eZlKYIds5baIppICChgdipV2TZJwgrW2MEo+nkijI 97kUDcSj2nSQ== X-IronPort-AV: E=McAfee;i="6000,8403,9657"; a="143099970" X-IronPort-AV: E=Sophos;i="5.75,256,1589266800"; d="scan'208";a="143099970" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2020 18:03:01 -0700 IronPort-SDR: BXxkXTJEuAvy9nkTzeWMMXm+tyKyG/BIKIagnGpGqp6YkZz2PbOu6PFoEAoPdVnRGB2G5P3MMc 4S9bsrsopG5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,256,1589266800"; d="scan'208";a="278178864" X-Received: from aedesimo-desk.amr.corp.intel.com ([10.212.26.9]) by orsmga006.jf.intel.com with ESMTP; 19 Jun 2020 18:03:00 -0700 From: "Ashley E Desimone" To: devel@edk2.groups.io Cc: Nate DeSimone , Puja Pandya , Erik Bjorge , Prince Agyeman , Isaac Oram Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Do not write a local commit template when a global one is defined. Date: Fri, 19 Jun 2020 18:02:47 -0700 Message-Id: <20200620010247.2577-1-ashley.e.desimone@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ashley.e.desimone@intel.com X-Gm-Message-State: ZsCxWLkWelpMJjQvVgLT7aV6x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592614982; bh=BXGjOjMcgZpRHaQsgW2LvhG0MeB/4/wVTSW73xhiu0o=; h=Cc:Date:From:Reply-To:Subject:To; b=kG1lzSpkvQLPkimRYKKVlsPMc1wOYmbHAyfzDRVwr5PMrZkuM+bzk/55hztiDWMCqQW B8K0icUyh/9ARokNoVjOYyToMrm+ErJjUG17ijYbWbC4GZhNt9I4gw+9WJQCOnv4kVRr4 QG9hxteG0C9gE7fLrWrrqZbIZ0Vil4H0mPY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Prince Agyeman Cc: Isaac Oram Reviewed-by: Nate DeSimone --- edkrepo/common/common_repo_functions.py | 39 ++++++++++++++++--------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/edkrepo/common/common_repo_functions.py b/edkrepo/common/commo= n_repo_functions.py index 59c198f..313a1ca 100644 --- a/edkrepo/common/common_repo_functions.py +++ b/edkrepo/common/common_repo_functions.py @@ -558,21 +558,34 @@ def update_repo_commit_template(workspace_dir, repo, = repo_info, config, global_m manifest =3D edk_manifest.ManifestXml(os.path.join(workspace_dir, 'rep= o', 'Manifest.xml')) templates =3D manifest.commit_templates =20 + #Check for the presence of a gloablly defined commit template + global_template_in_use =3D False + global_gitconfig_path =3D os.path.normpath(os.path.expanduser("~/.gitc= onfig")) + with git.GitConfigParser(global_gitconfig_path, read_only=3DFalse) as = gitglobalconfig: + if gitglobalconfig.has_option(section=3D'commit', option=3D'templa= te'): + global_template =3D gitglobalconfig.get_value(section=3D'commi= t', option=3D'template') + global_template_in_use =3D True + print(COMMIT_TEMPLATE_CUSTOM_VALUE.format(repo_info.remote_nam= e)) + # Apply the template based on current manifest with repo.config_writer() as cw: - if cw.has_option(section=3D'commit', option=3D'template'): - current_template =3D cw.get_value(section=3D'commit', option= =3D'template').replace('"', '') - if not current_template.startswith(os.path.normpath(global_man= ifest_directory).replace('\\', '/')): - print(COMMIT_TEMPLATE_CUSTOM_VALUE.format(repo_info.remote= _name)) - return - - if repo_info.remote_name in templates: - template_path =3D os.path.normpath(os.path.join(global_manifes= t_directory, templates[repo_info.remote_name])) - if not os.path.isfile(template_path): - print(COMMIT_TEMPLATE_NOT_FOUND.format(template_path)) - return - template_path =3D template_path.replace('\\', '/') # Conver= t to git approved path - cw.set_value(section=3D'commit', option=3D'template', value=3D= '"{}"'.format(template_path)) + if not global_template_in_use: + if cw.has_option(section=3D'commit', option=3D'template'): + current_template =3D cw.get_value(section=3D'commit', opti= on=3D'template').replace('"', '') + if not current_template.startswith(os.path.normpath(global= _manifest_directory).replace('\\', '/')): + print(COMMIT_TEMPLATE_CUSTOM_VALUE.format(repo_info.re= mote_name)) + return + + if repo_info.remote_name in templates: + template_path =3D os.path.normpath(os.path.join(global_man= ifest_directory, templates[repo_info.remote_name])) + if not os.path.isfile(template_path): + print(COMMIT_TEMPLATE_NOT_FOUND.format(template_path)) + return + template_path =3D template_path.replace('\\', '/') # Co= nvert to git approved path + cw.set_value(section=3D'commit', option=3D'template', valu= e=3D'"{}"'.format(template_path)) + else: + if cw.has_option(section=3D'commit', option=3D'template'): + cw.remove_option(section=3D'commit', option=3D'templat= e') else: if cw.has_option(section=3D'commit', option=3D'template'): cw.remove_option(section=3D'commit', option=3D'template') --=20 2.26.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#61542): https://edk2.groups.io/g/devel/message/61542 Mute This Topic: https://groups.io/mt/74995052/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-