dongsheng@634: #!/bin/sh dongsheng@634: dongsheng@634: build_dir=`dirname "$0"`/../build dongsheng@634: rev_id=`hg parents --template '{date|shortdate}' | sed 's/-//g'` dongsheng@634: dongsheng@634: for l in en zh; do dongsheng@637: ( dongsheng@637: if [ ! -d "${build_dir}/${l}" ] ; then dongsheng@637: continue dongsheng@637: fi dongsheng@637: dongsheng@637: cd ${build_dir}/${l}; dongsheng@634: dongsheng@634: f='html' dongsheng@634: if [ -f "${f}/index.html" ] ; then dongsheng@634: d=hgbook-${l}-${f} dongsheng@634: rm -fr ${d} && cp -r ${f} ${d} && tar czf ../${d}-${rev_id}.tar.gz ${d} dongsheng@634: fi dongsheng@634: dongsheng@634: f='html-single' dongsheng@634: if [ -f "${f}/hgbook.html" ] ; then dongsheng@634: d=hgbook-${l}-${f} dongsheng@634: rm -fr ${d} && cp -r ${f} ${d} && tar czf ../${d}-${rev_id}.tar.gz ${d} dongsheng@634: fi dongsheng@634: dongsheng@634: if [ -f "pdf/hgbook.pdf" ] ; then dongsheng@634: cp pdf/hgbook.pdf ../hgbook-${l}-${rev_id}.pdf dongsheng@634: gzip -f9 ../hgbook-${l}-${rev_id}.pdf dongsheng@634: fi dongsheng@634: ) dongsheng@634: done dongsheng@634: dongsheng@634: upload_pass=$1 dongsheng@634: upload_user=$2 dongsheng@634: dongsheng@634: if [ "${upload_user}x" == "x" ]; then dongsheng@634: upload_user="dongsheng.song" dongsheng@634: fi dongsheng@634: dongsheng@634: if [ "${upload_pass}x" != "x" ]; then dongsheng@634: ( dongsheng@634: cd ${build_dir} dongsheng@637: curl -s -O http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py dongsheng@637: if [[ "0" != $? ]]; then dongsheng@637: exit 1 dongsheng@637: fi dongsheng@634: dongsheng@634: for l in en zh; do dongsheng@637: if [ -f "hgbook-${l}-${rev_id}.pdf.gz" ] ; then dongsheng@637: python googlecode_upload.py -u "dongsheng.song" -w "$1" \ dongsheng@637: -p "i18n-zh" -l "Type-Docs,hgbook" \ dongsheng@637: -s "Distributed revision control with Mercurial - ${l} - pdf" \ dongsheng@637: hgbook-${l}-${rev_id}.pdf.gz dongsheng@637: fi dongsheng@634: dongsheng@634: for f in html html-single; do dongsheng@637: if [ -f "hgbook-${l}-${rev_id}.pdf.gz" ] ; then dongsheng@637: python googlecode_upload.py -u "dongsheng.song" -w "$1" \ dongsheng@637: -p "i18n-zh" -l "Type-Docs,hgbook" \ dongsheng@637: -s "Distributed revision control with Mercurial - ${l} - ${f}" \ dongsheng@637: hgbook-${l}-${f}-${rev_id}.tar.gz dongsheng@637: fi dongsheng@634: done dongsheng@634: done dongsheng@634: ) dongsheng@634: fi