All,

I know there's probably a billion and one more efficient ways to do this. However, here's a stupidly-simple bash script I tossed together in 5-minutes to keep my master/next branches up-to-snuff across all the new repos. (which I've forked on github and used git remote to label as my origin's).

-----cut-----
#!/bin/bash

BASE="/home/cevich/devel/test"
SUBDIRS="/autotest /autotest/client /autotest/client/tests"

# NFS mount laptop home to desktop home
if [ -d "$HOME/laptop_home" ]
then
    BASE="/home/cevich/laptop_home/devel/test"
fi

noisycmd() {
    echo ">>>>> $1" &> /dev/stdout
    $1
    return $?
}

updateit() {
    cd "$1" && \
    noisycmd "git remote update upstream" && \
    noisycmd "git checkout master" && \
    noisycmd "git pull upstream master" && \
    noisycmd "git push origin master" && \
    noisycmd "git checkout next" && \
    noisycmd "git pull upstream next" && \
    noisycmd "git push origin next"
    return $?
}

RET=0

for subdir in $SUBDIRS
do
    if [ "$RET" -ne "0" ]
    then
        echo "Uh Oh, you screwed something up :P"
        break
    fi
    DIR="${BASE}${subdir}"
    echo ">>>>>>>>>> Updating $DIR"
    updateit "$DIR"
    RET=$?
done

-----cut-----

For more info on how I setup the nested repos., see this thread:
https://www.redhat.com/archives/virt-test-devel/2012-October/msg00005.html

NB: I didn't include the client-tests repo. in that mail, but I'm sure you'll figure out where it fits in.

--
Chris Evich, RHCA, RHCE, RHCDS, RHCSS
Quality Assurance Engineer
e-mail: cevich + `@' + redhat.com o: 1-888-RED-HAT1 x44214

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to