diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6c2d59a3..904799d2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -12,7 +12,7 @@ jobs: submodules: true - name: Cache vendor/ - uses: actions/cache@v1 + uses: actions/cache@v3 with: path: vendor/ key: ${{ runner.OS }}-p4-fusion-vendor-cache-${{ github.ref }} diff --git a/.gitignore b/.gitignore index 9c199428..49585c43 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ clones/ # Testing failures core +.cache/ diff --git a/p4-fusion/commands/result.h b/p4-fusion/commands/result.h index 69cab17b..1a9d8a68 100644 --- a/p4-fusion/commands/result.h +++ b/p4-fusion/commands/result.h @@ -13,15 +13,15 @@ class Result : public ClientUser Error m_Error; public: - Result() = default; + Result() = default; void HandleError(Error* e) override; const Error& GetError() const { return m_Error; } - Result(const Result&) = delete; - Result& operator=(const Result&) = delete; + Result(const Result&) = delete; + Result& operator=(const Result&) = delete; - Result(Result&&) = delete; - Result& operator=(Result&&) = delete; + Result(Result&&) = delete; + Result& operator=(Result&&) = delete; }; diff --git a/p4-fusion/git_api.cc b/p4-fusion/git_api.cc index 000e44d5..84b45c76 100644 --- a/p4-fusion/git_api.cc +++ b/p4-fusion/git_api.cc @@ -32,17 +32,17 @@ GitAPI::GitAPI(bool fsyncEnable) GIT2(git_libgit2_opts(GIT_OPT_ENABLE_FSYNC_GITDIR, (int)fsyncEnable)); - // Since we trust the hard-drive and operating system, we can skip the verification. - GIT2(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, (int)0)); + // Since we trust the hard-drive and operating system, we can skip the verification. + GIT2(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, (int)0)); - // Global RAM cache: 1gb... - GIT2(git_libgit2_opts(GIT_OPT_SET_CACHE_MAX_SIZE, (ssize_t)(1024 * 1024 * 1024))); + // Global RAM cache: 1gb... + GIT2(git_libgit2_opts(GIT_OPT_SET_CACHE_MAX_SIZE, (ssize_t)(1024 * 1024 * 1024))); - // 20Mb for the file name tree cache... - GIT2(git_libgit2_opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, GIT_OBJECT_TREE, (size_t)(20 * 1024 * 1024))); - - // 20Mb for commit info cache... - GIT2(git_libgit2_opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, GIT_OBJECT_COMMIT, (size_t)(20 * 1024 * 1024))); + // 20Mb for the file name tree cache... + GIT2(git_libgit2_opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, GIT_OBJECT_TREE, (size_t)(20 * 1024 * 1024))); + + // 20Mb for commit info cache... + GIT2(git_libgit2_opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, GIT_OBJECT_COMMIT, (size_t)(20 * 1024 * 1024))); } GitAPI::~GitAPI() diff --git a/p4-fusion/main.cc b/p4-fusion/main.cc index 2e35d405..ee95e3f3 100644 --- a/p4-fusion/main.cc +++ b/p4-fusion/main.cc @@ -313,19 +313,18 @@ int Main(int argc, char** argv) ThreadPool::GetSingleton()->Initialize(networkThreads); SUCCESS("Created " << ThreadPool::GetSingleton()->GetThreadCount() << " threads in thread pool"); - // Go in the chronological order size_t lastDownloadedCL = 0; for (size_t currentCL = 0; currentCL < changes.size() && currentCL < lookAhead; currentCL++) { ChangeList& cl = changes.at(currentCL); - + // Start gathering changed files with `p4 describe` or `p4 filelog` cl.PrepareDownload(branchSet); - + lastDownloadedCL = currentCL; } - + // This is intentionally put in a separate loop. // We want to submit `p4 describe` commands before sending any of the `p4 print` commands. // Gives ~15% perf boost. diff --git a/p4-fusion/p4_api.cc b/p4-fusion/p4_api.cc index 7a7fa0df..356c62b7 100644 --- a/p4-fusion/p4_api.cc +++ b/p4-fusion/p4_api.cc @@ -185,10 +185,10 @@ std::unique_ptr P4API::TestConnection(const int retries) std::unique_ptr P4API::ShortChanges(const std::string& path) { std::unique_ptr changes = Run("changes", { - "-r", // Get CLs from earliest to latest - "-s", "submitted", // Only include submitted CLs - path // Depot path to get CLs from - }); + "-r", // Get CLs from earliest to latest + "-s", "submitted", // Only include submitted CLs + path // Depot path to get CLs from + }); return changes; } @@ -196,10 +196,10 @@ std::unique_ptr P4API::Changes(const std::string& path) { MTR_SCOPE("P4", __func__); return Run("changes", { - "-l", // Get full descriptions instead of sending cut-short ones - "-s", "submitted", // Only include submitted CLs - path // Depot path to get CLs from - }); + "-l", // Get full descriptions instead of sending cut-short ones + "-s", "submitted", // Only include submitted CLs + path // Depot path to get CLs from + }); } std::unique_ptr P4API::Changes(const std::string& path, const std::string& from, int32_t maxCount) @@ -241,29 +241,29 @@ std::unique_ptr P4API::ChangesFromTo(const std::string& path, con { std::string pathArg = path + "@" + from + "," + to; return Run("changes", { - "-s", "submitted", // Only include submitted CLs - pathArg // Depot path to get CLs from - }); + "-s", "submitted", // Only include submitted CLs + pathArg // Depot path to get CLs from + }); } std::unique_ptr P4API::LatestChange(const std::string& path) { MTR_SCOPE("P4", __func__); return Run("changes", { - "-s", "submitted", // Only include submitted CLs, - "-m", "1", // Get top-most change - path // Depot path to get CLs from - }); + "-s", "submitted", // Only include submitted CLs, + "-m", "1", // Get top-most change + path // Depot path to get CLs from + }); } std::unique_ptr P4API::OldestChange(const std::string& path) { std::unique_ptr changes = Run("changes", { - "-r", // List from earliest to latest - "-s", "submitted", // Only include submitted CLs, - "-m", "1", // Get top-most change - path // Depot path to get CLs from - }); + "-r", // List from earliest to latest + "-s", "submitted", // Only include submitted CLs, + "-m", "1", // Get top-most change + path // Depot path to get CLs from + }); return changes; } @@ -271,17 +271,17 @@ std::unique_ptr P4API::Describe(const std::string& cl) { MTR_SCOPE("P4", __func__); return Run("describe", { "-s", // Omit the diffs - cl }); + cl }); } std::unique_ptr P4API::FileLog(const std::string& changelist) { return Run("filelog", { - "-c", // restrict output to a single changelist - changelist, - "-m1", // don't get the full history, just the first entry. - "//..." // rather than require the path to be passed in, just list all files. - }); + "-c", // restrict output to a single changelist + changelist, + "-m1", // don't get the full history, just the first entry. + "//..." // rather than require the path to be passed in, just list all files. + }); } std::unique_ptr P4API::Size(const std::string& file) @@ -298,16 +298,16 @@ std::unique_ptr P4API::GetFilesToSyncAtCL(const std::string& path, c { std::string clCommand = "@" + cl; return Run("sync", { - "-n", // Only preview the files to sync. Don't send file contents...yet - clCommand, - }); + "-n", // Only preview the files to sync. Don't send file contents...yet + clCommand, + }); } std::unique_ptr P4API::PrintFile(const std::string& filePathRevision) { return Run("print", { - filePathRevision, - }); + filePathRevision, + }); } std::unique_ptr P4API::PrintFiles(const std::vector& fileRevisions) @@ -325,15 +325,15 @@ std::unique_ptr P4API::PrintFiles(const std::vector& f std::unique_ptr P4API::Sync(const std::string& path) { return Run("sync", { - path // Sync a particular depot path - }); + path // Sync a particular depot path + }); } std::unique_ptr P4API::Users() { return Run("users", { - "-a" // Include service accounts - }); + "-a" // Include service accounts + }); } std::unique_ptr P4API::Info()