diff -r e8c39b3f2a24 doc/ns3_html_theme/get_version.sh --- a/doc/ns3_html_theme/get_version.sh Fri Oct 27 18:47:53 2017 -0700 +++ b/doc/ns3_html_theme/get_version.sh Thu Nov 02 19:37:01 2017 -0700 @@ -138,28 +138,33 @@ # Distance from last tag # Zero distance means we're at the tag -distance=`hg log -r tip --template '{latesttagdistance}'` +if [ -x "$(command -v hg)" ]; then + distance=`hg log -r tip --template '{latesttagdistance}'` -if [ $distance -eq 1 ]; then - version=`hg log -r tip --template '{latesttag}'` - say "at tag $version" + if [ $distance -eq 1 ]; then + version=`hg log -r tip --template '{latesttag}'` + say "at tag $version" -elif [ $tag -eq 1 ]; then - distance=1 - # version previously set - vers_href= + elif [ $tag -eq 1 ]; then + distance=1 + # version previously set + vers_href= + else + version=`hg log -r tip --template '{node|short}'` + # Check for uncommitted changes + hg summary | grep 'commit:' | grep -q '(clean)' + if [ ! $? ] ; then + say "beyond latest tag, last commit: $version, dirty" + dirty="(+)" + else + say "beyond latest tag, last commit: $version, clean" + dirty= + fi + fi else - version=`hg log -r tip --template '{node|short}'` - # Check for uncommitted changes - hg summary | grep 'commit:' | grep -q '(clean)' - if [ ! $? ] ; then - say "beyond latest tag, last commit: $version, dirty" - dirty="(+)" - else - say "beyond latest tag, last commit: $version, clean" - dirty= - fi + version="version-not-found" + say "hg not found; version will not be printed" fi if [ $PUBLIC -eq 1 ]; then @@ -191,7 +196,11 @@ echo "// ns3_version.js: automatically generated" > $outf echo "// private urls" >> $outf echo "var ns3_host = \"file://$PWD/\";" > $outf - echo "var ns3_version = \"$repo @ $version$dirty\";" >> $outf + if [ $version == "version-not-found" ]; then + echo "var ns3_version = \"$repo\";" >> $outf + else + echo "var ns3_version = \"$repo @ $version$dirty\";" >> $outf + fi echo "var ns3_release = \"doc/\";" >> $outf echo "var ns3_local = \"build/\";" >> $outf echo "var ns3_doxy = \"html/\";" >> $outf