diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2021-08-16 18:54:15 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-08-18 10:52:23 +0300 |
commit | cd315fecaf4c7473950c1610e06417634b416954 (patch) | |
tree | fdc821b4e55c3af9b87fd678a8c550089e52ef80 /bpkg/manifest-utility.hxx | |
parent | c7d9b6020f41ef64d9315ec0bf3e2b4a1c59f67b (diff) |
Optimize rep-fetch for dir and git repos quering projects info in single call
Diffstat (limited to 'bpkg/manifest-utility.hxx')
-rw-r--r-- | bpkg/manifest-utility.hxx | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/bpkg/manifest-utility.hxx b/bpkg/manifest-utility.hxx index 29d548d..b7d9b07 100644 --- a/bpkg/manifest-utility.hxx +++ b/bpkg/manifest-utility.hxx @@ -95,20 +95,29 @@ namespace bpkg bool repository_name (const string&); - // Return the version of a package as provided by the build2 version module. - // Return nullopt if the version module is disabled for the package (or the - // build2 project directory doesn't contain the manifest file). Fail if the - // directory is not a build2 project. + // Return the versions of packages as provided by the build2 version module. + // Return nullopt for a package if the version module is disabled for it (or + // the build2 project directory doesn't contain the manifest file). Fail if + // any of the specified directories is not a build2 project. // - // Note that if the package directory is under the version control, then the + // Note that if a package directory is under the version control, then the // resulting version may be populated with the snapshot information (see // libbutl/standard-version.mxx for more details). Thus, this function can - // be used for fixing up the package manifest version. + // be used for fixing up the package manifest versions. // class common_options; - optional<version> - package_version (const common_options&, const dir_path&); + vector<optional<version>> + package_versions (const common_options&, const dir_paths&); + + // As above but return the version of a single package. + // + inline optional<version> + package_version (const common_options& o, const dir_path& d) + { + vector<optional<version>> r (package_versions (o, dir_paths ({d}))); + return move (r[0]); + } } #endif // BPKG_MANIFEST_UTILITY_HXX |