From: batt Date: Mon, 6 Oct 2008 17:38:11 +0000 (+0000) Subject: Add remote merge script. X-Git-Tag: 2.0.0~53 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=1af5118f10f408c8c4278c4ffbd107b19afe1b2c;p=bertos.git Add remote merge script. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1881 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/remote_merge b/bertos/remote_merge new file mode 100755 index 00000000..1c4e869a --- /dev/null +++ b/bertos/remote_merge @@ -0,0 +1,40 @@ +#!/bin/bash +#set -x + +if [ $# -lt 2 ] ; then + printf "\nMerge remote url commits into local BeRTOS svn repository.\n" + printf "Usage: $0 []\n" + printf "If remote end revision is not supplied HEAD will be used.\n" +fi + + +MERGE_URL="$1" +START_REV="$2" +if [ z"$3" = z ] ; then + END_REV=HEAD +else + END_REV="$3" +fi + +#Get list of revisions to merge. +REV_LIST=`svn log $MERGE_URL -r$START_REV:$END_REV --quiet 2>&1| perl -ne 'if(m/^r([0-9]+)/) {print $1, "\n";}'` + +printf "Merged from external project:\n" > header +for rev in $REV_LIST +do + #Get commit log message only + #svn pg --revprop -r$rev svn:log $MERGE_URL > tmp_msg + + #Get revision commit log with date and author + svn log -r$rev $MERGE_URL > tmp_msg + #Replace leading and trailing banners "---------------------..." + sed -i 's/^-\+/\*\*\*\*\*\*\*\*\*\*/' tmp_msg + #Indent all message + sed -i 's/\(^.*\)/\t\1/' tmp_msg + cat header tmp_msg > commit_msg + #Try to merge ... + svn merge $MERGE_URL -c$rev || exit 1 + #and commit! + svn ci -Fcommit_msg +done +rm -rf header tmp_msg commit_msg