Chaste Commit::29c3c4ab2bee00ddd311a035a1e522c03cbe928a
SourceRevision Class Reference

#include <SourceRevision.hpp>

+ Collaboration diagram for SourceRevision:

Public Member Functions

 SourceRevision (const std::string &rCommit="unknown", bool isModified=false)
 
const std::string & rGetCommit () const
 
std::string GetShortCommit () const
 
bool IsKnown () const
 
bool IsModified () const
 

Static Public Attributes

static constexpr std::size_t SHORT_COMMIT_LENGTH = 12u
 

Private Attributes

std::string mCommit
 
bool mIsModified
 

Detailed Description

The commit a source tree (Chaste itself, or a checked out project) was built from, and whether it had uncommitted changes at the time. See ChasteBuildInfo::GetChasteRevision() and ChasteBuildInfo::GetProjectRevisions().

Definition at line 47 of file SourceRevision.hpp.

Constructor & Destructor Documentation

◆ SourceRevision()

SourceRevision::SourceRevision ( const std::string &  rCommit = "unknown",
bool  isModified = false 
)

Constructor.

Parameters
rCommitthe full commit hash, or "unknown"
isModifiedwhether the source tree had uncommitted changes

Definition at line 38 of file SourceRevision.cpp.

Member Function Documentation

◆ GetShortCommit()

std::string SourceRevision::GetShortCommit ( ) const
Returns
the commit hash shortened for display to its first SHORT_COMMIT_LENGTH characters, or "unknown" if it could not be determined. This is a fixed length, rather than the shortest unambiguous one, so that a commit always displays the same way wherever it was built.

Definition at line 49 of file SourceRevision.cpp.

References IsKnown(), mCommit, and SHORT_COMMIT_LENGTH.

Referenced by ExecutableSupport::ShowCopyright(), and ExecutableSupport::WriteProvenanceInfoFile().

◆ IsKnown()

bool SourceRevision::IsKnown ( ) const
Returns
whether the commit is known.

Definition at line 54 of file SourceRevision.cpp.

References mCommit.

Referenced by GetShortCommit().

◆ IsModified()

bool SourceRevision::IsModified ( ) const
Returns
whether the source tree had uncommitted changes to tracked files. Always false for a build from an archive, such as a release tarball, since that cannot be known.

Definition at line 59 of file SourceRevision.cpp.

References mIsModified.

Referenced by ExecutableSupport::GetBuildInfo().

◆ rGetCommit()

const std::string & SourceRevision::rGetCommit ( ) const
Returns
the full commit hash, or "unknown" if it could not be determined.

Definition at line 44 of file SourceRevision.cpp.

References mCommit.

Referenced by ExecutableSupport::GetBuildInfo().

Member Data Documentation

◆ mCommit

std::string SourceRevision::mCommit
private

The full commit hash, or "unknown".

Definition at line 51 of file SourceRevision.hpp.

Referenced by GetShortCommit(), IsKnown(), and rGetCommit().

◆ mIsModified

bool SourceRevision::mIsModified
private

Whether the source tree had uncommitted changes to tracked files.

Definition at line 54 of file SourceRevision.hpp.

Referenced by IsModified().

◆ SHORT_COMMIT_LENGTH

constexpr std::size_t SourceRevision::SHORT_COMMIT_LENGTH = 12u
staticconstexpr

The number of characters GetShortCommit() keeps: unambiguous within Chaste's history.

Definition at line 58 of file SourceRevision.hpp.

Referenced by GetShortCommit().


The documentation for this class was generated from the following files: