monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] update multiple projects


From: Stephen Leake
Subject: Re: [Monotone-devel] update multiple projects
Date: Mon, 29 Mar 2010 03:21:34 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (windows-nt)

Stephen Leake <address@hidden> writes:

> ...
>
> This basically works, but I'm getting errors about writing the options file:
>
> mtn: warning: Failed to write options file _MTN/options: error: renaming 
> '_MTN/mtdkyfvx.tmp' to '_MTN/options' failed: Access is denied. (5)

I found the problem; the Lua code I was using to test if a directory
is a workspace opens _MTN/options but doesn't close it.

Here's the final Lua code:

----------

gds_missions = {"makerules", "sal", "opentoken", "common", "lro", "elc", "gpm", 
"mms"}

function gds_find_workspaces(missions)
   -- 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 = {}
   local file

   for _, ws in pairs(missions) do
      file = io.open (ws .. "/_MTN/options")
      if file then
         table.insert (workspaces, ws)
         io.close (file)
      end
   end

   return workspaces
end

function gds_update_all()
   local workspaces = gds_find_workspaces (gds_missions)
   local status, msg

   if 0 == # workspaces then
      error("no GDS workspaces found")
   end

   for _, ws in pairs(workspaces) do
       status, msg = change_workspace(ws)
       if not status then
          error (msg)
       end

       status, msg = mtn_automate("update")

       -- msg is stdout; stderr is output already. stderr contains
       -- lots of progress messages for each workspace; summarize
       -- those that failed here. For some reason, all of these are
       -- output after all of the update outputs, so we don't need to
       -- cache the result for each workspace.
       if not status then
          io.stderr:write(ws .. " failed\n")
       end
   end
end

register_command("gds_update_all", "", "update all GDS workspaces",
      "Update GDS workspaces in child directories", "gds_update_all")

----------

Any objections to merging work_stephe to main? It does two things:

    implements 'automate update'

    provides a new Lua function 'change_workspace'

I need to add both of these to monotone.texi and NEWS first.

--
-- Stephe




reply via email to

[Prev in Thread] Current Thread [Next in Thread]