KiCad PCB EDA Suite
Loading...
Searching...
No Matches
text_eval_vcs.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <kicommon.h>
23#include <wx/string.h>
24#include <string>
25#include <cstdint>
26
33namespace TEXT_EVAL_VCS
34{
42std::string GetCommitHash( const std::string& aPath = ".", int aLength = 40 );
43
51std::string GetNearestTag( const std::string& aMatch = "", bool aAnyTags = false );
52
60int GetDistanceFromTag( const std::string& aMatch = "", bool aAnyTags = false );
61
68bool IsDirty( bool aIncludeUntracked = false );
69
76std::string GetAuthor( const std::string& aPath = "." );
77
84std::string GetAuthorEmail( const std::string& aPath = "." );
85
92std::string GetCommitter( const std::string& aPath = "." );
93
100std::string GetCommitterEmail( const std::string& aPath = "." );
101
107std::string GetBranch();
108
115int64_t GetCommitTimestamp( const std::string& aPath = "." );
116
123std::string GetCommitDate( const std::string& aPath = "." );
124
141KICOMMON_API void SetContextPath( const wxString& aPath );
142
149
155{
156public:
157 explicit CONTEXT_PATH_SCOPE( const wxString& aPath );
159
162
163private:
164 wxString m_previous;
165};
166
167} // namespace TEXT_EVAL_VCS
wxString GetCommitHash()
Get the commit hash as a string.
CONTEXT_PATH_SCOPE(const CONTEXT_PATH_SCOPE &)=delete
CONTEXT_PATH_SCOPE(const wxString &aPath)
CONTEXT_PATH_SCOPE & operator=(const CONTEXT_PATH_SCOPE &)=delete
#define KICOMMON_API
Definition kicommon.h:27
VCS (Version Control System) utility functions for text evaluation.
std::string GetAuthor(const std::string &aPath)
Get the author name of the HEAD commit.
bool IsDirty(bool aIncludeUntracked)
Check if the repository has uncommitted changes.
wxString GetContextPath()
Return the current context path for repo-scoped VCS queries.
std::string GetCommitterEmail(const std::string &aPath)
Get the committer email of the HEAD commit.
std::string GetCommitDate(const std::string &aPath)
Get the commit date of the HEAD commit as a timestamp string.
std::string GetAuthorEmail(const std::string &aPath)
Get the author email of the HEAD commit.
void SetContextPath(const wxString &aPath)
Set the filesystem path used as the repository-discovery starting point for repo-scoped VCS queries (...
std::string GetCommitter(const std::string &aPath)
Get the committer name of the HEAD commit.
std::string GetBranch()
Get the current branch name.
std::string GetNearestTag(const std::string &aMatch, bool aAnyTags)
Get the nearest tag/label from HEAD.
int64_t GetCommitTimestamp(const std::string &aPath)
Get the commit timestamp (Unix time) of the HEAD commit.
int GetDistanceFromTag(const std::string &aMatch, bool aAnyTags)
Get the number of commits since the nearest matching tag.