Commit Graph

6 Commits

Author SHA1 Message Date
Mark Roszko 1d7e87f126 Undo removal of header that breaks MSVC build 2026-02-27 20:58:03 -05:00
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 80ab928e34 Better error reporting from TEXT_EVAL_VCS.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23069
2026-02-14 20:27:27 +00:00
Jeff Young ae43e064b0 Formatting. 2026-02-14 20:20:36 +00:00
Mark Roszko b04c16d7e8 Add missing include due to std::vector<wxString> template expansion export 2026-01-21 07:57:01 -05: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