monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] Hooks


From: Ludovic Brenta
Subject: Re: [Monotone-devel] Hooks
Date: Fri, 10 Oct 2008 18:30:56 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Daniel Carrera writes:
> Ludovic Brenta wrote:
>> I'm not very comfortable with lua either and my first move was to write a
>> shell script along the lines of:
>>
>> #!/bin/sh
>> head=$(mtn automate get_base_workspace_revision)
>> parent=$(mtn automate select p:$head)
>> sed -i -r 's,old_revision \[.*\],old_revision [$parent],' _MTN/revision
>>
>> but this approach fails as soon as the head has more than one parent.
>> That's why, until now, I stuck to the manual way.
>
> How about this?:
>
>
> count=$(mtn automate parents $head|wc -l|sed 's/ //g')
> if [ $count != "1" ]; then
>     echo "Cannot undo. More than one parent."
>     exit
> fi
>
> parents=$(mtn automate parents $head)
> sed -i -r 's,old_revision \[.*\],old_revision [$parent],' _MTN/revision

Looks reasonable.  Note though that I wrote my proposal directly in
the mail and didn't test it.

-- 
Ludovic Brenta.




reply via email to

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