diff --git a/mercurial/templater.py b/mercurial/templater.py
index 9261f6c1d39b789f873dbe0473ca8daf01a91716_bWVyY3VyaWFsL3RlbXBsYXRlci5weQ==..c000eff2c6353e1418007632b23f147caf47b8b8_bWVyY3VyaWFsL3RlbXBsYXRlci5weQ== 100644
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -451,7 +451,7 @@
 
 
 def _runrecursivesymbol(context, mapping, key):
-    raise error.Abort(_(b"recursive reference '%s' in template") % key)
+    raise error.InputError(_(b"recursive reference '%s' in template") % key)
 
 
 def buildtemplate(exp, context):
diff --git a/tests/test-template-basic.t b/tests/test-template-basic.t
index 9261f6c1d39b789f873dbe0473ca8daf01a91716_dGVzdHMvdGVzdC10ZW1wbGF0ZS1iYXNpYy50..c000eff2c6353e1418007632b23f147caf47b8b8_dGVzdHMvdGVzdC10ZW1wbGF0ZS1iYXNpYy50 100644
--- a/tests/test-template-basic.t
+++ b/tests/test-template-basic.t
@@ -265,7 +265,7 @@
   > EOF
   $ hg log --style ./issue4758
   abort: recursive reference 'changeset' in template
-  [255]
+  [10]
 
  not a recursion if a keyword of the same name exists: