4 # push-pcp -b master -t pcp -r 6bad98e4b0537c2e99b3906ca7a36f4998ea3419..
8 trap "rm -f $tmp.*; exit 0" 0 1 2 3 15
12 echo >&2 "Usage: pcp-push [options]"
15 echo >&2 " -b branch [defaults to master]"
17 echo >&2 " -r range [defaults to \$(cat pushed.sha)..)]"
18 echo >&2 " -s short format, do not include commit messages"
29 range
=$
(cat pushed.sha
)..
33 while getopts "b:nr:s?" c
55 shift `expr $OPTIND - 1`
57 [ $# -eq 0 ] || _usage
61 echo "Error: no range from pushed.sha, so need -r range"
66 unset GIT_EXTERNAL_DIFF
67 pull
=`git config remote.origin.url`
70 *oss.sgi.com
*|
*git.pcp.io
*)
71 # old school ... does not work any more
73 push
=`echo "$pull" | sed -e 's/^git:/ssh:/' -e "s;/git.pcp.io/;/git.pcp.io/oss/git/;"`
83 echo "Sorry, no recipe to handle repo: $pull"
88 echo "Changes committed to $pull $branch" >/tmp
/msg
90 git shortlog
--no-merges --numbered $range >$tmp.tmp
93 cat $tmp.tmp
>>/tmp
/msg
95 echo "Nothing to push ... bye."
99 git log
--no-merges -p $range | diffstat
-p1 >>/tmp
/msg
105 echo "Details ..." >>/tmp
/msg
107 git log
--no-merges $range >>/tmp
/msg
110 xclip
-sel clip
< /tmp
/msg
112 echo "(all of this for email is in /tmp/msg)"
118 echo -n "Push to $pull [y|n|q] (or ctrl+C to abort) "
120 echo -n "Push to $push? [y|n|q] (or ctrl+C to abort) "
135 echo "Quitting ... pushed.sha not updated"
138 echo "Answer the question, bozo!"
143 $GIT push
--tags $push
144 # may have local git mirror that needs to be updated ...
146 if [ -d $HOME/git-mirror
]
152 [ -d "$dir" ] ||
continue
153 [ -f "$dir/config" ] ||
continue
154 if grep "url = $pull" "$dir/config" >/dev
/null
2>&1
156 # found repo with url matching the one we've just pushed to
159 echo "Update local $dir git mirror ..."
171 echo -n "Push to github mirror? [y|n|q] (or ctrl+C to abort) "
185 echo "Quitting ... pushed.sha not updated"
188 echo "Answer the question, bozo!"
192 push
="ssh://git@github.com/performancecopilot/pcp.git"
193 $GIT push
--mirror $push
196 # remember last commit that was pushed ...
198 sha
=`git log | sed -e 's/commit //' -e 1q`
201 echo "+ echo $sha >pushed.sha"
203 echo "$sha" >pushed.sha
207 echo "To send commit mail ..."
208 echo '$ sendcommitmail'