monotone-devel
[Top][All Lists]
Advanced

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

[Monotone-devel] A script to use for propagation that takes care of 'wei


From: Richard Levitte - VMS Whacker
Subject: [Monotone-devel] A script to use for propagation that takes care of 'weird' failures
Date: Tue, 02 Nov 2004 14:49:05 +0100 (CET)

Hi,

Since propagation gets some weird errors when there are rename
certifificates in the history of a branch, I crafted a script that
does the same in a semi-manual fashion, using monotone diff and
patch.  It tentatively (i.e. I haven't tested that particular part)
does the right thing if any files are added, but can't handle file
removal at all.

The script is attached, and has been tested with bash (since Linux
doesn't come with a Bourne shell).  Enjoy, and if you extend it, I'd
be happy to get whatever patches you suggest.

Of course, this till hopefully not be neede for very long, at least of
Graydon's predictions about the changeset change hold :-).

Cheers,
Richard

-----
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.

-- 
Richard Levitte                         address@hidden
                                        http://richard.levitte.org/

"When I became a man I put away childish things, including
 the fear of childishness and the desire to be very grown up."
                                                -- C.S. Lewis
#! /bin/sh -x

DB="$1"
FROM="$2"
TO="$3"
LOG=/tmp/propagate.log.$$
TMPDIR=tmp.co.$$

if [ -z "$DB" -o -z "$FROM" -o -z "$TO" ]; then
    echo "You seem to have forgotten some arguments" >&2
    exit 1
fi

rm -f $LOG; touch $LOG
(monotone --db="$DB" propagate "$FROM" "$TO" 2>&1 || echo "ERROR") \
    | tee -a $LOG
if grep "^ERROR$" $LOG; then
    ANCESTOR_ID="`grep 'common ancestor' $LOG 2>/dev/null | cut -f4 -d' '`"
    FROM_ID="`monotone --db=$DB --branch=$FROM heads 2>/dev/null | tail -1 | 
cut -f1 -d' '`"
    TO_ID="`monotone --db=$DB --branch=$TO heads 2>/dev/null | tail -1 | cut 
-f1 -d' '`"
    monotone --db="$DB" --branch="$TO" co $TMPDIR
    monotone --db="$DB" diff "$ANCESTOR_ID" "$FROM_ID" > $TMPDIR.diff
    (
        cd $TMPDIR
        patch -p0 < ../$TMPDIR.diff
        find . -name '*.rej' | while read F; do emacs "`echo $F | sed -e 
's|\.rej$||'`" "$F"; done
        monotone list unknown | while read F; do
            if echo $F | grep '\.rej$|\.orig$' > /dev/null; then
                :;
            else
                monotone add $F
            fi
        done
        monotone commit "semi-automatic propagate of $FROM_ID and $TO_ID from 
branch '$FROM' to '$TO'"
        NEW_ID="`monotone heads 2>/dev/null | tail -1 | cut -f1 -d' '`"
        monotone cert "$NEW_ID" ancestor "$FROM_ID"
    )
fi

reply via email to

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