From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: ashley.e.desimone@intel.com) 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 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" 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-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> X-Mailer: git-send-email 2.26.2.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Prince Agyeman Cc: Isaac Oram --- 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'))=0D templates =3D manifest.commit_templates=0D =0D + #Check for the presence of a gloablly defined commit template=0D + global_template_in_use =3D False=0D + global_gitconfig_path =3D os.path.normpath(os.path.expanduser("~/.gitc= onfig"))=0D + with git.GitConfigParser(global_gitconfig_path, read_only=3DFalse) as = gitglobalconfig:=0D + if gitglobalconfig.has_option(section=3D'commit', option=3D'templa= te'):=0D + global_template =3D gitglobalconfig.get_value(section=3D'commi= t', option=3D'template')=0D + global_template_in_use =3D True=0D + print(COMMIT_TEMPLATE_CUSTOM_VALUE.format(repo_info.remote_nam= e))=0D +=0D # Apply the template based on current manifest=0D with repo.config_writer() as cw:=0D - if cw.has_option(section=3D'commit', option=3D'template'):=0D - current_template =3D cw.get_value(section=3D'commit', option= =3D'template').replace('"', '')=0D - if not current_template.startswith(os.path.normpath(global_man= ifest_directory).replace('\\', '/')):=0D - print(COMMIT_TEMPLATE_CUSTOM_VALUE.format(repo_info.remote= _name))=0D - return=0D -=0D - if repo_info.remote_name in templates:=0D - template_path =3D os.path.normpath(os.path.join(global_manifes= t_directory, templates[repo_info.remote_name]))=0D - if not os.path.isfile(template_path):=0D - print(COMMIT_TEMPLATE_NOT_FOUND.format(template_path))=0D - return=0D - template_path =3D template_path.replace('\\', '/') # Conver= t to git approved path=0D - cw.set_value(section=3D'commit', option=3D'template', value=3D= '"{}"'.format(template_path))=0D + if not global_template_in_use:=0D + if cw.has_option(section=3D'commit', option=3D'template'):=0D + current_template =3D cw.get_value(section=3D'commit', opti= on=3D'template').replace('"', '')=0D + if not current_template.startswith(os.path.normpath(global= _manifest_directory).replace('\\', '/')):=0D + print(COMMIT_TEMPLATE_CUSTOM_VALUE.format(repo_info.re= mote_name))=0D + return=0D +=0D + if repo_info.remote_name in templates:=0D + template_path =3D os.path.normpath(os.path.join(global_man= ifest_directory, templates[repo_info.remote_name]))=0D + if not os.path.isfile(template_path):=0D + print(COMMIT_TEMPLATE_NOT_FOUND.format(template_path))= =0D + return=0D + template_path =3D template_path.replace('\\', '/') # Co= nvert to git approved path=0D + cw.set_value(section=3D'commit', option=3D'template', valu= e=3D'"{}"'.format(template_path))=0D + else:=0D + if cw.has_option(section=3D'commit', option=3D'template'):= =0D + cw.remove_option(section=3D'commit', option=3D'templat= e')=0D else:=0D if cw.has_option(section=3D'commit', option=3D'template'):=0D cw.remove_option(section=3D'commit', option=3D'template')= =0D --=20 2.26.2.windows.1