From patchwork Wed Jul 29 18:39:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D8847: templatespec: move check for non-unicode to lower-level function From: phabricator X-Patchwork-Id: 46936 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Wed, 29 Jul 2020 18:39:04 +0000 martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Now that we have the factory functions, it makes sense to have the check there. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8847 AFFECTED FILES mercurial/formatter.py mercurial/logcmdutil.py CHANGE DETAILS To: martinvonz, #hg-reviewers Cc: mercurial-patches, mercurial-devel diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -607,8 +607,6 @@ if mapfile: return formatter.mapfile_templatespec(b'changeset', mapfile) else: - if pycompat.ispy3: - assert not isinstance(tmpl, str), b'tmpl must not be a str' return formatter.literal_templatespec(tmpl) diff --git a/mercurial/formatter.py b/mercurial/formatter.py --- a/mercurial/formatter.py +++ b/mercurial/formatter.py @@ -551,6 +551,8 @@ def literal_templatespec(tmpl): + if pycompat.ispy3: + assert not isinstance(tmpl, str), b'tmpl must not be a str' return templatespec(b'', tmpl, None)