Envision
A visual programming IDE for object-oriented languages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends
FilePersistence::GitRepository Class Reference

Public Types

enum class  GitReferenceType { INVALID , NOTFOUND , BRANCH , NOTE , REMOTE , TAG }
 
enum class  HEADState { UNBORN , ATTACHED , DETACHED }
 
enum class  RevisionStringState { INVALID , NOTFOUND , AMBIGUOUS , VALID }
 

Public Member Functions

 GitRepository (QString path)
 
 ~GitRepository ()
 
void checkout (QString revision, bool force)
 
CommitGraph commitGraph (QString startRevision, QString endRevision) const
 
QString currentBranchName () const
 
Diff diff (QString revisionA, QString revisionB, std::shared_ptr< GenericTree > treeA=nullptr, std::shared_ptr< GenericTree > treeB=nullptr) const
 
const CommitgetCommit (QString revision) const
 
const CommitFilegetCommitFile (QString revision, QString relativePath) const
 
CommitMetaData getCommitInformation (QString revision) const
 
HEADState getHEADState () const
 
QString getSHA1 (QString revision) const
 
bool isValidRevisionString (QString revision) const
 
void loadGenericTree (const std::shared_ptr< GenericTree > &tree, const QString version)
 
QStringList localBranches () const
 
std::shared_ptr< Mergemerge (QString revision, bool fastForward=true)
 
GitReferenceType referenceType (QString reference) const
 
QString relativePathForPersistentUnit (QString persistentUnitId, QString revision) const
 
QStringList revisions () const
 
QStringList tags () const
 
QString workdirPath () const
 

Static Public Member Functions

static int getMinPrefixLength ()
 
static bool repositoryExists (QString path)
 

Static Public Attributes

static const QString INDEX = "GitRepositoryIndex"
 
static const QString WORKDIR = "GitRepositoryWorkdir"
 

Private Types

enum class  SourceKind { Unspecified , Commit , Index , Workdir }
 

Private Member Functions

git_signature * createGitSignature (Signature &signature)
 
QString currentBranch () const
 
QString findMergeBase (QString branchA, QString branchB) const
 
void findPersistentUnitDeclarations (GenericNode *node, IdToGenericNodeHash &declarations)
 
const CommitFilegetCommitFileFromIndex (QString relativePath) const
 
const CommitFilegetCommitFileFromTree (QString revision, QString relativePath) const
 
const CommitFilegetCommitFileFromWorkdir (QString relativePath) const
 
git_tree * getCommitTree (QString revision) const
 This is a wrapper around git_commit_tree(). More...
 
bool hasCleanIndex () const
 
bool hasCleanWorkdir () const
 
void newCommit (QString tree, QString message, Signature author, Signature committer, QStringList parents)
 
QString oidToQString (const git_oid *oid) const
 
git_commit * parseCommit (QString revision) const
 
QString projectName () const
 
bool setReferenceTarget (QString reference, QString target)
 
void TraverseCommitGraph (CommitGraph *graph, git_commit *current, const git_oid *target) const
 
QString writeIndexToTree ()
 
void writeRevisionIntoIndex (QString revision)
 
void writeWorkdirToIndex ()
 

Static Private Member Functions

static void checkError (int errorCode)
 errorCode is the last error code returned from libgit2. More...
 
static QPair< SourceKind, SourceKindkind (QString revisionA, QString revisionB)
 
static SourceKind sourceKind (QString revision)
 

Private Attributes

std::weak_ptr< Mergemerge_
 
QString path_
 
git_repository * repository_ {}
 

Static Private Attributes

static const char * HEAD = "HEAD"
 
static const QString PATH_HEADS {QString{QDir::separator()} + "refs" + QDir::separator() + "heads"}
 
static const QString PATH_NOTES {QString{QDir::separator()} + "refs" + QDir::separator() + "notes"}
 
static const QString PATH_REMOTES {QString{QDir::separator()} + "refs" + QDir::separator() + "remotes"}
 
static const QString PATH_TAGS {QString{QDir::separator()} + "refs" + QDir::separator() + "tags"}
 

Friends

class Merge
 

Member Enumeration Documentation

◆ GitReferenceType

Enumerator
INVALID 
NOTFOUND 
BRANCH 
NOTE 
REMOTE 
TAG 

◆ HEADState

Enumerator
UNBORN 
ATTACHED 
DETACHED 

◆ RevisionStringState

Enumerator
INVALID 
NOTFOUND 
AMBIGUOUS 
VALID 

◆ SourceKind

Enumerator
Unspecified 
Commit 
Index 
Workdir 

Constructor & Destructor Documentation

◆ GitRepository()

FilePersistence::GitRepository::GitRepository ( QString  path)

◆ ~GitRepository()

FilePersistence::GitRepository::~GitRepository ( )

Member Function Documentation

◆ checkError()

void FilePersistence::GitRepository::checkError ( int  errorCode)
staticprivate

errorCode is the last error code returned from libgit2.

Throws an exception with a descriptive error description if errorCode indicates that an error occurred.

◆ checkout()

void FilePersistence::GitRepository::checkout ( QString  revision,
bool  force 
)

◆ commitGraph()

CommitGraph FilePersistence::GitRepository::commitGraph ( QString  startRevision,
QString  endRevision 
) const

◆ createGitSignature()

git_signature * FilePersistence::GitRepository::createGitSignature ( Signature signature)
private

◆ currentBranch()

QString FilePersistence::GitRepository::currentBranch ( ) const
private

◆ currentBranchName()

QString FilePersistence::GitRepository::currentBranchName ( ) const

◆ diff()

Diff FilePersistence::GitRepository::diff ( QString  revisionA,
QString  revisionB,
std::shared_ptr< GenericTree treeA = nullptr,
std::shared_ptr< GenericTree treeB = nullptr 
) const

◆ findMergeBase()

QString FilePersistence::GitRepository::findMergeBase ( QString  branchA,
QString  branchB 
) const
private

◆ findPersistentUnitDeclarations()

void FilePersistence::GitRepository::findPersistentUnitDeclarations ( GenericNode node,
IdToGenericNodeHash declarations 
)
private

◆ getCommit()

const Commit * FilePersistence::GitRepository::getCommit ( QString  revision) const

◆ getCommitFile()

const CommitFile * FilePersistence::GitRepository::getCommitFile ( QString  revision,
QString  relativePath 
) const

◆ getCommitFileFromIndex()

const CommitFile * FilePersistence::GitRepository::getCommitFileFromIndex ( QString  relativePath) const
private

◆ getCommitFileFromTree()

const CommitFile * FilePersistence::GitRepository::getCommitFileFromTree ( QString  revision,
QString  relativePath 
) const
private

◆ getCommitFileFromWorkdir()

const CommitFile * FilePersistence::GitRepository::getCommitFileFromWorkdir ( QString  relativePath) const
private

◆ getCommitInformation()

CommitMetaData FilePersistence::GitRepository::getCommitInformation ( QString  revision) const

◆ getCommitTree()

git_tree * FilePersistence::GitRepository::getCommitTree ( QString  revision) const
private

This is a wrapper around git_commit_tree().

Returns the git_tree at revision.

◆ getHEADState()

GitRepository::HEADState FilePersistence::GitRepository::getHEADState ( ) const

◆ getMinPrefixLength()

int FilePersistence::GitRepository::getMinPrefixLength ( )
static

◆ getSHA1()

QString FilePersistence::GitRepository::getSHA1 ( QString  revision) const

◆ hasCleanIndex()

bool FilePersistence::GitRepository::hasCleanIndex ( ) const
private

◆ hasCleanWorkdir()

bool FilePersistence::GitRepository::hasCleanWorkdir ( ) const
private

◆ isValidRevisionString()

bool FilePersistence::GitRepository::isValidRevisionString ( QString  revision) const

◆ kind()

QPair< GitRepository::SourceKind, GitRepository::SourceKind > FilePersistence::GitRepository::kind ( QString  revisionA,
QString  revisionB 
)
staticprivate

◆ loadGenericTree()

void FilePersistence::GitRepository::loadGenericTree ( const std::shared_ptr< GenericTree > &  tree,
const QString  version 
)

◆ localBranches()

QStringList FilePersistence::GitRepository::localBranches ( ) const

◆ merge()

std::shared_ptr< Merge > FilePersistence::GitRepository::merge ( QString  revision,
bool  fastForward = true 
)

◆ newCommit()

void FilePersistence::GitRepository::newCommit ( QString  tree,
QString  message,
Signature  author,
Signature  committer,
QStringList  parents 
)
private

◆ oidToQString()

QString FilePersistence::GitRepository::oidToQString ( const git_oid *  oid) const
private

◆ parseCommit()

git_commit * FilePersistence::GitRepository::parseCommit ( QString  revision) const
private

◆ projectName()

QString FilePersistence::GitRepository::projectName ( ) const
inlineprivate

◆ referenceType()

GitRepository::GitReferenceType FilePersistence::GitRepository::referenceType ( QString  reference) const

◆ relativePathForPersistentUnit()

QString FilePersistence::GitRepository::relativePathForPersistentUnit ( QString  persistentUnitId,
QString  revision 
) const

◆ repositoryExists()

bool FilePersistence::GitRepository::repositoryExists ( QString  path)
static

◆ revisions()

QStringList FilePersistence::GitRepository::revisions ( ) const

◆ setReferenceTarget()

bool FilePersistence::GitRepository::setReferenceTarget ( QString  reference,
QString  target 
)
private

◆ sourceKind()

GitRepository::SourceKind FilePersistence::GitRepository::sourceKind ( QString  revision)
staticprivate

◆ tags()

QStringList FilePersistence::GitRepository::tags ( ) const

◆ TraverseCommitGraph()

void FilePersistence::GitRepository::TraverseCommitGraph ( CommitGraph graph,
git_commit *  current,
const git_oid *  target 
) const
private

◆ workdirPath()

QString FilePersistence::GitRepository::workdirPath ( ) const
inline

◆ writeIndexToTree()

QString FilePersistence::GitRepository::writeIndexToTree ( )
private

◆ writeRevisionIntoIndex()

void FilePersistence::GitRepository::writeRevisionIntoIndex ( QString  revision)
private

◆ writeWorkdirToIndex()

void FilePersistence::GitRepository::writeWorkdirToIndex ( )
private

Friends And Related Function Documentation

◆ Merge

friend class Merge
friend

Member Data Documentation

◆ HEAD

const char * FilePersistence::GitRepository::HEAD = "HEAD"
staticprivate

◆ INDEX

const QString FilePersistence::GitRepository::INDEX = "GitRepositoryIndex"
static

◆ merge_

std::weak_ptr<Merge> FilePersistence::GitRepository::merge_
private

◆ path_

QString FilePersistence::GitRepository::path_
private

◆ PATH_HEADS

const QString FilePersistence::GitRepository::PATH_HEADS {QString{QDir::separator()} + "refs" + QDir::separator() + "heads"}
staticprivate

◆ PATH_NOTES

const QString FilePersistence::GitRepository::PATH_NOTES {QString{QDir::separator()} + "refs" + QDir::separator() + "notes"}
staticprivate

◆ PATH_REMOTES

const QString FilePersistence::GitRepository::PATH_REMOTES {QString{QDir::separator()} + "refs" + QDir::separator() + "remotes"}
staticprivate

◆ PATH_TAGS

const QString FilePersistence::GitRepository::PATH_TAGS {QString{QDir::separator()} + "refs" + QDir::separator() + "tags"}
staticprivate

◆ repository_

git_repository* FilePersistence::GitRepository::repository_ {}
private

◆ WORKDIR

const QString FilePersistence::GitRepository::WORKDIR = "GitRepositoryWorkdir"
static