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$
\.o$
\.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
generate the HTML documentation.
The current version of these files can be obtained from the dlib subversion
repository at: https://dclib.svn.sourceforge.net/svnroot/dclib/trunk/docs
The current version of these files can be obtained from the dlib Mercurial
repository at: http://dclib.hg.sourceforge.net:8000/hgroot/dclib/dclib
======================== Overview ========================

View File

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

View File

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

View File

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

View File

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

View File

@ -900,7 +900,7 @@
<xsl:template name="format-date">
<xsl:param name="xsd-date"/>
<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="month" select="substring($date,6,2)"/>
@ -945,7 +945,7 @@
<xsl:template match="log">
<xsl:for-each select="logentry">
<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/>
<xsl:apply-templates select="msg"/>
<xsl:apply-templates select="paths"/>

View File

@ -27,33 +27,34 @@ htmlify_cmake ()
echo "</pre></body></html>" >> $1;
}
get_short_revision_number()
{
RESULT=`hg log -r $1 | grep changeset | awk '{print $2}' | sed -e 's/:.*//'`
}
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
MINOR_COUTNER_FILE=.current_minor_release_number
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"
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
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" ]
@ -65,36 +66,37 @@ makedocs ()
RELEASE=${MAJOR_NUM}.${MINOR_NUM}
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
if [ $DOCS_LAST_UPDATE_REV -ne $REVISION ]
then
BASE_LOGGER_REVNUM=`echo $LOGGER_REVNUM - 1000 | bc`
echo Getting the subversion change logs for $DLIB_REPOS/dlib $LOGGER_REVNUM:$REVISION
svn log $DLIB_REPOS/dlib -v --xml -r$LOGGER_REVNUM:$REVISION > docs/svnlog.txt || report_failure
echo Getting the subversion change logs for $DLIB_REPOS/dlib $BASE_LOGGER_REVNUM:$LOGGER_REVNUM
svn log $DLIB_REPOS/dlib -v --xml -r$BASE_LOGGER_REVNUM:$LOGGER_REVNUM > docs/old_svnlog.txt || report_failure
# grab a clean copy of the repository
rm -rf docs/cache
rm -rf cache.$$
hg clone .. cache.$$ > /dev/null || report_failure
# put the stuff we need into the docs/cache folder
mkdir docs/cache
mv cache.$$/dlib docs/cache/
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 "// Version: " $RELEASE >> docs/cache/dlib/revision.h
echo "// Date: " `date` >> docs/cache/dlib/revision.h
echo "// Subversion Revision Number" >> docs/cache/dlib/revision.h
echo "#define DLIB_REVISION " $REVISION >> docs/cache/dlib/revision.h
echo "// Mercurial Revision 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 "#endif" >> docs/cache/dlib/revision.h
rm -rf docs/web/*
rm -rf docs/chm/docs/*
rm -rf docs/web
rm -rf docs/chm/docs
mkdir docs/web
mkdir docs/chm/docs
echo Creating HTML version of the source
htmlify --title "dlib C++ Library - " -i docs/cache -o htmltemp.$$
@ -117,6 +119,7 @@ makedocs ()
cp docs/cache/examples/CMakeLists.txt docs/web/examples
mkdir docs/chm/docs/examples || report_failure
cp docs/cache/examples/CMakeLists.txt docs/chm/docs/examples
rm -rf docs/cache
cp docs/*.gif docs/web
cp docs/*.gif docs/chm/docs
cp docs/*.html docs/web
@ -184,8 +187,6 @@ makedocs ()
./testenv || report_failure
#echo Update the docs to the newest version in subversion
#svn update || report_failure
# build all the html documentation