mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Switched doc making scripts to pull info from git instead of hg.
This commit is contained in:
parent
70f9a9f11f
commit
ba206da012
8
.gitignore
vendored
8
.gitignore
vendored
@ -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
|
||||
|
||||
|
@ -1 +1 @@
|
||||
192f7235a850
|
||||
a6ac55ad400689289164ea2aba89ea3c26012b19
|
||||
|
@ -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 "<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()
|
||||
{
|
||||
sed -i -e 's/\(set(CPACK_PACKAGE_VERSION_'$1' *"\).*\(".*\)/\1'$2'\2/' ../dlib/CMakeLists.txt
|
||||
|
@ -3,9 +3,5 @@
|
||||
|
||||
<doc>
|
||||
<title>Change Log</title>
|
||||
<body from_file="log.txt">
|
||||
<br/>
|
||||
<center><a href="old_change_log.html">Old Change Logs</a></center>
|
||||
<br/>
|
||||
</body>
|
||||
<body from_file="git-logs.xml"/>
|
||||
</doc>
|
||||
|
@ -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;
|
||||
|
@ -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>
|
@ -950,11 +950,12 @@
|
||||
<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="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>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"/>
|
||||
<pre class="files_changed"><xsl:value-of select="files_changed"/></pre>
|
||||
<hr class="fullhr"/>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
@ -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
|
||||
|
10
docs/makerel
10
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
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user