[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] head selector
From: |
Thomas Moschny |
Subject: |
Re: [Monotone-devel] head selector |
Date: |
Fri, 22 Jul 2005 23:17:06 +0200 |
User-agent: |
KMail/1.8.1 |
On Friday 22 July 2005 18:48, Richard Levitte - VMS Whacker wrote:
> thomas.moschny> Is there a way to implement something like the earlier
> thomas.moschny> discussed 'h:' selector in lua in monotonerc?
>
> Actually, if you're so inclined, you might want to check out the
> branch net.venge.monotone.levitte.select-heads-of. h: is implemented
> there. I do not see a way to do it through a lua hook.
Well, statements like these are always - tempting :-)
The following lua code sniplet does something very similar, it replaces
'head:some_branch' with 'i:first_head_revision', but it's ugly (and works
only on unix):
local orig_expand_selector = expand_selector
function expand_selector (str)
if string.find(str,"^head:") then
str = string.sub(str, string.len("head:") + 1)
local f, fname = temp_file()
if f ~= nil then
local rev = nil
local stat = execute("sh", "-c",
"monotone automate heads " .. str .. ">".. fname)
if stat == 0 then
rev = f:read()
end
os.remove(fname)
if rev ~= nil then
return "i:" .. rev
end
end
end
return orig_expand_selector(str)
end
Unfortunately neither does the execute() function honor a preceeding
io.output(fname) statement, nor does the monotone have an output redirection
option a la '-o', thus the ugly 'sh -c with redirection' hack.
Of course it could be more cleaner if one could call the monotone's automation
interface directly from lua scripts ...
Regards,
Thomas
--
Thomas Moschny <address@hidden>
pgp_ssJr1Vl8F.pgp
Description: PGP signature
- [Monotone-devel] head selector, Thomas Moschny, 2005/07/22
- Re: [Monotone-devel] head selector, Richard Levitte - VMS Whacker, 2005/07/22
- Re: [Monotone-devel] head selector,
Thomas Moschny <=
- Re: [Monotone-devel] head selector, Nathaniel Smith, 2005/07/23
- Re: [Monotone-devel] head selector, Nathaniel Smith, 2005/07/23
- Re: [Monotone-devel] head selector, Richard Levitte - VMS Whacker, 2005/07/24
- Re: [Monotone-devel] head selector, Jon Bright, 2005/07/25
- Re: [Monotone-devel] head selector, Nathaniel Smith, 2005/07/25
- Re: [Monotone-devel] head selector, Richard Levitte - VMS Whacker, 2005/07/25
- Re: [Monotone-devel] head selector, Thomas Moschny, 2005/07/25