summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-05-14 15:47:00 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-05-14 15:47:00 +0100
commitd707449dbb5860957362b0ab640cc188fa7aec62 (patch)
treeb300272640d682b43af6622630c3c51546f81d9e
parentReplace the database file types and file list comparison logic with one that'... (diff)
downloadgentoobrowse-api-d707449dbb5860957362b0ab640cc188fa7aec62.tar.bz2
gentoobrowse-api-d707449dbb5860957362b0ab640cc188fa7aec62.tar.xz
gentoobrowse-api-d707449dbb5860957362b0ab640cc188fa7aec62.zip
Include repository status in repository model
-rw-r--r--gentoobrowse-api/domain/portage-models.ice3
-rw-r--r--gentoobrowse-api/service/sql/portage/getRepositories.sql2
-rw-r--r--gentoobrowse-api/service/sql/portage/getRepository.sql2
-rw-r--r--gentoobrowse-api/unittests/testPortage.cpp6
4 files changed, 11 insertions, 2 deletions
diff --git a/gentoobrowse-api/domain/portage-models.ice b/gentoobrowse-api/domain/portage-models.ice
index 32bda7c..3636ecf 100644
--- a/gentoobrowse-api/domain/portage-models.ice
+++ b/gentoobrowse-api/domain/portage-models.ice
@@ -106,6 +106,9 @@ module Gentoo {
int repoid;
string name;
string path;
+ string upstream;
+ string branch;
+ string lastcommit;
};
class Use {
diff --git a/gentoobrowse-api/service/sql/portage/getRepositories.sql b/gentoobrowse-api/service/sql/portage/getRepositories.sql
index f483fea..43abef7 100644
--- a/gentoobrowse-api/service/sql/portage/getRepositories.sql
+++ b/gentoobrowse-api/service/sql/portage/getRepositories.sql
@@ -1,4 +1,4 @@
-- libdbpp:no-cursor
-SELECT repoid, name, path
+SELECT repoid, name, path, upstream, branch, lastcommit
FROM gentoobrowse.repos
ORDER BY repoid
diff --git a/gentoobrowse-api/service/sql/portage/getRepository.sql b/gentoobrowse-api/service/sql/portage/getRepository.sql
index 36eea22..bcd835c 100644
--- a/gentoobrowse-api/service/sql/portage/getRepository.sql
+++ b/gentoobrowse-api/service/sql/portage/getRepository.sql
@@ -1,4 +1,4 @@
-- libdbpp:no-cursor
-SELECT repoid, name, path
+SELECT repoid, name, path, upstream, branch, lastcommit
FROM gentoobrowse.repos
WHERE repoid = ?
diff --git a/gentoobrowse-api/unittests/testPortage.cpp b/gentoobrowse-api/unittests/testPortage.cpp
index e4ff9ff..5386e1a 100644
--- a/gentoobrowse-api/unittests/testPortage.cpp
+++ b/gentoobrowse-api/unittests/testPortage.cpp
@@ -537,6 +537,9 @@ BOOST_AUTO_TEST_CASE( getRepository )
BOOST_REQUIRE_EQUAL(17, r.repoid);
BOOST_REQUIRE_EQUAL("gentoo", r.name);
BOOST_REQUIRE_EQUAL("/usr/portage", r.path);
+ BOOST_REQUIRE_EQUAL("origin", r.upstream);
+ BOOST_REQUIRE_EQUAL("master", r.branch);
+ BOOST_REQUIRE_EQUAL("87ebb8523b2890c641a27f29007ba8eaa6aa834e", r.lastcommit);
}
BOOST_AUTO_TEST_CASE( getRepositoryMissing )
@@ -551,6 +554,9 @@ BOOST_AUTO_TEST_CASE( getRepositories )
BOOST_REQUIRE_EQUAL(17, rs.front().repoid);
BOOST_REQUIRE_EQUAL("gentoo", rs.front().name);
BOOST_REQUIRE_EQUAL("/usr/portage", rs.front().path);
+ BOOST_REQUIRE_EQUAL("origin", rs.front().upstream);
+ BOOST_REQUIRE_EQUAL("master", rs.front().branch);
+ BOOST_REQUIRE_EQUAL("87ebb8523b2890c641a27f29007ba8eaa6aa834e", rs.front().lastcommit);
BOOST_REQUIRE_EQUAL(18, rs.back().repoid);
BOOST_REQUIRE_EQUAL("RandomLAN", rs.back().name);
BOOST_REQUIRE_EQUAL("/home/randomdan/dev/portage", rs.back().path);