Updated the documentation generation tools to work with Mercurial

rather than Subversion.
This commit is contained in:
Davis King 2011-05-15 17:46:16 -04:00
parent de1f4677a6
commit 3fcf5e5aa7
9 changed files with 52 additions and 44 deletions

View File

@ -2,3 +2,8 @@
\.swp$ \.swp$
\.o$ \.o$
\.obj$ \.obj$
^docs/docs/web/
^docs/docs/chm/
^docs/docs/log.txt$
^docs/docs/old_log.txt$

View File

@ -1 +1 @@
4256 b4566fa0b468

View File

@ -2,8 +2,8 @@ This "package" is just a copy of the stuff I use to generate the documentation
for the dlib library. It contains a copy of the XSLT and XML I use to for the dlib library. It contains a copy of the XSLT and XML I use to
generate the HTML documentation. generate the HTML documentation.
The current version of these files can be obtained from the dlib subversion The current version of these files can be obtained from the dlib Mercurial
repository at: https://dclib.svn.sourceforge.net/svnroot/dclib/trunk/docs repository at: http://dclib.hg.sourceforge.net:8000/hgroot/dclib/dclib
======================== Overview ======================== ======================== Overview ========================

View File

@ -3,7 +3,7 @@
<doc> <doc>
<title>Change Log</title> <title>Change Log</title>
<body from_file="svnlog.txt"> <body from_file="log.txt">
<br/> <br/>
<center><a href="old_change_log.html">Old Change Logs</a></center> <center><a href="old_change_log.html">Old Change Logs</a></center>
<br/> <br/>

View File

@ -44,9 +44,8 @@
</p> </p>
<p> <p>
Finally, note that <a href="dlib/revision.h.html">dlib/revision.h</a> defines DLIB_REVISION Finally, note that <a href="dlib/revision.h.html">dlib/revision.h</a> defines DLIB_MAJOR_VERSION
which is a #define you can use to see what version of dlib you have. The number in this file and DLIB_MINOR_VERSION which are #defines you can use to see what version of dlib you have.
is the subversion revision number associated with the particular copy of dlib you have.
</p> </p>
<center><h1>Preprocessor Directives</h1></center> <center><h1>Preprocessor Directives</h1></center>

View File

@ -3,5 +3,5 @@
<doc> <doc>
<title>Old Change Logs</title> <title>Old Change Logs</title>
<body from_file="old_svnlog.txt"/> <body from_file="old_log.txt"/>
</doc> </doc>

View File

@ -14,10 +14,13 @@
New Stuff: New Stuff:
Non-Backwards Compatible Changes: Non-Backwards Compatible Changes:
- Removed the DLIB_REVISION macro and replaced it with DLIB_MAJOR_VERSION and
DLIB_MINOR_VERSION.
Bug fixes: Bug fixes:
Other: Other:
- dlib's version control system has switched from Subversion to Mercurial.
</current> </current>

View File

@ -900,7 +900,7 @@
<xsl:template name="format-date"> <xsl:template name="format-date">
<xsl:param name="xsd-date"/> <xsl:param name="xsd-date"/>
<xsl:variable name="date" select="substring-before($xsd-date,'T')"/> <xsl:variable name="date" select="substring-before($xsd-date,'T')"/>
<xsl:variable name="time" select="substring-before(substring-after($xsd-date,'T'),'.')"/> <xsl:variable name="time" select="substring-after($xsd-date,'T')"/>
<xsl:variable name="year" select="substring($date,1,4)"/> <xsl:variable name="year" select="substring($date,1,4)"/>
<xsl:variable name="month" select="substring($date,6,2)"/> <xsl:variable name="month" select="substring($date,6,2)"/>
@ -945,7 +945,7 @@
<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="@revision"/> <br/> <u>Revision</u>: <xsl:value-of select="substring(@node,1,12)"/> <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"/>

View File

@ -27,33 +27,34 @@ htmlify_cmake ()
echo "</pre></body></html>" >> $1; echo "</pre></body></html>" >> $1;
} }
get_short_revision_number()
{
RESULT=`hg log -r $1 | grep changeset | awk '{print $2}' | sed -e 's/:.*//'`
}
makedocs () makedocs ()
{ {
#make sure the .docs_last_update_rev file exists
if [ ! -f .docs_last_update_rev ]
then
echo 0 > .docs_last_update_rev
fi;
COUNTER_FILE=.current_release_number COUNTER_FILE=.current_release_number
MINOR_COUTNER_FILE=.current_minor_release_number MINOR_COUTNER_FILE=.current_minor_release_number
REVNUM_FILE=.logger_revnum REVNUM_FILE=.logger_revnum
DOCS_LAST_UPDATE_REV=$(cat .docs_last_update_rev)
LOGGER_REVNUM=`cat $REVNUM_FILE` # figure out the short number that identifies this particular changeset
get_short_revision_number `cat $REVNUM_FILE`
LOGGER_REVNUM=$RESULT
XSLT_OPTIONS="--nodtdattr --nonet --novalid" XSLT_OPTIONS="--nodtdattr --nonet --novalid"
DATE=`date --date= "+%b %d, %Y"`; DATE=`date --date= "+%b %d, %Y"`;
# root dlib repository URL
DLIB_REPOS=`svn info | grep URL | awk '{print $2}' | sed -e 's/\/docs$//' `
# The revision number we are currently at # The revision number we are currently at
REVISION=`svn info | grep Revision | awk '{ print $2 }'` CHANGESET_ID=`hg id -i | sed -e 's/\+//'`
get_short_revision_number $CHANGESET_ID
REVISION=$RESULT
if [ "$1" = "snapshot" ] if [ "$1" = "snapshot" ]
@ -65,36 +66,37 @@ makedocs ()
RELEASE=${MAJOR_NUM}.${MINOR_NUM} RELEASE=${MAJOR_NUM}.${MINOR_NUM}
fi; fi;
# get XML versions of the change logs
BASE_LOGGER_REVNUM=`echo $LOGGER_REVNUM - 1000 | bc`
echo Getting the mercurial change logs for revisions $LOGGER_REVNUM:$REVISION
hg log ../dlib --style=xml -r$LOGGER_REVNUM:$REVISION > docs/log.txt || report_failure
echo Getting the mercurial change logs for revisions $BASE_LOGGER_REVNUM:$LOGGER_REVNUM
hg log ../dlib --style=xml -r$BASE_LOGGER_REVNUM:$LOGGER_REVNUM > docs/old_log.txt || report_failure
# update the cache of the library files from subversion if they aren't from the current revision # grab a clean copy of the repository
if [ $DOCS_LAST_UPDATE_REV -ne $REVISION ] rm -rf docs/cache
then rm -rf cache.$$
BASE_LOGGER_REVNUM=`echo $LOGGER_REVNUM - 1000 | bc` hg clone .. cache.$$ > /dev/null || report_failure
echo Getting the subversion change logs for $DLIB_REPOS/dlib $LOGGER_REVNUM:$REVISION # put the stuff we need into the docs/cache folder
svn log $DLIB_REPOS/dlib -v --xml -r$LOGGER_REVNUM:$REVISION > docs/svnlog.txt || report_failure mkdir docs/cache
echo Getting the subversion change logs for $DLIB_REPOS/dlib $BASE_LOGGER_REVNUM:$LOGGER_REVNUM mv cache.$$/dlib docs/cache/
svn log $DLIB_REPOS/dlib -v --xml -r$BASE_LOGGER_REVNUM:$LOGGER_REVNUM > docs/old_svnlog.txt || report_failure mv cache.$$/examples docs/cache/
rm -rf cache.$$
rm -rf docs/cache
echo $REVISION > .docs_last_update_rev
echo Getting a copy of the source from subversion
svn export -r $REVISION $DLIB_REPOS/examples docs/cache/examples > /dev/null || report_failure
svn export -r $REVISION $DLIB_REPOS/dlib docs/cache/dlib > /dev/null || report_failure
fi;
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 "// Subversion Revision Number" >> docs/cache/dlib/revision.h echo "// Mercurial Revision ID: " $CHANGESET_ID >> docs/cache/dlib/revision.h
echo "#define DLIB_REVISION " $REVISION >> 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 "#endif" >> docs/cache/dlib/revision.h echo "#endif" >> docs/cache/dlib/revision.h
rm -rf docs/web/* rm -rf docs/web
rm -rf docs/chm/docs/* rm -rf docs/chm/docs
mkdir docs/web
mkdir docs/chm/docs
echo Creating HTML version of the source echo Creating HTML version of the source
htmlify --title "dlib C++ Library - " -i docs/cache -o htmltemp.$$ htmlify --title "dlib C++ Library - " -i docs/cache -o htmltemp.$$
@ -117,6 +119,7 @@ makedocs ()
cp docs/cache/examples/CMakeLists.txt docs/web/examples cp docs/cache/examples/CMakeLists.txt docs/web/examples
mkdir docs/chm/docs/examples || report_failure mkdir docs/chm/docs/examples || report_failure
cp docs/cache/examples/CMakeLists.txt docs/chm/docs/examples cp docs/cache/examples/CMakeLists.txt docs/chm/docs/examples
rm -rf docs/cache
cp docs/*.gif docs/web cp docs/*.gif docs/web
cp docs/*.gif docs/chm/docs cp docs/*.gif docs/chm/docs
cp docs/*.html docs/web cp docs/*.html docs/web
@ -184,8 +187,6 @@ makedocs ()
./testenv || report_failure ./testenv || report_failure
#echo Update the docs to the newest version in subversion
#svn update || report_failure
# build all the html documentation # build all the html documentation