KiCad PCB EDA Suite
Loading...
Searching...
No Matches
TEXT_EVAL_VCS Namespace Reference

VCS (Version Control System) utility functions for text evaluation. More...

Functions

std::string GetCommitHash (const std::string &aPath=".", int aLength=40)
 Get the current HEAD commit identifier (hash).
 
std::string GetNearestTag (const std::string &aMatch="", bool aAnyTags=false)
 Get the nearest tag/label from HEAD.
 
int GetDistanceFromTag (const std::string &aMatch="", bool aAnyTags=false)
 Get the number of commits since the nearest matching tag.
 
bool IsDirty (bool aIncludeUntracked=false)
 Check if the repository has uncommitted changes.
 
std::string GetAuthor (const std::string &aPath=".")
 Get the author name of the HEAD commit.
 
std::string GetAuthorEmail (const std::string &aPath=".")
 Get the author email of the HEAD commit.
 
std::string GetCommitter (const std::string &aPath=".")
 Get the committer name of the HEAD commit.
 
std::string GetCommitterEmail (const std::string &aPath=".")
 Get the committer email of the HEAD commit.
 
std::string GetBranch ()
 Get the current branch name.
 
int64_t GetCommitTimestamp (const std::string &aPath=".")
 Get the commit timestamp (Unix time) of the HEAD commit.
 
std::string GetCommitDate (const std::string &aPath=".")
 Get the commit date of the HEAD commit as a timestamp string.
 

Detailed Description

VCS (Version Control System) utility functions for text evaluation.

These functions provide generic VCS operations that are currently implemented for Git repositories, but can be extended to support other VCS systems in the future.

Function Documentation

◆ GetAuthor()

std::string TEXT_EVAL_VCS::GetAuthor ( const std::string & aPath = ".")

Get the author name of the HEAD commit.

Parameters
aPathOptional file path for file-specific queries.
Returns
Author name, or empty string if not available.

Definition at line 323 of file text_eval_vcs.cpp.

Referenced by calc_parser::EVAL_VISITOR::evaluateFunction().

◆ GetAuthorEmail()

std::string TEXT_EVAL_VCS::GetAuthorEmail ( const std::string & aPath = ".")

Get the author email of the HEAD commit.

Parameters
aPathOptional file path for file-specific queries.
Returns
Author email, or empty string if not available.

Definition at line 328 of file text_eval_vcs.cpp.

Referenced by calc_parser::EVAL_VISITOR::evaluateFunction().

◆ GetBranch()

std::string TEXT_EVAL_VCS::GetBranch ( )

Get the current branch name.

Returns
Branch name (e.g., "main", "develop"), or empty string if detached or not in VCS.

Definition at line 343 of file text_eval_vcs.cpp.

References KIGIT_COMMON::GetCurrentBranchName().

Referenced by calc_parser::EVAL_VISITOR::evaluateFunction().

◆ GetCommitDate()

std::string TEXT_EVAL_VCS::GetCommitDate ( const std::string & aPath = ".")

Get the commit date of the HEAD commit as a timestamp string.

Parameters
aPathOptional file path for file-specific queries.
Returns
Timestamp as string (to be formatted by caller), or empty string if not available.

Definition at line 383 of file text_eval_vcs.cpp.

References GetCommitTimestamp().

◆ GetCommitHash()

std::string TEXT_EVAL_VCS::GetCommitHash ( const std::string & aPath = ".",
int aLength = 40 )

Get the current HEAD commit identifier (hash).

Parameters
aPathOptional file path for file-specific queries. Defaults to "." for repo HEAD.
aLengthOptional hash length (4-40). Defaults to 40 for full SHA-1.
Returns
Commit hash as hex string, or empty string if not in a VCS repository.

Definition at line 266 of file text_eval_vcs.cpp.

Referenced by calc_parser::EVAL_VISITOR::evaluateFunction().

◆ GetCommitter()

std::string TEXT_EVAL_VCS::GetCommitter ( const std::string & aPath = ".")

Get the committer name of the HEAD commit.

Parameters
aPathOptional file path for file-specific queries.
Returns
Committer name, or empty string if not available.

Definition at line 333 of file text_eval_vcs.cpp.

Referenced by calc_parser::EVAL_VISITOR::evaluateFunction().

◆ GetCommitterEmail()

std::string TEXT_EVAL_VCS::GetCommitterEmail ( const std::string & aPath = ".")

Get the committer email of the HEAD commit.

Parameters
aPathOptional file path for file-specific queries.
Returns
Committer email, or empty string if not available.

Definition at line 338 of file text_eval_vcs.cpp.

Referenced by calc_parser::EVAL_VISITOR::evaluateFunction().

◆ GetCommitTimestamp()

int64_t TEXT_EVAL_VCS::GetCommitTimestamp ( const std::string & aPath = ".")

Get the commit timestamp (Unix time) of the HEAD commit.

Parameters
aPathOptional file path for file-specific queries.
Returns
Unix timestamp in seconds, or 0 if not available.

Definition at line 356 of file text_eval_vcs.cpp.

Referenced by calc_parser::EVAL_VISITOR::evaluateFunction(), and GetCommitDate().

◆ GetDistanceFromTag()

int TEXT_EVAL_VCS::GetDistanceFromTag ( const std::string & aMatch = "",
bool aAnyTags = false )

Get the number of commits since the nearest matching tag.

Parameters
aMatchOptional glob pattern to filter tags.
aAnyTagsIf true, includes lightweight tags. If false, annotated tags only.
Returns
Distance in commits, or 0 if no tag found or at a tag.

Definition at line 293 of file text_eval_vcs.cpp.

Referenced by calc_parser::EVAL_VISITOR::evaluateFunction().

◆ GetNearestTag()

std::string TEXT_EVAL_VCS::GetNearestTag ( const std::string & aMatch = "",
bool aAnyTags = false )

Get the nearest tag/label from HEAD.

Parameters
aMatchOptional glob pattern to filter tags. Defaults to "*" for all tags.
aAnyTagsIf true, includes lightweight tags. If false, annotated tags only.
Returns
Tag name, or empty string if no matching tag found.

Definition at line 288 of file text_eval_vcs.cpp.

Referenced by calc_parser::EVAL_VISITOR::evaluateFunction().

◆ IsDirty()

bool TEXT_EVAL_VCS::IsDirty ( bool aIncludeUntracked = false)

Check if the repository has uncommitted changes.

Parameters
aIncludeUntrackedIf true, untracked files count as dirty. If false, only staged/modified.
Returns
true if repository is dirty, false if clean or not in a VCS repository.

Definition at line 298 of file text_eval_vcs.cpp.

Referenced by calc_parser::EVAL_VISITOR::evaluateFunction().