monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] get rev_id of merge


From: Stephen Leake
Subject: Re: [Monotone-devel] get rev_id of merge
Date: Wed, 05 May 2010 03:02:45 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (windows-nt)

Thomas Keller <address@hidden> writes:

> Am 04.05.10 16:18, schrieb Stephen Leake:
>> I'm trying to get the rev_id of a merge, in a Lua test. Can anyone tell
>> me why this doesn't work? I based it on base_revision().
>> 
>> function merged_revision()
>>   local workrev = readfile("stderr")
>>   local extract = string.gsub(workrev, "^mtn: %[merged%] (%x*)$", "%1")
>
> This will not work with multi-line string input, because ^ marks the
> very beginning and $ the very end of the string, not the line. But even
> if you remove these, you'll only process the replacement of the matched
> line, while you actually want to extract something. This should work better:
>
> local extract = string.match(workrev, "mtn: %[merged%] (%x*)")

That does work, and is clearer, but I don't understand the explanation.
Why does base_revision work?

Not a very important question, but it bothers me.

-- 
-- Stephe




reply via email to

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