84214b70a58b04f05423a029420ff76ef7c6e527
[feisty_meow.git] / scripts / rev_control / push_repo_downstream.sh
1 #!/bin/bash
2
3 # this script works on a specialized type of git checkout that has been configured
4 # to push to a "downstream" repository, while still pulling from its normal origin.
5 # the downstream destination might be a github or sourceforge repository that is
6 # loaded from a personal repository or server.
7 #
8 # it is assumed that you have already added your ssh key to your github account.
9 #
10 # to set up the repository for relaying downstream, just do the normal checkout
11 # or clone on it from the real origin.  for example:
12 #
13 # $ git clone git://feistymeow.org/feisty_meow feisty_relay
14 #
15 # change into that new directory:
16 #
17 # $ pushd feisty_relay
18 #
19 # and then add the downstream remote repository:
20 #
21 # # github example of add:
22 # $ git remote add downstream git@github.com:fredhamster/feisty_meow.git
23 #
24 # # sourceforge example of add:
25 # $ git remote add downstream ssh://fred_t_hamster@git.code.sf.net/p/feistymeow/trunk
26 #
27 # once the repository has been created, you can synch all updates that
28 # have been checked into the origin repository with the downstream version
29 # by running this command:
30 #
31 # push_repo_downstream ~/relay_repo_folder
32
33 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
34 source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh"
35
36 ##############
37
38 dir="$1"; shift
39 if [ -z "$dir" ]; then
40   dir=.
41 fi
42
43 pushd "$dir" &>/dev/null
44 test_or_die "changing to directory: $dir"
45
46 # get everything from the origin.
47 git fetch origin
48 test_or_die "running git fetch origin"
49
50 # turn off occasionally troublesome setting before checkin.
51 unset GIT_SSH
52
53 # send the little boat down the stream to the dependent repository.
54 git push downstream master
55 test_or_die "running the git push downstream"
56
57 popd &>/dev/null
58