comparison mercurial/templater.py @ 47836:f3b1df44b716 stable

template: handle missing resource in `_readmapfile` This fix the remaining issue in test-template-map.t. Differential Revision: https://phab.mercurial-scm.org/D11288
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 18 Aug 2021 01:41:02 +0200
parents 981cef5188c3
children 2b76255a4f74
comparison
equal deleted inserted replaced
47835:da39b9c1c486 47836:f3b1df44b716
850 if os.path.isfile(abs): 850 if os.path.isfile(abs):
851 subresource = util.posixfile(abs, b'rb') 851 subresource = util.posixfile(abs, b'rb')
852 if not subresource: 852 if not subresource:
853 if pycompat.ossep not in rel: 853 if pycompat.ossep not in rel:
854 abs = rel 854 abs = rel
855 subresource = resourceutil.open_resource( 855 try:
856 b'mercurial.templates', rel 856 subresource = resourceutil.open_resource(
857 ) 857 b'mercurial.templates', rel
858 )
859 except resourceutil.FileNotFoundError:
860 subresource = None
858 else: 861 else:
859 dir = templatedir() 862 dir = templatedir()
860 if dir: 863 if dir:
861 abs = os.path.normpath(os.path.join(dir, rel)) 864 abs = os.path.normpath(os.path.join(dir, rel))
862 if os.path.isfile(abs): 865 if os.path.isfile(abs):