12b15cb3dSCy Schubert#! /bin/sh
22b15cb3dSCy Schubert
3*f9b72616SCy Schubert#
4*f9b72616SCy Schubert# checkHtmlFileDates
5*f9b72616SCy Schubert#
6*f9b72616SCy Schubert# This script is invoked in html directory when any html/*.html file
7*f9b72616SCy Schubert# is newer than html/.datecheck to update the last modified time
8*f9b72616SCy Schubert# within the HTML.  Each file is compared against the checked-in
9*f9b72616SCy Schubert# version is compared to any uncommitted edits and if there are
10*f9b72616SCy Schubert# any, scripts/build/updateBEDate is used to update the embedded
11*f9b72616SCy Schubert# timestamp.  html/.datecheck is not distributed in releases so
12*f9b72616SCy Schubert# this will be invoked once building a newly-extracted tarball.
13*f9b72616SCy Schubert# 'bk diff' is used to check for modifications so if bk is not
14*f9b72616SCy Schubert# on the path there's no need to invoke this repeatedly.
15*f9b72616SCy Schubert# Therefore touch .datecheck unconditionally right away.
16*f9b72616SCy Schubert#
17*f9b72616SCy Schuberttouch .datecheck
182b15cb3dSCy Schubert
19*f9b72616SCy Schubert# Do nothing if the directory is not a BK repo,
20*f9b72616SCy Schubert# or if BK is not even installed.
21*f9b72616SCy Schubertbk status > /dev/null 2>&1 || exit 0
22*f9b72616SCy Schubert
23*f9b72616SCy Schubertfor i in `echo *.html`
242b15cb3dSCy Schubertdo
252b15cb3dSCy Schubert    # echo $i
26*f9b72616SCy Schubert    set `bk diff --normal $i | wc -l`
272b15cb3dSCy Schubert    lines=$1
282b15cb3dSCy Schubert    case "$lines" in
292b15cb3dSCy Schubert     0) ;;
302b15cb3dSCy Schubert     *) echo "Processing <$i>"
312b15cb3dSCy Schubert        ../scripts/build/updateBEDate $i
322b15cb3dSCy Schubert	;;
332b15cb3dSCy Schubert    esac
342b15cb3dSCy Schubertdone
35