hgbook

annotate contrib/hg-package @ 649:d13c7c706a58

Merge with http://hg.serpentine.com/mercurial/book
author Dongsheng Song <dongsheng.song@gmail.com>
date Fri Mar 20 15:40:06 2009 +0800 (2009-03-20)
parents d1a6ed326f87
children 605af0a90e3e
rev   line source
dongsheng@634 1 #!/bin/sh
dongsheng@634 2
dongsheng@634 3 build_dir=`dirname "$0"`/../build
dongsheng@634 4 rev_id=`hg parents --template '{date|shortdate}' | sed 's/-//g'`
dongsheng@634 5
dongsheng@634 6 for l in en zh; do
dongsheng@637 7 (
dongsheng@637 8 if [ ! -d "${build_dir}/${l}" ] ; then
dongsheng@637 9 continue
dongsheng@637 10 fi
dongsheng@637 11
dongsheng@637 12 cd ${build_dir}/${l};
dongsheng@634 13
dongsheng@634 14 f='html'
dongsheng@634 15 if [ -f "${f}/index.html" ] ; then
dongsheng@634 16 d=hgbook-${l}-${f}
dongsheng@634 17 rm -fr ${d} && cp -r ${f} ${d} && tar czf ../${d}-${rev_id}.tar.gz ${d}
dongsheng@634 18 fi
dongsheng@634 19
dongsheng@634 20 f='html-single'
dongsheng@634 21 if [ -f "${f}/hgbook.html" ] ; then
dongsheng@634 22 d=hgbook-${l}-${f}
dongsheng@634 23 rm -fr ${d} && cp -r ${f} ${d} && tar czf ../${d}-${rev_id}.tar.gz ${d}
dongsheng@634 24 fi
dongsheng@634 25
dongsheng@634 26 if [ -f "pdf/hgbook.pdf" ] ; then
dongsheng@634 27 cp pdf/hgbook.pdf ../hgbook-${l}-${rev_id}.pdf
dongsheng@634 28 gzip -f9 ../hgbook-${l}-${rev_id}.pdf
dongsheng@634 29 fi
dongsheng@634 30 )
dongsheng@634 31 done
dongsheng@634 32
dongsheng@634 33 upload_pass=$1
dongsheng@634 34 upload_user=$2
dongsheng@634 35
dongsheng@634 36 if [ "${upload_user}x" == "x" ]; then
dongsheng@634 37 upload_user="dongsheng.song"
dongsheng@634 38 fi
dongsheng@634 39
dongsheng@634 40 if [ "${upload_pass}x" != "x" ]; then
dongsheng@634 41 (
dongsheng@634 42 cd ${build_dir}
dongsheng@637 43 curl -s -O http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py
dongsheng@637 44 if [[ "0" != $? ]]; then
dongsheng@637 45 exit 1
dongsheng@637 46 fi
dongsheng@634 47
dongsheng@634 48 for l in en zh; do
dongsheng@637 49 if [ -f "hgbook-${l}-${rev_id}.pdf.gz" ] ; then
dongsheng@637 50 python googlecode_upload.py -u "dongsheng.song" -w "$1" \
dongsheng@637 51 -p "i18n-zh" -l "Type-Docs,hgbook" \
dongsheng@637 52 -s "Distributed revision control with Mercurial - ${l} - pdf" \
dongsheng@637 53 hgbook-${l}-${rev_id}.pdf.gz
dongsheng@637 54 fi
dongsheng@634 55
dongsheng@634 56 for f in html html-single; do
dongsheng@637 57 if [ -f "hgbook-${l}-${rev_id}.pdf.gz" ] ; then
dongsheng@637 58 python googlecode_upload.py -u "dongsheng.song" -w "$1" \
dongsheng@637 59 -p "i18n-zh" -l "Type-Docs,hgbook" \
dongsheng@637 60 -s "Distributed revision control with Mercurial - ${l} - ${f}" \
dongsheng@637 61 hgbook-${l}-${f}-${rev_id}.tar.gz
dongsheng@637 62 fi
dongsheng@634 63 done
dongsheng@634 64 done
dongsheng@634 65 )
dongsheng@634 66 fi