Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ clones/

# Testing failures
core
.cache/
10 changes: 5 additions & 5 deletions p4-fusion/commands/result.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
18 changes: 9 additions & 9 deletions p4-fusion/git_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 3 additions & 4 deletions p4-fusion/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
70 changes: 35 additions & 35 deletions p4-fusion/p4_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,21 @@ std::unique_ptr<TestResult> P4API::TestConnection(const int retries)
std::unique_ptr<ChangesResult> P4API::ShortChanges(const std::string& path)
{
std::unique_ptr<ChangesResult> changes = Run<ChangesResult>("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;
}

std::unique_ptr<ChangesResult> P4API::Changes(const std::string& path)
{
MTR_SCOPE("P4", __func__);
return Run<ChangesResult>("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<ChangesResult> P4API::Changes(const std::string& path, const std::string& from, int32_t maxCount)
Expand Down Expand Up @@ -241,47 +241,47 @@ std::unique_ptr<ChangesResult> P4API::ChangesFromTo(const std::string& path, con
{
std::string pathArg = path + "@" + from + "," + to;
return Run<ChangesResult>("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<ChangesResult> P4API::LatestChange(const std::string& path)
{
MTR_SCOPE("P4", __func__);
return Run<ChangesResult>("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<ChangesResult> P4API::OldestChange(const std::string& path)
{
std::unique_ptr<ChangesResult> changes = Run<ChangesResult>("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;
}

std::unique_ptr<DescribeResult> P4API::Describe(const std::string& cl)
{
MTR_SCOPE("P4", __func__);
return Run<DescribeResult>("describe", { "-s", // Omit the diffs
cl });
cl });
}

std::unique_ptr<FileLogResult> P4API::FileLog(const std::string& changelist)
{
return Run<FileLogResult>("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<SizesResult> P4API::Size(const std::string& file)
Expand All @@ -298,16 +298,16 @@ std::unique_ptr<SyncResult> P4API::GetFilesToSyncAtCL(const std::string& path, c
{
std::string clCommand = "@" + cl;
return Run<SyncResult>("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<PrintResult> P4API::PrintFile(const std::string& filePathRevision)
{
return Run<PrintResult>("print", {
filePathRevision,
});
filePathRevision,
});
}

std::unique_ptr<PrintResult> P4API::PrintFiles(const std::vector<std::string>& fileRevisions)
Expand All @@ -325,15 +325,15 @@ std::unique_ptr<PrintResult> P4API::PrintFiles(const std::vector<std::string>& f
std::unique_ptr<Result> P4API::Sync(const std::string& path)
{
return Run<Result>("sync", {
path // Sync a particular depot path
});
path // Sync a particular depot path
});
}

std::unique_ptr<UsersResult> P4API::Users()
{
return Run<UsersResult>("users", {
"-a" // Include service accounts
});
"-a" // Include service accounts
});
}

std::unique_ptr<InfoResult> P4API::Info()
Expand Down