[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] update multiple projects
From: |
Stephen Leake |
Subject: |
[Monotone-devel] update multiple projects |
Date: |
Thu, 11 Mar 2010 05:57:39 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (windows-nt) |
As part of my GDS project at work, I have the following workspaces
(directory names - lowest level are mtn workspaces):
main
makerules
sal
opentoken
common
lro
elc
gpm
mms
work_stephe_1
makerules
sal
opentoken
common
lro
elc
note that work_stephe_1 has a subset of the workspaces in main.
I'd like to write a Lua function (call it gds_update_all) that runs
'mtn update' in a set of workspaces. For example:
cd main
mtn stephe_update_all
would update main/*
I have this function in Emacs, but it ties up the GUI while it's
running, so I'd rather have it in Lua. I could make the Emacs function
asynchronous, but putting it in Lua would make it more generally useful.
However, Lua's support for file system stuff, and for calling update,
is lacking. Here's my first attempt:
gds_missions = {"makerules", "sal", "opentoken", "common", "lro", "elc",
"gpm", "mms"}
function gds_find_workspaces()
-- Lua doesn't have directory facilities. So we attempt to open
-- */_MTN/options, where "*" is a list of known mission names,
-- which we have to update once in a while.
local workspaces
workspaces = {}
for _, ws in pairs(gds_missions) do
if io.open (ws .. "/_MTN/options") then
table.insert (workspaces, ws)
end
end
return workspaces
end
function gds_update_all()
local workspaces = gds_find_workspaces (gds_missions)
for _, ws in pairs(workspaces) do
-- cd("../" .. ws)
-- mtn ("update")
mtn_automate ("update", "--workspace=" .. ws)
io.stderr:write(ws .. "\n")
end
end
register_command("gds_update_all", "", "update all sibling branches",
"Update branches in sibling workspaces ../*.", "gds_update_all")
Comments:
gds_find_workspaces is ok for my purposes, but it would be nicer (and
more generally useful) if Lua provided a way to list files/directories
in a directory. Any thoughts on this?
gds_update_all doesn't work:
there is no "cd" Lua function
there is no "mtn" Lua function
"mtn_automate" doesn't support "update"
"update" doesn't take a workspace parameter
Interestingly, the call 'mtn_automate("update")' is accepted, but
doesn't produce any error message. Apparently the Lua function
mtn_automate doesn't handle errors properly.
I think the simplest thing to do here is to make an automate version
of "update", and give it a --workspace parameter. Actually, I think
--workspace has to be a parameter to 'automate', not to the
subcommand. That might be useful in general.
Another choice is to implement a Lua 'cd' command.
Other suggestions?
Eventually, I'd like to extend this concept to other operations on
multiple workspaces; inventory and commit would be useful.
--
-- Stephe
- [Monotone-devel] update multiple projects,
Stephen Leake <=
- Re: [Monotone-devel] update multiple projects, Stephen Leake, 2010/03/28
- Re: [Monotone-devel] update multiple projects, Stephen Leake, 2010/03/29
- Re: [Monotone-devel] update multiple projects, Thomas Keller, 2010/03/30
- Re: [Monotone-devel] update multiple projects, Stephen Leake, 2010/03/30
- Re: [Monotone-devel] update multiple projects, Thomas Keller, 2010/03/30
- Re: [Monotone-devel] update multiple projects, Stephen Leake, 2010/03/31
- Re: [Monotone-devel] update multiple projects, Thomas Keller, 2010/03/31
- Re: [Monotone-devel] update multiple projects, Stephen Leake, 2010/03/31