From: Chris Koeritz Date: Mon, 12 Dec 2016 11:06:01 +0000 (-0500) Subject: rationalizing repository downstream flow control X-Git-Tag: 2.140.90~346 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=8a892026e1b7abee9354a205ded3488580e90b6a;p=feisty_meow.git rationalizing repository downstream flow control --- diff --git a/scripts/rev_control/push_repo_downstream.sh b/scripts/rev_control/push_repo_downstream.sh new file mode 100644 index 00000000..de455a85 --- /dev/null +++ b/scripts/rev_control/push_repo_downstream.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# this script works on a specialized type of git checkout that has been configured +# to push to a "downstream" repository, while still pulling from its normal origin. +# the downstream destination might be a github or sourceforge repository that is +# loaded from a personal repository or server. +# +# to set up the repository for relaying downstream, just do the normal checkout +# or clone on it from the real origin. for example: +# +# $ git clone git://feistymeow.org/feisty_meow +# +# and then add the downstream remote repository: +# +# $ git remote add downstream https://github.com/fredhamster/feisty_meow.git +# +# once the repository has been created, you can synch all updates that +# have been checked into the origin repository with the downstream version +# by running this command: +# +# push_repo_downstream ~/relay_repo_folder + +#hmmm: make this support multiple dirs? + +dir="$1"; shift +if [ -z "$dir" ]; then + dir=. +fi + +pushd "$dir" + +# get everything from the origin. +git pull + +# get everything from the origin. +git pull + +# turn off occasionally troublesome setting before checkin. +unset GIT_SSH + +# send the little boat down the stream to the dependent repository. +git push origin master <"$PASSWORD_FILE" + +popd + + diff --git a/scripts/rev_control/push_repo_upstream.sh b/scripts/rev_control/push_repo_upstream.sh deleted file mode 100644 index a92ed74a..00000000 --- a/scripts/rev_control/push_repo_upstream.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# this script updates a "relay" repository (let us call it B) that is used -# to mirror things from repository A (the source) into another repository C -# (the target). -# this is useful, for example, to maintain one's own master git archive for -# a codebase, but also push updates for that codebase into a sourceforge git -# repository. -# -# rats: how did i set up that archive? -# we need to have those steps someplace. -# the remote config is like this so far: -# -#fred@serene $ git remote -v -#origin ssh://fred_t_hamster@git.code.sf.net/p/feistymeow/trunk (fetch) -#origin ssh://fred_t_hamster@git.code.sf.net/p/feistymeow/trunk (push) -#upstream git@feistymeow.org:feisty_meow (fetch) -#upstream git@feistymeow.org:feisty_meow (push) -# -# so, we've got it hooked together with a named remote called "upstream" that is -# actually our source location, and the target is actually the "origin" remote for -# the repository. - - -dir="$1"; shift -if [ -z "$dir" ]; then - dir=. -fi - -# this file needs to have our sourceforge password in it. -PASSWORD_FILE="$HOME/.secrets/sourceforge_password" - -if [ ! -f "$PASSWORD_FILE" ]; then - echo "This script requires a password stored in the file:" - echo " $PASSWORD_FILE" - exit 1 -fi - -pushd "$dir" -git fetch upstream -git merge upstream/master -unset GIT_SSH -git push origin master <"$PASSWORD_FILE" -popd - -