From d22f466823192963c22eb8f51ae930cb5af8fa9a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 30 Aug 2018 23:14:51 +0300 Subject: Add support for git repositories to brep-load --- libbrep/common.hxx | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'libbrep/common.hxx') diff --git a/libbrep/common.hxx b/libbrep/common.hxx index 5b172ec..0163ca0 100644 --- a/libbrep/common.hxx +++ b/libbrep/common.hxx @@ -218,21 +218,39 @@ namespace brep // repository_type // using bpkg::repository_type; + using bpkg::to_repository_type; + + #pragma db map type(repository_type) as(string) \ + to(to_string (?)) \ + from(brep::to_repository_type (?)) // repository_url // using bpkg::repository_url; + #pragma db map type(repository_url) as(string) \ + to((?).string ()) \ + from((?).empty () ? brep::repository_url () : brep::repository_url (?)) + // repository_location // using bpkg::repository_location; - #pragma db map type(repository_location) as(string) \ - to((?).url ().string ()) \ - from(brep::repository_location ((?).empty () \ - ? bpkg::repository_url () \ - : brep::repository_url (?), \ - brep::repository_type::pkg)) + #pragma db value + struct _repository_location + { + repository_url url; + repository_type type; + }; + + // Note that the type() call fails for an empty repository location. + // + #pragma db map type(repository_location) as(_repository_location) \ + to(brep::_repository_location {(?).url (), \ + (?).empty () \ + ? brep::repository_type::pkg \ + : (?).type ()}) \ + from(brep::repository_location (std::move ((?).url), (?).type)) // Version comparison operators. // -- cgit v1.1