Switched doc making scripts to pull info from git instead of hg.

This commit is contained in:
Davis King 2019-03-03 11:10:07 -05:00
parent 70f9a9f11f
commit ba206da012
10 changed files with 61 additions and 48 deletions

8
.gitignore vendored
View File

@ -3,7 +3,15 @@
*.swp *.swp
*.o *.o
*.so *.so
*.pyc
build build
dist dist
*.egg-info/ *.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

View File

@ -1 +1 @@
192f7235a850 a6ac55ad400689289164ea2aba89ea3c26012b19

View File

@ -3,14 +3,12 @@
# This script defines some helper functions used by other scripts in the docs # This script defines some helper functions used by other scripts in the docs
# folder. # 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() 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() 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]}' 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 "<log>"; git log --stat=80 --date=iso-strict --pretty=format:"</files_changed></logentry>%n<logentry revision=\"%H\">%n<author email=\"%ae\">%an</author>%n<date>%ad</date>%n<msg>%s</msg>%n<files_changed>%n" $logrange $paths | tail -n+2 ; echo; echo '</files_changed></logentry>' ; echo "</log>" ) > $outfile
# trim whitespace at start and end of <files_changed> tags.
sed -e ':a' -e 'N' -e '$!ba' -e "s/<files_changed>[ \n]*/<files_changed> /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() set_dlib_version()
{ {
sed -i -e 's/\(set(CPACK_PACKAGE_VERSION_'$1' *"\).*\(".*\)/\1'$2'\2/' ../dlib/CMakeLists.txt sed -i -e 's/\(set(CPACK_PACKAGE_VERSION_'$1' *"\).*\(".*\)/\1'$2'\2/' ../dlib/CMakeLists.txt

View File

@ -3,9 +3,5 @@
<doc> <doc>
<title>Change Log</title> <title>Change Log</title>
<body from_file="log.txt"> <body from_file="git-logs.xml"/>
<br/>
<center><a href="old_change_log.html">Old Change Logs</a></center>
<br/>
</body>
</doc> </doc>

View File

@ -266,6 +266,14 @@ video
border-bottom: black solid 2px; border-bottom: black solid 2px;
} }
.files_changed
{
color: black;
margin: 1em 0.15in;
padding: 0.5em;
background: rgb(246,246,255);
}
tt tt
{ {
padding: 0.3em; padding: 0.3em;

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="stylesheet.xsl"?>
<doc>
<title>Old Change Logs</title>
<body from_file="old_log.txt"/>
</doc>

View File

@ -950,11 +950,12 @@
<xsl:template match="log"> <xsl:template match="log">
<xsl:for-each select="logentry"> <xsl:for-each select="logentry">
<xsl:sort order="descending" data-type="number" select="./@revision"/> <xsl:sort order="descending" data-type="number" select="./@revision"/>
<u>Revision</u>: <xsl:value-of select="substring(@node,1,16)"/> <br/> <u>Revision</u>: <xsl:value-of select="substring(@revision,1,20)"/> <br/>
<u>Author</u>: <a href="mailto:{author/@email}"><xsl:value-of select="author"/></a> <br/> <u>Author</u>: <a href="mailto:{author/@email}"><xsl:value-of select="author"/></a> <br/>
<u>Date</u>: <xsl:call-template name="format-date"><xsl:with-param name="xsd-date" select="date"/></xsl:call-template> <br/> <u>Date</u>: <xsl:call-template name="format-date"><xsl:with-param name="xsd-date" select="date"/></xsl:call-template> <br/>
<xsl:apply-templates select="msg"/> <xsl:apply-templates select="msg"/>
<xsl:apply-templates select="paths"/> <xsl:apply-templates select="paths"/>
<pre class="files_changed"><xsl:value-of select="files_changed"/></pre>
<hr class="fullhr"/> <hr class="fullhr"/>
</xsl:for-each> </xsl:for-each>
</xsl:template> </xsl:template>

View File

@ -81,22 +81,12 @@ makedocs ()
# figure out the short number that identifies this particular changeset LOGGER_REVNUM=`cat $REVNUM_FILE`
get_short_revision_number `cat $REVNUM_FILE`
LOGGER_REVNUM=$RESULT
XSLT_OPTIONS="--nodtdattr --nonet --novalid" XSLT_OPTIONS="--nodtdattr --nonet --novalid"
DATE_TODAY=`date --date= "+%b %d, %Y"`; 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" ] if [ "$1" = "makerel" ]
then then
RELEASE=${MAJOR_NUM}.${MINOR_NUM} RELEASE=${MAJOR_NUM}.${MINOR_NUM}
@ -105,25 +95,24 @@ makedocs ()
fi; fi;
# get XML versions of the change logs # get XML versions of the change logs
BASE_LOGGER_REVNUM=`echo $LOGGER_REVNUM - 1000 | bc` echo Getting the git change logs for $LOGGER_REVNUM..HEAD
NEXT_LOGGER_REVNUM=`echo $LOGGER_REVNUM + 1 | bc` git_logs_as_xml $LOGGER_REVNUM..HEAD docs/git-logs.xml || report_failure
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
# grab a clean copy of the repository # grab a clean copy of the repository
rm -rf docs/cache rm -rf docs/cache
rm -rf docs/web rm -rf docs/web
rm -rf docs/chm/docs rm -rf docs/chm/docs
hg archive docs/cache || report_failure cd ..
# 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. mkdir -p docs/docs/cache
git archive HEAD | tar -xC docs/docs/cache
cd docs
rm -rf docs/cache/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 "#ifndef DLIB_REVISION_H" > docs/cache/dlib/revision.h
echo "// Version: " $RELEASE >> docs/cache/dlib/revision.h echo "// Version: " $RELEASE >> docs/cache/dlib/revision.h
echo "// Date: " `date` >> 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_MAJOR_VERSION " $MAJOR_NUM >> docs/cache/dlib/revision.h
echo "#define DLIB_MINOR_VERSION " $MINOR_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 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). # 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" \ 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/change_log.xml" -o ${i} = "docs/index.xml" ]
-o ${i} = "docs/index.xml" ]
then then
DATE=$DATE_TODAY DATE=$DATE_TODAY
else else

View File

@ -16,7 +16,7 @@ report_failure ()
REVNUM_FILE=.logger_revnum REVNUM_FILE=.logger_revnum
CHANGESET_ID=`hg id -i | sed -e 's/\+//'` CHANGESET_ID=`git rev-parse HEAD`
rm -rf release || report_failure rm -rf release || report_failure
mkdir release || report_failure mkdir release || report_failure
@ -35,15 +35,15 @@ set_dlib_version PATCH 0
RELEASE=${MAJOR_NUM}.${MINOR_NUM} RELEASE=${MAJOR_NUM}.${MINOR_NUM}
# Commit changes to the version numbers so that the makedocs script will use them. # Commit changes to the version numbers so that the makedocs script will use them.
echo Create Mercurial tags and commit release echo Create git tags and commit release
hg commit -m "Created release v$RELEASE" || report_failure git commit -a -m "Created release v$RELEASE" || report_failure
hg tag v$RELEASE || report_failure git tag v$RELEASE || report_failure
./makedocs makerel || exit 1 ./makedocs makerel || exit 1
echo $CHANGESET_ID > $REVNUM_FILE echo $CHANGESET_ID > $REVNUM_FILE
set_dlib_version PATCH 99 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 cd release || report_failure

View File

@ -17,7 +17,7 @@ echo nothing | awk '{}' > /dev/null || return_error "awk";
echo | sed -e "s/s/r/" > /dev/null || return_error "sed"; echo | sed -e "s/s/r/" > /dev/null || return_error "sed";
htmlify > /dev/null || return_error "htmlify"; htmlify > /dev/null || return_error "htmlify";
echo | xargs > /dev/null || return_error "xargs"; 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"; xsltproc -V > /dev/null || return_error "xsltproc";
tar --help > /dev/null || return_error "tar"; tar --help > /dev/null || return_error "tar";
zip -h > /dev/null || return_error "zip"; zip -h > /dev/null || return_error "zip";