10 Commits

Author SHA1 Message Date
Seth Hillbrand aab4219dec Fix VCS text eval tests for out-of-tree builds
VCS functions returned "<unknown>" when no repo was found, but
the tests guarded on IsEmpty(), so assertions ran against the
sentinel string and failed. This happened whenever the build
directory lived outside the source tree.

Move the "<unknown>" fallback from the VCS data layer up to the
parser's presentation layer. The VCS functions now return empty
strings on failure, and the parser applies the display fallback.

Rewrite the test fixture to create a temporary git repo with a
known commit, author, and email. Tests no longer depend on the
ambient git environment and produce deterministic results from
any build directory.
2026-02-24 09:24:32 -08:00
Jeff Young ae43e064b0 Formatting. 2026-02-14 20:20:36 +00:00
Matthias B. 5368791a62 Add VCS functions to text evaluation system
Expose version control system metadata through text evaluation expressions,
allowing text fields to reference VCS information dynamically.
This is useful for placing up to date version information on PCB
silkscreen or in other design text fields.

Added functions (vcs* prefix for VCS-agnostic naming):
- vcsidentifier([length]) - HEAD commit identifier (default: full hash)
- vcsfileidentifier(file, [length]) - last commit identifier that modified file
- vcsnearestlabel([match], [anyTags]) - nearest tag/label from HEAD
- vcslabeldistance([match], [anyTags]) - commits since nearest tag
- vcsdirty([includeUntracked]) - "1" if dirty, "0" if clean
- vcsdirtysuffix([suffix], [includeUntracked]) - suffix if dirty, empty if clean
- vcsbranch() - current branch name
- vcsauthor() - HEAD commit author name
- vcsauthoremail() - HEAD commit author email
- vcscommitter() - HEAD commit committer name
- vcscommitteremail() - HEAD commit committer email
- vcscommitdate([format]) - HEAD commit date
- vcsfileauthor(file) - author of last commit that modified file
- vcsfileauthoremail(file) - author email of last commit that modified file
- vcsfilecommitter(file) - committer of last commit that modified file
- vcsfilecommitteremail(file) - committer email of last commit that modified file
- vcsfilecommitdate(file, [format]) - date of last commit that modified file

Date format options: "ISO", "US", "EU", "Chinese", "Japanese", "Korean",
"long", "short".

Signed-off-by: Matthias Breithaupt <m.breithaupt@vogl-electronic.com>
2026-01-19 16:06:23 -08:00
Magnus Lundmark cdc1c417ff added table export, try to fix escaped expression uuid bug 2025-12-04 13:12:24 +00:00
Magnus Lundmark 26531bb25d Add text variable functions and recursive expansion for tables 2025-12-04 13:12:24 +00:00
jean-pierre charras ad26139c30 Add missing include to compile on msy2 2025-09-28 10:01:30 +02:00
Jeff Young e9a03346f4 Empty parameter safety. 2025-09-27 21:30:56 +01:00
Jeff Young 5876bc83bf ADDED before/after string functions.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15831
2025-09-27 21:23:16 +01:00
Seth Hillbrand 44cc5b8e93 Move to fmt 2025-09-04 14:57:16 -07:00
Seth Hillbrand a857ea77d9 ADDED: Text expression evaluation
Arbitrary text strings now support full evaluation with a rich
functional language

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6643
2025-09-04 14:57:16 -07:00