diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2016-12-03 14:12:54 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2016-12-03 14:12:54 +0000 |
commit | a6dbfbcae45f653aa24a3702120289381b77d804 (patch) | |
tree | 34fd2f3e3750de7d2ccf99c71eba878348ebecf6 /lib | |
parent | 6fc112420d74d929dead5fb7f5fe5bc3b3540834 (diff) | |
download | gitano-a6dbfbcae45f653aa24a3702120289381b77d804.tar.gz |
Remove legacy repo:set_owner() and repo:set_description() calls
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitano/command.lua | 3 | ||||
-rw-r--r-- | lib/gitano/copycommand.lua | 3 | ||||
-rw-r--r-- | lib/gitano/repository.lua | 25 |
3 files changed, 10 insertions, 21 deletions
diff --git a/lib/gitano/command.lua b/lib/gitano/command.lua index b15c2ca..483755c 100644 --- a/lib/gitano/command.lua +++ b/lib/gitano/command.lua @@ -281,7 +281,8 @@ local function builtin_create_run(config, repo, cmdline, env) end local owner = cmdline[3] or env["GITANO_USER"] log.chat("Setting repository owner to", owner) - ok, msg = repo:set_owner(owner, env.GITANO_USER, env.GITANO_ORIG_USER) + ok, msg = repo:conf_set_and_save("project.owner", owner, + env.GITANO_USER, env.GITANO_ORIG_USER) if not ok then log.error(msg) return "exit", 1 diff --git a/lib/gitano/copycommand.lua b/lib/gitano/copycommand.lua index f395d70..51dca74 100644 --- a/lib/gitano/copycommand.lua +++ b/lib/gitano/copycommand.lua @@ -90,7 +90,8 @@ local function builtin_copy_run(config, repo, cmdline, env) local owner = env["GITANO_USER"] log.chat("Setting repository owner to", owner) - ok, msg = tgtrepo:set_owner(owner, env.GITANO_USER, env.GITANO_ORIG_USER) + ok, msg = tgtrepo:conf_set_and_save("project.owner", owner, + env.GITANO_USER, env.GITANO_ORIG_USER) if not ok then log.error(msg) return "exit", 1 diff --git a/lib/gitano/repository.lua b/lib/gitano/repository.lua index 3bc1e13..410a35f 100644 --- a/lib/gitano/repository.lua +++ b/lib/gitano/repository.lua @@ -472,29 +472,16 @@ function repo_method:realise() return self:run_checks() end -function repo_method:set_owner(newowner, author, committer) - local oldowner = self:conf_get "project.owner" - self:conf_set("project.owner", newowner) - local ok, msg = self:save_admin("Setting owner to " .. newowner, +function repo_method:conf_set_and_save(conf, newvalue, author, committer) + local oldvalue = self:conf_get(conf) + self:conf_set(conf, newvalue) + local ok, msg = self:save_admin("Setting " .. conf .. " to " .. newvalue, author, committer) if not ok then - self:conf_set("project.owner", oldowner) + self:conf_set(conf, oldvalue) return nil, msg end - log.state("<" .. self.name .. "> Set owner to <" .. newowner .. ">") - return true -end - -function repo_method:set_description(newdesc, author, committer) - local olddesc = self:conf_get "project.description" - self:conf_set("project.description", newdesc) - local ok, msg = self:save_admin("Changing description\n\n" .. newdesc, - author, committer) - if not ok then - self:conf_set("project.description", olddesc) - return nil, msg - end - log.state("<" .. self.name .. "> Changed description") + log.state("<" .. self.name .. "> Set " .. conf .. " to <" .. newvalue .. ">") return true end |