From ba206da012d6690bd985bf27949abae504472d59 Mon Sep 17 00:00:00 2001 From: Davis King Date: Sun, 3 Mar 2019 11:10:07 -0500 Subject: [PATCH] Switched doc making scripts to pull info from git instead of hg. --- .gitignore | 8 ++++++++ docs/.logger_revnum | 2 +- docs/bash_helper_functions | 31 +++++++++++++++++++++++++------ docs/docs/change_log.xml | 6 +----- docs/docs/dlib.css | 8 ++++++++ docs/docs/old_change_log.xml | 7 ------- docs/docs/stylesheet.xsl | 3 ++- docs/makedocs | 32 ++++++++++---------------------- docs/makerel | 10 +++++----- docs/testenv | 2 +- 10 files changed, 61 insertions(+), 48 deletions(-) delete mode 100644 docs/docs/old_change_log.xml diff --git a/.gitignore b/.gitignore index 235fff575..1701e0227 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,15 @@ *.swp *.o *.so +*.pyc build dist *.egg-info/ +docs/release/ +docs/docs/web/ +docs/docs/chm/ +docs/docs/cache/ +docs/docs/git-logs.xml +docs/docs/python/classes.txt +docs/docs/python/functions.txt diff --git a/docs/.logger_revnum b/docs/.logger_revnum index 4900ceab9..54d52b124 100644 --- a/docs/.logger_revnum +++ b/docs/.logger_revnum @@ -1 +1 @@ -192f7235a850 +a6ac55ad400689289164ea2aba89ea3c26012b19 diff --git a/docs/bash_helper_functions b/docs/bash_helper_functions index 66603e6d2..c204a69f4 100755 --- a/docs/bash_helper_functions +++ b/docs/bash_helper_functions @@ -3,14 +3,12 @@ # This script defines some helper functions used by other scripts in the docs # folder. -get_short_revision_number() -{ - RESULT=`hg log -r $1 | grep changeset | awk '{print $2}' | sed -e 's/:.*//'` -} +# Get the time the given filename was last modified. get_last_modified_date() { - RESULT=`hg log $1 -l1 --template '{date|date}\n' | awk '{ print $2" "$3", " $5}'` + local filename=$1 + RESULT=`git log -1 --format="%ad" --date=format:'%b %d, %Y' -- $filename` } get_dlib_version() @@ -18,8 +16,29 @@ get_dlib_version() cat ../dlib/CMakeLists.txt | awk '/set\(CPACK_PACKAGE_VERSION_'$1'/{ match($2,"\"(.*)\"",a); print a[1]}' } +# Dump a copy of the repo contents to $1 +dump_repo_to() +{ + mkdir -p $1 + git archive HEAD `git rev-parse --show-toplevel` | tar -xC $1 +} -# call like: set_dlib_version MAJOR 42 +# Call like git_logs_as_xml HEAD~4..HEAD out.xml to write the logs in that range to out.xml +git_logs_as_xml() +{ + local logrange=$1 + local outfile=$2 + + # What paths to include in the logs + local paths="../dlib ../examples ../tools ../python_examples" + + (echo ""; git log --stat=80 --date=iso-strict --pretty=format:"%n%n%an%n%ad%n%s%n%n" $logrange $paths | tail -n+2 ; echo; echo '' ; echo "" ) > $outfile + + # trim whitespace at start and end of tags. + sed -e ':a' -e 'N' -e '$!ba' -e "s/[ \n]*/ /g" -e "s/[ \n]*<\/files_changed>/<\/files_changed>/g" -i $outfile +} + +# call like: set_dlib_version MAJOR 42 to set MAJOR version to 42. set_dlib_version() { sed -i -e 's/\(set(CPACK_PACKAGE_VERSION_'$1' *"\).*\(".*\)/\1'$2'\2/' ../dlib/CMakeLists.txt diff --git a/docs/docs/change_log.xml b/docs/docs/change_log.xml index 6088c869e..3d6453fd6 100644 --- a/docs/docs/change_log.xml +++ b/docs/docs/change_log.xml @@ -3,9 +3,5 @@ Change Log - -
-
Old Change Logs
-
- +
diff --git a/docs/docs/dlib.css b/docs/docs/dlib.css index e7e9fb45c..a14a8852e 100644 --- a/docs/docs/dlib.css +++ b/docs/docs/dlib.css @@ -266,6 +266,14 @@ video border-bottom: black solid 2px; } +.files_changed +{ + color: black; + margin: 1em 0.15in; + padding: 0.5em; + background: rgb(246,246,255); +} + tt { padding: 0.3em; diff --git a/docs/docs/old_change_log.xml b/docs/docs/old_change_log.xml deleted file mode 100644 index bddb0b479..000000000 --- a/docs/docs/old_change_log.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - Old Change Logs - - diff --git a/docs/docs/stylesheet.xsl b/docs/docs/stylesheet.xsl index 19338feaa..ea9a78eff 100644 --- a/docs/docs/stylesheet.xsl +++ b/docs/docs/stylesheet.xsl @@ -950,11 +950,12 @@ - Revision:
+ Revision:
Author:
Date:
+

diff --git a/docs/makedocs b/docs/makedocs index 649a62b01..e4a384ee7 100755 --- a/docs/makedocs +++ b/docs/makedocs @@ -81,22 +81,12 @@ makedocs () - # figure out the short number that identifies this particular changeset - get_short_revision_number `cat $REVNUM_FILE` - LOGGER_REVNUM=$RESULT + LOGGER_REVNUM=`cat $REVNUM_FILE` XSLT_OPTIONS="--nodtdattr --nonet --novalid" DATE_TODAY=`date --date= "+%b %d, %Y"`; - - - # The revision number we are currently at - CHANGESET_ID=`hg id -i | sed -e 's/\+//'` - get_short_revision_number $CHANGESET_ID - REVISION=$RESULT - - if [ "$1" = "makerel" ] then RELEASE=${MAJOR_NUM}.${MINOR_NUM} @@ -105,25 +95,24 @@ makedocs () fi; # get XML versions of the change logs - BASE_LOGGER_REVNUM=`echo $LOGGER_REVNUM - 1000 | bc` - NEXT_LOGGER_REVNUM=`echo $LOGGER_REVNUM + 1 | bc` - echo Getting the mercurial change logs for revisions $NEXT_LOGGER_REVNUM:$REVISION - hg log -v ../dlib ../examples ../tools ../python_examples --style=xml -r$NEXT_LOGGER_REVNUM:$REVISION > docs/log.txt || report_failure - echo Getting the mercurial change logs for revisions $BASE_LOGGER_REVNUM:$LOGGER_REVNUM - hg log -v ../dlib ../examples ../tools ../python_examples --style=xml -r$BASE_LOGGER_REVNUM:$LOGGER_REVNUM > docs/old_log.txt || report_failure + echo Getting the git change logs for $LOGGER_REVNUM..HEAD + git_logs_as_xml $LOGGER_REVNUM..HEAD docs/git-logs.xml || report_failure # grab a clean copy of the repository rm -rf docs/cache rm -rf docs/web rm -rf docs/chm/docs - hg archive docs/cache || report_failure - # Don't need the docs folder in the cache, moreover, deleting it here avoids letting the makerel script include it in the dlib tar balls. + cd .. + mkdir -p docs/docs/cache + git archive HEAD | tar -xC docs/docs/cache + cd docs rm -rf docs/cache/docs + CHANGESET_ID=`git log -1 --pretty=format:%H` echo "#ifndef DLIB_REVISION_H" > docs/cache/dlib/revision.h echo "// Version: " $RELEASE >> docs/cache/dlib/revision.h echo "// Date: " `date` >> docs/cache/dlib/revision.h - echo "// Mercurial Revision ID: " $CHANGESET_ID >> docs/cache/dlib/revision.h + echo "// Git Changeset ID: " $CHANGESET_ID >> docs/cache/dlib/revision.h echo "#define DLIB_MAJOR_VERSION " $MAJOR_NUM >> docs/cache/dlib/revision.h echo "#define DLIB_MINOR_VERSION " $MINOR_NUM >> docs/cache/dlib/revision.h echo "#define DLIB_PATCH_VERSION " $PATCH_NUM >> docs/cache/dlib/revision.h @@ -226,8 +215,7 @@ makedocs () # The last modified date for these files should always be the release date (regardless of when the actual xml files were modified). if [ "${i}" = "docs/release_notes.xml" -o ${i} = "docs/old_release_notes.xml" \ - -o ${i} = "docs/change_log.xml" -o ${i} = "docs/old_change_log.xml" \ - -o ${i} = "docs/index.xml" ] + -o ${i} = "docs/change_log.xml" -o ${i} = "docs/index.xml" ] then DATE=$DATE_TODAY else diff --git a/docs/makerel b/docs/makerel index 8a4d2d397..e65e0e14f 100755 --- a/docs/makerel +++ b/docs/makerel @@ -16,7 +16,7 @@ report_failure () REVNUM_FILE=.logger_revnum -CHANGESET_ID=`hg id -i | sed -e 's/\+//'` +CHANGESET_ID=`git rev-parse HEAD` rm -rf release || report_failure mkdir release || report_failure @@ -35,15 +35,15 @@ set_dlib_version PATCH 0 RELEASE=${MAJOR_NUM}.${MINOR_NUM} # Commit changes to the version numbers so that the makedocs script will use them. -echo Create Mercurial tags and commit release -hg commit -m "Created release v$RELEASE" || report_failure -hg tag v$RELEASE || report_failure +echo Create git tags and commit release +git commit -a -m "Created release v$RELEASE" || report_failure +git tag v$RELEASE || report_failure ./makedocs makerel || exit 1 echo $CHANGESET_ID > $REVNUM_FILE set_dlib_version PATCH 99 -hg commit -m "Record last changeset and set PATCH version to 99" +git commit -a -m "Record last changeset and set PATCH version to 99" cd release || report_failure diff --git a/docs/testenv b/docs/testenv index 8d2ce6bc9..15b24d4e8 100755 --- a/docs/testenv +++ b/docs/testenv @@ -17,7 +17,7 @@ echo nothing | awk '{}' > /dev/null || return_error "awk"; echo | sed -e "s/s/r/" > /dev/null || return_error "sed"; htmlify > /dev/null || return_error "htmlify"; echo | xargs > /dev/null || return_error "xargs"; -hg > /dev/null || return_error "hg"; +git --version > /dev/null || return_error "git"; xsltproc -V > /dev/null || return_error "xsltproc"; tar --help > /dev/null || return_error "tar"; zip -h > /dev/null || return_error "zip";