tests/test-gendoc.t
author Gregory Szorc <gregory.szorc@gmail.com>
Sun, 06 Mar 2016 14:30:25 -0800
changeset 28492 837f1c437d58
parent 27733 3d1baa702d1a
child 28809 7a1ad08b9ff5
permissions -rw-r--r--
changelog: lazily parse date/extra field This is probably the most complicated patch in the parsing refactor. Because the date and extras are encoded in the same field, we stuff the entire field into a dedicated variable and add a property for accessing the sub-components of each. There is some duplicated code here. But the code is relatively simple, so it shouldn't be a big deal. We see revset performance wins across the board: author(mpm) 0.896565 0.876713 0.822961 desc(bug) 0.887169 0.895514 0.847054 date(2015) 0.878797 0.820987 0.811613 extra(rebase_source) 0.865446 0.823811 0.797756 author(mpm) or author(greg) 1.801832 1.784160 1.668172 author(mpm) or desc(bug) 1.812438 1.822756 1.677608 date(2015) or branch(default) 0.968276 0.910981 0.896032 author(mpm) or desc(bug) or date(2015) or extra(rebase_source) 3.656193 3.516788 3.265024 We see a speed-up on revsets accessing date and extras because the new parsing code only parses what you access. Even though they are stored the same text field, we avoid parsing dates when accessing extras and vice-versa. But strangely revsets accessing both date and extras appeared to speed up as well! I'm not sure if this is due to refactoring the parsing code or due to an optimization in revsets. You can't argue with the results!

#require docutils
#require gettext

Test document extraction

  $ HGENCODING=UTF-8
  $ export HGENCODING
  $ { echo C; ls "$TESTDIR/../i18n"/*.po | sort; } | while read PO; do
  >     LOCALE=`basename "$PO" .po`
  >     echo
  >     echo "% extracting documentation from $LOCALE"
  >     echo ".. -*- coding: utf-8 -*-" > gendoc-$LOCALE.txt
  >     echo "" >> gendoc-$LOCALE.txt
  >     LANGUAGE=$LOCALE python "$TESTDIR/../doc/gendoc.py" >> gendoc-$LOCALE.txt 2> /dev/null || exit
  > 
  >     if [ $LOCALE != C ]; then
  >         cmp -s gendoc-C.txt gendoc-$LOCALE.txt && echo '** NOTHING TRANSLATED **'
  >     fi
  > 
  >     echo "checking for parse errors"
  >     python "$TESTDIR/../doc/docchecker" gendoc-$LOCALE.txt
  >     # We call runrst without adding "--halt warning" to make it report
  >     # all errors instead of stopping on the first one.
  >     python "$TESTDIR/../doc/runrst" html gendoc-$LOCALE.txt /dev/null
  > done
  
  % extracting documentation from C
  checking for parse errors
  
  % extracting documentation from da
  checking for parse errors
  
  % extracting documentation from de
  checking for parse errors
  Die Dateien werden dem Projektarchiv beim n\xc3\xa4chsten \xc3\x9cbernehmen (commit) hinzugef\xc3\xbcgt. Um dies vorher r\xc3\xbcckg\xc3\xa4ngig zu machen, siehe:hg:`forget`. (esc)
  warning: please have a space before :hg:
  
  % extracting documentation from el
  checking for parse errors
  
  % extracting documentation from fr
  checking for parse errors
  
  % extracting documentation from it
  checking for parse errors
  
  % extracting documentation from ja
  checking for parse errors
  
  % extracting documentation from pt_BR
  checking for parse errors
  
  % extracting documentation from ro
  checking for parse errors
  
  % extracting documentation from ru
  checking for parse errors
  
  % extracting documentation from sv
  checking for parse errors
  
  % extracting documentation from zh_CN
  checking for parse errors
  
  % extracting documentation from zh_TW
  checking for parse errors