From ed78ccc9c6d01422d6366c593ffa01e8c8ff5a68 Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Sat, 28 Jan 2017 15:36:09 -0700 Subject: [PATCH] add script to automate importing upstream --- maint/import_upstream.sh | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 maint/import_upstream.sh diff --git a/maint/import_upstream.sh b/maint/import_upstream.sh new file mode 100755 index 0000000..f591813 --- /dev/null +++ b/maint/import_upstream.sh @@ -0,0 +1,64 @@ +#!/bin/sh + +: <<'=cut' +=pod + +=head1 NAME + +import_upstream.sh - Import HomeBank from upstream + +=head1 SYNOPSIS + + ./maint/import_upstream.sh BRANCH + + # import the latest release on the 5.1.x branch + ./maint/import_upstream.sh 5.1.x + +=head1 DESCRIPTION + +This script downloads the latest HomeBank release on a given branch and adds +that release to the local C branch. + +=cut + +export GIT_AUTHOR_NAME='Maxime Doyen' +export GIT_AUTHOR_EMAIL='homebank@free.fr' + +branch_git='upstream' +branch_bzr=$1 +shift + +if [ -z "$branch_bzr" ] +then + echo >&2 "$0: Must specify homebank branch (e.g. \"5.1.x\")" + exit 1 +fi + +set -e + +# download homebank +cleanup='rm -rf "$branch_bzr"' +eval "$cleanup" +trap "$cleanup" EXIT +bzr branch "lp:homebank/$branch_bzr" "$branch_bzr" + +# determine version +hb_version=$(perl <"$branch_bzr/src/homebank.h" -ne 's/#define HB_VERSION\s+"(.*)"/$1/ && print') +if [ -z "$hb_version" ] +then + echo >&2 "$0: Cannot determine homebank version" + exit 1 +fi + +cp .gitignore "$branch_bzr/" + +# commit new version of homebank +git add "$branch_bzr" +tree_ref=$(git write-tree --prefix="$branch_bzr/") +git reset "$branch_bzr" +parent_ref=$(git rev-parse "$branch_git") +commit_ref=$(git commit-tree -m "import homebank-$hb_version" -p $parent_ref $tree_ref) + +# update branch +git branch -f "$branch_git" $commit_ref + -- 2.45.2