yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
version_manager.h
Go to the documentation of this file.
1#ifndef YAZE_CORE_VERSION_MANAGER_H_
2#define YAZE_CORE_VERSION_MANAGER_H_
3
4#include <filesystem>
5#include <string>
6#include <vector>
7
8#include "absl/status/status.h"
9#include "absl/status/statusor.h"
10#include "core/project.h"
11
12namespace yaze {
13namespace core {
14
16 bool success;
17 std::string commit_hash;
18 std::string rom_backup_path;
19 std::string message;
20};
21
31 public:
32 explicit VersionManager(project::YazeProject* project);
33
34 // Core Actions
35 // Creates a repository in the project directory (runs `git init`). Only
36 // call from an explicit user action; opening a project must not create one.
37 absl::Status InitializeGit();
38 // Records the project directory as the repository when it already contains
39 // a .git entry. Never runs git. Returns IsGitInitialized().
41 absl::StatusOr<SnapshotResult> CreateSnapshot(const std::string& message);
42
43 // Queries
44 bool IsGitInitialized() const;
45 std::string GetCurrentHash() const;
46 std::vector<std::string> GetHistory(int limit = 10) const;
47
48 private:
49 // Directory that git_repository names, resolved against the project file's
50 // directory when relative (empty means the project directory).
51 std::filesystem::path RepositoryRoot() const;
52
53 // Git Helpers
54 absl::Status GitInit();
55 absl::Status GitAddAll();
56 absl::Status GitCommit(const std::string& message);
57 std::string GitRevParseHead() const;
58
59 // ROM Helpers
60 absl::Status BackupRomArtifact(const std::string& timestamp_str);
61
62 // System Helpers
63 absl::Status RunCommand(const std::string& cmd);
64 absl::StatusOr<std::string> RunCommandOutput(const std::string& cmd) const;
65
67};
68
69} // namespace core
70} // namespace yaze
71
72#endif // YAZE_CORE_VERSION_MANAGER_H_
Manages project versioning (Git) and ROM artifact snapshots.
absl::Status BackupRomArtifact(const std::string &timestamp_str)
absl::Status GitCommit(const std::string &message)
std::vector< std::string > GetHistory(int limit=10) const
project::YazeProject * project_
VersionManager(project::YazeProject *project)
absl::StatusOr< std::string > RunCommandOutput(const std::string &cmd) const
std::string GetCurrentHash() const
absl::StatusOr< SnapshotResult > CreateSnapshot(const std::string &message)
absl::Status RunCommand(const std::string &cmd)
std::string GitRevParseHead() const
std::filesystem::path RepositoryRoot() const
Modern project structure with comprehensive settings consolidation.
Definition project.h:287