diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-12-23 19:05:22 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-12-28 17:39:03 +0300 |
commit | 42ae47c3033a8c9ce70f1e6fb4c88ed70ac679fb (patch) | |
tree | bdd2cdbf35b4dfbfbc77763156182f03d497ad16 /bpkg/package.hxx | |
parent | dc5296af63000cddc4b46fc205137c20578cb81f (diff) |
Add repository type detection
Diffstat (limited to 'bpkg/package.hxx')
-rw-r--r-- | bpkg/package.hxx | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/bpkg/package.hxx b/bpkg/package.hxx index b5ad0f3..00a54d6 100644 --- a/bpkg/package.hxx +++ b/bpkg/package.hxx @@ -19,7 +19,7 @@ #include <bpkg/types.hxx> #include <bpkg/utility.hxx> -#pragma db model version(3, 3, closed) +#pragma db model version(4, 4, open) namespace bpkg { @@ -200,9 +200,24 @@ namespace bpkg // repository_location // - #pragma db map type(repository_location) as(string) \ - to((?).string ()) from(bpkg::repository_location (?)) + #pragma db value + struct _repository_location + { + string 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({(?).string (), \ + (?).empty () ? bpkg::repository_type::bpkg : (?).type ()}) \ + from(bpkg::repository_location ((?).url, (?).type)) + + #pragma db map type(repository_type) as(string) \ + to(to_string (?)) \ + from(bpkg::to_repository_type (?)) // repository // @@ -240,7 +255,7 @@ namespace bpkg // #pragma db member(name) id - #pragma db member(location) \ + #pragma db member(location) column("") \ set(this.location = std::move (?); \ assert (this.name == this.location.canonical_name ())) |