monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] auto updates


From: Brian May
Subject: Re: [Monotone-devel] auto updates
Date: Sat, 21 Oct 2006 09:32:15 +1000
User-agent: Gnus/5.110006 (No Gnus v0.6) XEmacs/21.4.19 (linux)

>>>>> "Timothy" == Timothy Brownawell <Timothy> writes:

    Timothy> It's possible to have it only run if a specific branch is
    Timothy> updated (make note of that from
    Timothy> note_netsync_revision_received). I don't think you can
    Timothy> make it select by db, but that only matters if you have
    Timothy> the same branch in several dbs.

    Timothy> You'd also probably want to check for multiple heads,
    Timothy> which would make the update fail, and maybe check for
    Timothy> uncommitted work that could potentially be garbled by a
    Timothy> failed update merge.

Hmmm. Considering my lua isn't very good yet, how about the following
shell script (that is called from lua but only if the branch has been
received) for now:

address@hidden:~/tree/config$ cat ~/bin/update
#!/bin/sh -e

cd "$1"

heads=`mtn automate heads "$2" | wc --lines`
if [ "$heads" -gt 1 ]
then
        echo "Too many heads" >&2
        exit 0;
fi

diff=`mtn diff | wc --lines`
if [ "$diff" -gt 3 ]
then
        echo "Local changes made" >&2
        exit 0;
fi

mtn update --branch="$2"
address@hidden:~/tree/config$ ~/bin/update $PWD 
au.com.microcomaustralia.brian.config
mtn: updating along branch 'au.com.microcomaustralia.brian.config'
mtn: already up to date at 8bd00cf9a82b9f0bd52988666cb65e5f950e6854

Hmm. It works, although I am not entirely happy with the check to see
if anything has changed or not in the workspace.

    Timothy> I'm not sure you can, and if you can I'm not sure that
    Timothy> things would work as expected (monotone probably wouldn't
    Timothy> like suddenly finding itself somewhere it didn't think it
    Timothy> was).

Yes, this might be a problem. I saw a lua test case in monotone or
something that used chdir, and thought it might work, but may have
been confused. In any case, such an operation is likely to mess
monotone up.

    Timothy> Really, that'd be a good place for the
    Timothy> --working-directory (should probably actually be
    Timothy> --workspace) parameter you suggested.

Yes. Agreed.
-- 
Brian May <address@hidden>




reply via email to

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