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: Thomas Keller
Subject: Re: [Monotone-devel] get rev_id of merge
Date: Wed, 05 May 2010 00:43:59 +0200
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; de; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b2pre Thunderbird/3.0.4

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*)")

Thomas.

-- 
GPG-Key 0x160D1092 | address@hidden | http://thomaskeller.biz
Please note that according to the EU law on data retention, information
on every electronic information exchange might be retained for a period
of six months or longer: http://www.vorratsdatenspeicherung.de/?lang=en

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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