Manages project versioning (Git) and ROM artifact snapshots. More...
#include <version_manager.h>

Public Member Functions | |
| VersionManager (project::YazeProject *project) | |
| absl::Status | InitializeGit () |
| bool | AdoptExistingRepository () |
| absl::StatusOr< SnapshotResult > | CreateSnapshot (const std::string &message) |
| bool | IsGitInitialized () const |
| std::string | GetCurrentHash () const |
| std::vector< std::string > | GetHistory (int limit=10) const |
Private Member Functions | |
| std::filesystem::path | RepositoryRoot () const |
| absl::Status | GitInit () |
| absl::Status | GitAddAll () |
| absl::Status | GitCommit (const std::string &message) |
| std::string | GitRevParseHead () const |
| absl::Status | BackupRomArtifact (const std::string ×tamp_str) |
| absl::Status | RunCommand (const std::string &cmd) |
| absl::StatusOr< std::string > | RunCommandOutput (const std::string &cmd) const |
Private Attributes | |
| project::YazeProject * | project_ |
Manages project versioning (Git) and ROM artifact snapshots.
Handles the complexity of separating code (Git) from artifacts (ROMs), ensuring that every "Snapshot" captures both the state of the code and the resulting build artifact.
Definition at line 30 of file version_manager.h.
|
explicit |
Definition at line 20 of file version_manager.cc.
| absl::Status yaze::core::VersionManager::InitializeGit | ( | ) |
Definition at line 56 of file version_manager.cc.
References yaze::project::YazeProject::git_repository, GitInit(), IsGitInitialized(), and project_.
Referenced by CreateSnapshot(), and yaze::editor::ProjectManagementPanel::DrawVersionControl().

| bool yaze::core::VersionManager::AdoptExistingRepository | ( | ) |
Definition at line 43 of file version_manager.cc.
References yaze::project::YazeProject::git_repository, IsGitInitialized(), project_, and RepositoryRoot().
Referenced by yaze::editor::EditorManager::FinalizeNewProject(), and yaze::editor::EditorManager::LoadProjectWithRom().

| absl::StatusOr< SnapshotResult > yaze::core::VersionManager::CreateSnapshot | ( | const std::string & | message | ) |
Definition at line 71 of file version_manager.cc.
References BackupRomArtifact(), yaze::core::SnapshotResult::commit_hash, GitAddAll(), GitCommit(), GitRevParseHead(), InitializeGit(), IsGitInitialized(), yaze::project::YazeProject::last_build_hash, LOG_ERROR, LOG_INFO, yaze::core::SnapshotResult::message, project_, yaze::core::SnapshotResult::rom_backup_path, and yaze::core::SnapshotResult::success.
Referenced by yaze::editor::ProjectManagementPanel::DrawVersionControl().
| bool yaze::core::VersionManager::IsGitInitialized | ( | ) | const |
Definition at line 33 of file version_manager.cc.
References yaze::project::YazeProject::git_repository, project_, and RepositoryRoot().
Referenced by AdoptExistingRepository(), CreateSnapshot(), yaze::editor::ProjectManagementPanel::DrawSnapshotHistory(), yaze::editor::ProjectManagementPanel::DrawVersionControl(), and InitializeGit().

| std::string yaze::core::VersionManager::GetCurrentHash | ( | ) | const |
Definition at line 125 of file version_manager.cc.
References GitRevParseHead().
Referenced by yaze::editor::ProjectManagementPanel::DrawVersionControl().

| std::vector< std::string > yaze::core::VersionManager::GetHistory | ( | int | limit = 10 | ) | const |
Definition at line 129 of file version_manager.cc.
References RunCommandOutput().
Referenced by yaze::editor::ProjectManagementPanel::DrawSnapshotHistory().

|
private |
Definition at line 23 of file version_manager.cc.
References yaze::project::YazeProject::filepath, yaze::project::YazeProject::git_repository, and project_.
Referenced by AdoptExistingRepository(), and IsGitInitialized().
|
private |
Definition at line 151 of file version_manager.cc.
References RunCommand().
Referenced by InitializeGit().

|
private |
Definition at line 155 of file version_manager.cc.
References RunCommand().
Referenced by CreateSnapshot().

|
private |
Definition at line 161 of file version_manager.cc.
References RunCommand().
Referenced by CreateSnapshot().

|
private |
Definition at line 169 of file version_manager.cc.
References RunCommandOutput().
Referenced by CreateSnapshot(), and GetCurrentHash().

|
private |
Definition at line 184 of file version_manager.cc.
References yaze::project::YazeProject::build_target, yaze::project::YazeProject::filepath, yaze::project::YazeProject::output_folder, and project_.
Referenced by CreateSnapshot().
|
private |
Definition at line 227 of file version_manager.cc.
References yaze::project::YazeProject::filepath, and project_.
Referenced by GitAddAll(), GitCommit(), and GitInit().
|
private |
Definition at line 252 of file version_manager.cc.
References yaze::project::YazeProject::filepath, and project_.
Referenced by GetHistory(), and GitRevParseHead().
|
private |
Definition at line 66 of file version_manager.h.
Referenced by AdoptExistingRepository(), BackupRomArtifact(), CreateSnapshot(), InitializeGit(), IsGitInitialized(), RepositoryRoot(), RunCommand(), and RunCommandOutput().