diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-26 15:52:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-26 15:53:23 +0200 |
commit | 8276cb927bafd338be237adbecf437e70042da99 (patch) | |
tree | 49218b58e1f50a65b58674177e6047f1ac9f6831 /build2/version/snapshot.cxx | |
parent | 2fd9d3f177429b20797897360931badedbb0f0ef (diff) |
Implement version module
Diffstat (limited to 'build2/version/snapshot.cxx')
-rw-r--r-- | build2/version/snapshot.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/build2/version/snapshot.cxx b/build2/version/snapshot.cxx new file mode 100644 index 0000000..be6c147 --- /dev/null +++ b/build2/version/snapshot.cxx @@ -0,0 +1,31 @@ +// file : build2/version/snapshot.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include <build2/version/snapshot> + +#include <build2/filesystem> + +using namespace std; + +namespace build2 +{ + namespace version + { + snapshot + extract_snapshot_git (const dir_path&); + + static const dir_path git (".git"); + + snapshot + extract_snapshot (const scope& rs) + { + const dir_path& src_root (rs.src_path ()); + + if (exists (src_root / git)) + return extract_snapshot_git (src_root); + + return snapshot (); + } + } +} |