summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2016-08-28 13:05:21 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2016-08-28 13:05:21 +0100
commit6e01e8ad9889db2a7a650be9eb6cfd76dce46cba (patch)
tree459ec0b2e23c782c059a394b47b39a5b80f57566 /bin
parent7210d1a2cfb33e870901629b2423a2f183c08954 (diff)
downloadgitano-6e01e8ad9889db2a7a650be9eb6cfd76dce46cba.tar.gz
Performed i18n on all bin/*.in
Diffstat (limited to 'bin')
-rw-r--r--bin/gitano-auth.in6
-rw-r--r--bin/gitano-post-receive-hook.in36
-rw-r--r--bin/gitano-pre-receive-hook.in20
-rw-r--r--bin/gitano-update-hook.in47
-rw-r--r--bin/gitano-update-ssh.in10
5 files changed, 61 insertions, 58 deletions
diff --git a/bin/gitano-auth.in b/bin/gitano-auth.in
index 00f2f39..dea7328 100644
--- a/bin/gitano-auth.in
+++ b/bin/gitano-auth.in
@@ -32,7 +32,7 @@ gitano.config.repo_path(repo_root)
local cmdline = luxio.getenv "SSH_ORIGINAL_COMMAND" or ""
if cmdline:match("^[ \t\n]*$") then
- gitano.log.fatal("No command provided, cannot continue")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_NO_COMMAND"))
end
local authorized, cmd, parsed_cmdline, config, env, repo =
@@ -44,10 +44,10 @@ if authorized then
user, config, env, repo)
if exit ~= 0 then
- gitano.log.fatal("Error running command, exiting")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_COMMAND_FAILED"))
end
else
- gitano.log.fatal("Not authorized")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_NOT_AUTHORISED"))
end
gitano.log.syslog.close()
diff --git a/bin/gitano-post-receive-hook.in b/bin/gitano-post-receive-hook.in
index 020cf04..b9de48b 100644
--- a/bin/gitano-post-receive-hook.in
+++ b/bin/gitano-post-receive-hook.in
@@ -44,21 +44,21 @@ gitano.config.repo_path(repo_root)
local admin_repo = gall.repository.new((repo_root or "") .. "/gitano-admin.git")
if not admin_repo then
- gitano.log.fatal("Unable to locate administration repository. Cannot continue");
+ gitano.log.fatal(gitano.i18n.expand("ERROR_NO_ADMIN_REPO"));
end
local admin_head = admin_repo:get(admin_repo.HEAD)
if not admin_head then
- gitano.log.fatal("Unable to find the HEAD of the administration repository. Cannot continue");
+ gitano.log.fatal(gitano.i18n.expand("ERROR_BAD_ADMIN_REPO"));
end
local config, msg = gitano.config.parse(admin_head)
if not config then
- gitano.log.critical("Unable to parse administration repository.")
+ gitano.log.critical(gitano.i18n.expand("ERROR_CANNOT_PARSE_ADMIN"))
gitano.log.critical(" * " .. (msg or "No error?"))
- gitano.log.fatal("Cannot continue")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_CANNOT_CONTINUE"))
end
-- Now, are we an admin?
@@ -74,13 +74,13 @@ end
local repo, msg = gitano.repository.find(config, project)
if not repo then
- gitano.log.critical("Unable to locate repository.")
+ gitano.log.critical(gitano.i18n.expand("ERROR_CANNOT_LOCATE_REPO"))
gitano.log.critical(" * " .. (tostring(msg)))
- gitano.log.fatal("Cannot continue")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_CANNOT_CONTINUE"))
end
if repo.is_nascent then
- gitano.log.fatal("Repository " .. repo.name .. " is nascent")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_REPO_IS_NASCENT", {name=repo.name}))
end
-- Post-receive is not allowed to prevent updates, instead on stdin we get
@@ -99,7 +99,7 @@ end
-- that the updates (if any) will have been applied
if updates["refs/gitano/admin"] then
- local msg = "<" .. repo.name .. ">" .. " Any changes to admin ref have been applied."
+ local msg = gitano.i18n.expand("CHANGES_TO_ADMINREF_APPLIED", {name=repo.name})
gitano.log.chat(msg)
gitano.log.syslog.info(msg)
@@ -107,12 +107,12 @@ end
local function report_repo(reponame, repo, msg)
if repo then
- local s = "<" .. reponame ..">" .. " Any changes to hooks etc have been applied"
+ local s = gitano.i18n.expand("CHANGES_TO_HOOKS_APPLIED", {name=repo.name})
gitano.log.chat(s)
gitano.log.syslog.info(s)
else
- gitano.log.crit("<" .. reponame .. ">", "Unable to process:", msg)
+ gitano.log.crit(gitano.i18n.expand("ERROR_UNABLE_TO_PROCESS", {name=repo.name, msg=msg}))
end
end
@@ -121,7 +121,7 @@ if repo.name == "gitano-admin" and updates[admin_repo.HEAD] then
gitano.log.syslog.info("Updating gitano-admin")
- local msg = "Scanning repositories to apply hook/rules updates..."
+ local msg = gitano.i18n.expand("SCANNING_FOR_UPDATES")
gitano.log.chat(msg)
gitano.log.syslog.info(msg)
@@ -130,7 +130,7 @@ if repo.name == "gitano-admin" and updates[admin_repo.HEAD] then
gitano.log.crit(msg)
end
- msg = "All repositories updated where possible."
+ msg = gitano.i18n.expand("ALL_UPDATES_DONE")
gitano.log.chat(msg)
gitano.log.syslog.info(msg)
@@ -140,16 +140,16 @@ if repo.name == "gitano-admin" and updates[admin_repo.HEAD] then
})
local how, why = proc:wait()
if how ~= "exit" or why ~= 0 then
- gitano.log.crit("Updating SSH keys didn't work?")
+ gitano.log.crit(gitano.i18n.expand("ERROR_UPDATE_SSH_NOT_WORK"))
end
elseif repo.name ~= "gitano-admin" then
-- Not gitano-admin at all, so run the update-server-info stuff
- gitano.log.info("Updating server info for dumb HTTP transport")
+ gitano.log.info(gitano.i18n.expand("UPDATE_HTTP_INFO"))
local ok, err = repo.git:update_server_info()
if not ok then
gitano.log.warn(err)
end
- gitano.log.info("Updating last-modified date")
+ gitano.log.info(gitano.i18n.expand("UPDATE_LASTMOD_DATE"))
local shas = {}
for _, t in pairs(updates) do
shas[#shas+1] = t.newsha
@@ -164,7 +164,7 @@ if repo:uses_hook("post-receive") then
gitano.log.debug("Configuring for post-receive hook")
gitano.actions.set_supple_globals("post-receive")
- local msg = "Running repository post-receive hook"
+ local msg = gitano.i18n.expand("RUNNING_POST_RECEIVE_HOOK")
gitano.log.info(msg)
gitano.log.syslog.info(msg)
@@ -177,9 +177,9 @@ if repo:uses_hook("post-receive") then
}
local ok, msg = gitano.supple.run_hook("post-receive", repo, info, updates)
if not ok then
- gitano.log.crit(msg or "No reason given, but errored somehow.")
+ gitano.log.crit(msg or gitano.i18n.expand("ERROR_NO_ERROR_FOUND"))
end
- gitano.log.info("Finished")
+ gitano.log.info(gitano.i18n.expand("FINISHED"))
end
gitano.log.syslog.close()
diff --git a/bin/gitano-pre-receive-hook.in b/bin/gitano-pre-receive-hook.in
index b917633..694894e 100644
--- a/bin/gitano-pre-receive-hook.in
+++ b/bin/gitano-pre-receive-hook.in
@@ -44,21 +44,21 @@ gitano.config.repo_path(repo_root)
local admin_repo = gall.repository.new((repo_root or "") .. "/gitano-admin.git")
if not admin_repo then
- gitano.log.fatal("Unable to locate administration repository. Cannot continue");
+ gitano.log.fatal(gitano.i18n.expand("ERROR_NO_ADMIN_REPO"));
end
local admin_head = admin_repo:get(admin_repo.HEAD)
if not admin_head then
- gitano.log.fatal("Unable to find the HEAD of the administration repository. Cannot continue");
+ gitano.log.fatal(gitano.i18n.expand("ERROR_BAD_ADMIN_REPO"));
end
local config, msg = gitano.config.parse(admin_head)
if not config then
- gitano.log.critical("Unable to parse administration repository.")
+ gitano.log.critical(gitano.i18n.expand("ERROR_CANNOT_PARSE_ADMIN"))
gitano.log.critical(" * " .. (msg or "No error?"))
- gitano.log.fatal("Cannot continue")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_CANNOT_CONTINUE"))
end
-- Now, are we an admin?
@@ -74,13 +74,13 @@ end
local repo, msg = gitano.repository.find(config, project)
if not repo then
- gitano.log.critical("Unable to locate repository.")
+ gitano.log.critical(gitano.i18n.expand("ERROR_CANNOT_LOCATE_REPO"))
gitano.log.critical(" * " .. (tostring(msg)))
- gitano.log.fatal("Cannot continue")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_CANNOT_CONTINUE"))
end
if repo.is_nascent then
- gitano.log.fatal("Repository " .. repo.name .. " is nascent")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_REPO_IS_NASCENT", {name=repo.name}))
end
-- pre-receive can prevent updates. Its name is a bit misleading.
@@ -101,7 +101,7 @@ if repo:uses_hook("pre-receive") then
gitano.log.debug("Configuring for pre-receive hook")
gitano.actions.set_supple_globals("pre-receive")
- local msg = "Running repository pre-receive hook"
+ local msg = gitano.i18n.expand("RUNNING_PRE_RECEIVE_HOOK")
gitano.log.info(msg)
gitano.log.syslog.info(msg)
@@ -115,9 +115,9 @@ if repo:uses_hook("pre-receive") then
}
local ok, msg = gitano.supple.run_hook("pre-receive", repo, info, updates)
if not ok then
- gitano.log.crit(msg or "No reason given, but errored somehow.")
+ gitano.log.crit(msg or gitano.i18n.expand("ERROR_NO_ERROR_FOUND"))
end
- gitano.log.info("Finished")
+ gitano.log.info(gitano.i18n.expand("FINISHED"))
end
gitano.log.syslog.close()
diff --git a/bin/gitano-update-hook.in b/bin/gitano-update-hook.in
index 80db919..102fa36 100644
--- a/bin/gitano-update-hook.in
+++ b/bin/gitano-update-hook.in
@@ -48,21 +48,21 @@ gitano.config.repo_path(repo_root)
local admin_repo = gall.repository.new((repo_root or "") .. "/gitano-admin.git")
if not admin_repo then
- gitano.log.fatal("Unable to locate administration repository. Cannot continue");
+ gitano.log.fatal(gitano.i18n.expand("ERROR_NO_ADMIN_REPO"));
end
local admin_head = admin_repo:get(admin_repo.HEAD)
if not admin_head then
- gitano.log.fatal("Unable to find the HEAD of the administration repository. Cannot continue");
+ gitano.log.fatal(gitano.i18n.expand("ERROR_BAD_ADMIN_REPO"));
end
local config, msg = gitano.config.parse(admin_head)
if not config then
- gitano.log.critical("Unable to parse administration repository.")
+ gitano.log.critical(gitano.i18n.expand("ERROR_CANNOT_PARSE_ADMIN"))
gitano.log.critical(" * " .. (msg or "No error?"))
- gitano.log.fatal("Cannot continue")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_CANNOT_CONTINUE"))
end
-- Now, are we an admin?
@@ -78,13 +78,13 @@ end
local repo, msg = gitano.repository.find(config, project)
if not repo then
- gitano.log.critical("Unable to locate repository.")
+ gitano.log.critical(gitano.i18n.expand("ERROR_CANNOT_LOCATE_REPO"))
gitano.log.critical(" * " .. (tostring(msg)))
- gitano.log.fatal("Cannot continue")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_CANNOT_CONTINUE"))
end
if repo.is_nascent then
- gitano.log.fatal("Repository " .. repo.name .. " is nascent")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_REPO_IS_NASCENT", {name=repo.name}))
end
@@ -141,7 +141,8 @@ local function do_expensive_populate_context(context)
oldtree = thing.content.tree.content
else
oldtree = repo.git:get(gall.tree.empty_sha).content
- gitano.log.warn("Odd, old object", oldsha, "is not a commit or tag")
+ gitano.log.warn(gitano.i18n.expand("ODD_OLD_OBJECT_NOT_COMMIT_OR_TAG",
+ {sha=oldsha}))
end
end
@@ -156,7 +157,8 @@ local function do_expensive_populate_context(context)
newtree = thing.content.tree.content
else
newtree = repo.git:get(gall.tree.empty_sha).content
- gitano.log.warn("Odd, new object", oldsha, "is not a commit or tag")
+ gitano.log.warn(gitano.i18n.expand("ODD_NEW_OBJECT_NOT_COMMIT_OR_TAG",
+ {sha=newsha}))
end
end
@@ -228,10 +230,10 @@ local function defer_generation(key)
-- test in case someone else got hold of this
-- beforehand and manages to cross the streams
if type(ctx[key]) == "function" then
- gitano.log.chat("Treedeltas generating because of:",
- key, " Please hold.")
+ gitano.log.chat(gitano.i18n.expand("GENERATING_TREEDELTAS",
+ {key=key}))
do_expensive_populate_context(ctx)
- gitano.log.chat("Treedeltas built, continuing")
+ gitano.log.chat(gitano.i18n.expand("GENERATED_TREEDELTAS"))
end
-- And return what we were meant to be
return ctx[key]
@@ -278,12 +280,13 @@ local action, reason = repo:run_lace(context)
if not action then
gitano.log.crit(reason)
- gitano.log.fatal("Ruleset did not complete cleanly")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_RULESET_UNCLEAN_FINISH"))
end
if action ~= "allow" then
- gitano.log.critical("Rules refused update:", reason)
- gitano.log.fatal("Ruleset denied action. Sorry")
+ gitano.log.critical(gitano.i18n.expand("ERROR_RULES_REFUSED_UPDATE",
+ {reason=reason}))
+ gitano.log.fatal(gitano.i18n.expand("ERROR_RULESET_DENIED_ACTION"))
end
-- Now perform any special hook checks (e.g. for the admin hook)
@@ -291,15 +294,15 @@ gitano.log.ddebug("Ruleset allowed the action, let's run builtin action")
local allow, msg = gitano.actions.update_actions(conf, repo, context)
if not allow then
- gitano.log.critical("Builtin actions said:", msg)
- gitano.log.fatal("Actions denied action. Sorry")
+ gitano.log.critical(gitano.i18n.expand("ERROR_BUILTIN_HANDLERS_SAID", {msg=msg}))
+ gitano.log.fatal(gitano.i18n.expand("ERROR_ACTIONS_REFUSED_ACTION"))
end
if repo:uses_hook("update") then
gitano.log.debug("Configuring for update hook")
gitano.actions.set_supple_globals("update")
- local msg = "Running repository update hook"
+ local msg = gitano.i18n.expand("RUNNING_UPDATE_HOOK")
gitano.log.info(msg)
gitano.syslog.info(msg)
@@ -313,13 +316,13 @@ if repo:uses_hook("update") then
local ok, msg = gitano.supple.run_hook("update", repo, info,
refname, oldsha, newsha)
if not ok then
- gitano.log.fatal(msg or "No reason given to refuse action.")
+ gitano.log.fatal(msg or gitano.i18n.expand("ERROR_NO_ERROR_FOUND"))
end
- gitano.log.info("Finished")
+ gitano.log.info(gitano.i18n.expand("FINISHED"))
end
-gitano.log.info("Allowing ref update of",
- refname, "from", oldsha, "to", newsha)
+gitano.log.info(gitano.i18n.expand("ALLOWING_UPDATE",
+ {ref=refname, old=oldsha, new=newsha}))
gitano.log.syslog.info("Allowing ref", action, "of", refname,
"( was", oldsha, "is now", newsha, ")")
diff --git a/bin/gitano-update-ssh.in b/bin/gitano-update-ssh.in
index 27217b4..608d0df 100644
--- a/bin/gitano-update-ssh.in
+++ b/bin/gitano-update-ssh.in
@@ -32,22 +32,22 @@ gitano.log.syslog.open()
local admin_repo = gall.repository.new((repo_root or "") .. "/gitano-admin.git")
if not admin_repo then
- gitano.log.error("Usage: gitano-update-ssh /path/to/repos")
- gitano.log.fatal("Unable to locate administration repository. Cannot continue");
+ gitano.log.error(gitano.i18n.expand("UPDATE_SSH_USAGE"))
+ gitano.log.fatal(gitano.i18n.expand("ERROR_CANNOT_FIND_ADMIN_REPO"));
end
local admin_head = admin_repo:get(admin_repo.HEAD)
if not admin_head then
- gitano.log.fatal("Unable to find the HEAD of the administration repository. Cannot continue");
+ gitano.log.fatal(gitano.i18n.expand("ERROR_BAD_ADMIN_REPO"))
end
local config, msg = gitano.config.parse(admin_head)
if not config then
- gitano.log.critical("Unable to parse administration repository.")
+ gitano.log.critical(gitano.i18n.expand("ERROR_CANNOT_PARSE_ADMIN"))
gitano.log.critical(" * " .. (msg or "No error?"))
- gitano.log.fatal("Cannot continue")
+ gitano.log.fatal(gitano.i18n.expand("ERROR_CANNOT_CONTINUE"))
end
gitano.config.writessh(config)