A tree sitter grammar for mercurial commit descriptions, adaopted from github:kareigu/tree-sitter-jjdescription

[claude] grammar: retarget the grammar at mercurial descriptions #21

Open tinger.dev
targeting main from tinger/tuvpxoorussu
Open opened by and assigned to tinger.dev
targeting main from tinger/tuvpxoorussu

Mercurial prefixes every line of its editor template with HG: and spells the change types out as added, changed and removed rather than using jj's single letter codes, so none of the old token set carried over.

A change type can no longer be told apart from free form comment text by a single character of lookahead, so the types are given a higher lexical precedence than the comment text token instead, and the comment text token is kept from starting on whitespace so that the separator after HG: stays unambiguous.

Scissors come back as mercurial's HG: ------ >8 ------ marker, which mercurial/cmdutil.py strips along with everything below it, and which the committemplate recipe in hg help config uses to show the diff of the change. The HG: lines mercurial puts between the marker and the diff stay comments so that only the diff itself is injected.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

Commits 1

[claude] grammar: retarget the grammar at mercurial descriptions