D5097: logcmdutil: add a helpful assertion to catch mistyped templates early

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Sun Oct 14 09:40:34 UTC 2018


durin42 created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This would have made a defect in test-notify.t much easier to figure out.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5097

AFFECTED FILES
  mercurial/logcmdutil.py

CHANGE DETAILS

diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -460,6 +460,8 @@
                 self.footer = self.t.render(self._parts['footer'], props)
 
 def templatespec(tmpl, mapfile):
+    if pycompat.ispy3:
+        assert not isinstance(tmpl, str), 'tmpl must not be a str'
     if mapfile:
         return formatter.templatespec('changeset', tmpl, mapfile)
     else:



To: durin42, #hg-reviewers
Cc: mjpieters, mercurial-devel


More information about the Mercurial-devel mailing list