aboutsummaryrefslogtreecommitdiff
path: root/bpkg/rep-remove.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-03-07 22:36:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-03-08 13:35:44 +0300
commitccd8c8dadfcfd9181772b3061e7b075d88942505 (patch)
tree2e2d292deafa3e3282128c0a92ea1b9894809e6f /bpkg/rep-remove.cxx
parentd234bf4a341edb470a2c81f2533f7eb5c67c948c (diff)
Change database parameter type to transaction for some rep_*() functions
Diffstat (limited to 'bpkg/rep-remove.cxx')
-rw-r--r--bpkg/rep-remove.cxx18
1 files changed, 12 insertions, 6 deletions
diff --git a/bpkg/rep-remove.cxx b/bpkg/rep-remove.cxx
index df9acde..eadb63f 100644
--- a/bpkg/rep-remove.cxx
+++ b/bpkg/rep-remove.cxx
@@ -72,8 +72,10 @@ namespace bpkg
}
void
- rep_remove_package_locations (database& db, const string& name)
+ rep_remove_package_locations (transaction& t, const string& name)
{
+ database& db (t.database ());
+
for (const auto& rp: db.query<repository_package> (
query<repository_package>::repository::name == name))
{
@@ -112,15 +114,19 @@ namespace bpkg
}
void
- rep_remove (const dir_path& c, database& db, const shared_ptr<repository>& r)
+ rep_remove (const dir_path& c,
+ transaction& t,
+ const shared_ptr<repository>& r)
{
const string& nm (r->name);
assert (!nm.empty ()); // Can't be the root repository.
+ database& db (t.database ());
+
if (reachable (db, r))
return;
- rep_remove_package_locations (db, nm);
+ rep_remove_package_locations (t, nm);
// Cleanup the repository state if present.
//
@@ -154,12 +160,12 @@ namespace bpkg
// Prior to removing a prerequisite/complement we need to make sure it
// still exists, which may not be the case due to the dependency cycle.
//
- auto remove = [&c, &db] (const lazy_shared_ptr<repository>& rp)
+ auto remove = [&c, &db, &t] (const lazy_shared_ptr<repository>& rp)
{
shared_ptr<repository> r (db.find<repository> (rp.object_id ()));
if (r)
- rep_remove (c, db, r);
+ rep_remove (c, t, r);
};
for (const lazy_shared_ptr<repository>& cr: r->complements)
@@ -375,7 +381,7 @@ namespace bpkg
//
for (const lazy_shared_ptr<repository>& r: repos)
{
- rep_remove (c, db, r.load ());
+ rep_remove (c, t, r.load ());
if (verb)
text << "removed " << r.object_id ();