added more info about how repo was constructed. probably via remote add.
[feisty_meow.git] / scripts / rev_control / push_repo_upstream.sh
1 #!/bin/bash
2
3 # this script updates a "relay" repository (let us call it B) that is used
4 # to mirror things from repository A (the source) into another repository C
5 # (the target).
6 # this is useful, for example, to maintain one's own master git archive for
7 # a codebase, but also push updates for that codebase into a sourceforge git
8 # repository.
9 #
10 # rats: how did i set up that archive?
11 #       we need to have those steps someplace.
12 # the remote config is like this so far:
13 #
14 #fred@serene $ git remote -v
15 #origin ssh://fred_t_hamster@git.code.sf.net/p/feistymeow/trunk (fetch)
16 #origin ssh://fred_t_hamster@git.code.sf.net/p/feistymeow/trunk (push)
17 #upstream       git@feistymeow.org:feisty_meow (fetch)
18 #upstream       git@feistymeow.org:feisty_meow (push)
19 #
20 # so, we've got it hooked together with a named remote called "upstream" that is
21 # actually our source location, and the target is actually the "origin" remote for
22 # the repository.
23
24
25 dir="$1"; shift
26 if [ -z "$dir" ]; then
27   dir=.
28 fi
29
30 # this file needs to have our sourceforge password in it.
31 PASSWORD_FILE="$HOME/.secrets/sourceforge_password"
32
33 if [ ! -f "$PASSWORD_FILE" ]; then
34   echo "This script requires a password stored in the file:"
35   echo "  $PASSWORD_FILE"
36   exit 1
37 fi
38
39 pushd "$dir"
40 git fetch upstream
41 git merge upstream/master
42 unset GIT_SSH
43 git push origin master <"$PASSWORD_FILE"
44 popd
45
46