From 49966c98bab76173aa93e45f766165a5dd47e62c Mon Sep 17 00:00:00 2001 From: Nicolas Dandrimont <nicolas@dandrimont.eu> Date: Tue, 27 Feb 2018 17:44:51 +0100 Subject: [PATCH] Add "mr pullup" subcommand to pull updates from upstream repos --- .mrconfig | 3 +++ bin/pull-from-upstream | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100755 bin/pull-from-upstream diff --git a/.mrconfig b/.mrconfig index 56f6a92..090d612 100644 --- a/.mrconfig +++ b/.mrconfig @@ -1,3 +1,6 @@ +[DEFAULT] +git_pullup = "$(dirname "$MR_CONFIG")/bin/pull-from-upstream" + [swh-site] checkout = git clone https://forge.softwareheritage.org/source/puppet-swh-site.git swh-site \ && cd swh-site \ diff --git a/bin/pull-from-upstream b/bin/pull-from-upstream new file mode 100755 index 0000000..854b0a6 --- /dev/null +++ b/bin/pull-from-upstream @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +if [ -d .git/refs/remotes/upstream ]; then + git fetch upstream + + oldbranch=$(git rev-parse --abbrev-ref HEAD) + + if [ "$oldbranch" != "master" ]; then + git checkout master + fi + + git merge upstream/master + git push origin master:master --tags + + if [ "$oldbranch" != "master" ]; then + git checkout $oldbranch + fi +fi -- GitLab