tests/test-check-code-hg.t
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Wed, 19 Mar 2014 01:07:41 +0900
branchstable
changeset 20767 bcfc4f625e57
parent 20239 16b5f498f49c
child 21223 c35c027f5f43
permissions -rw-r--r--
tag: save manually edited commit message into ".hg/last-message.txt" Before this patch, manually edited commit message for "hg tag -e" isn't saved into ".hg/last-message.txt" until it is saved by "localrepository.savecommitmessage()" in "localrepository.commit()". This may lose such commit message, if unexpected exception is raised. This patch saves manually edited commit message for "hg tag -e" into ".hg/last-message.txt" just after user editing. This patch doesn't save the message specified by -m option (-l is not supported for "hg tag") as same as other commands. This is the simplest implementation to fix on stable. Editing and saving commit message should be centralized into the framework of "localrepository.commit()" with "editor" argument in the future.

  $ check_code="$TESTDIR"/../contrib/check-code.py
  $ cd "$TESTDIR"/..
  $ if hg identify -q > /dev/null 2>&1; then :
  > else
  >     echo "skipped: not a Mercurial working dir" >&2
  >     exit 80
  > fi

Prepare check for Python files without py extension

  $ cp \
  >   hg \
  >   hgweb.cgi \
  >   contrib/convert-repo \
  >   contrib/dumprevlog \
  >   contrib/hgweb.fcgi \
  >   contrib/hgweb.wsgi \
  >   contrib/simplemerge \
  >   contrib/undumprevlog \
  >   i18n/hggettext \
  >   i18n/posplit \
  >   tests/hghave \
  >   tests/dummyssh \
  >   "$TESTTMP"/
  $ for f in "$TESTTMP"/*; do mv "$f" "$f.py"; done

New errors are not allowed. Warnings are strongly discouraged.
(The writing "no-che?k-code" is for not skipping this file when checking.)

  $ { hg manifest 2>/dev/null; ls "$TESTTMP"/*.py | sed 's-\\-/-g'; } |
  >   xargs "$check_code" --warnings --per-file=0 || false
  Skipping hgext/zeroconf/Zeroconf.py it has no-che?k-code (glob)
  Skipping i18n/polib.py it has no-che?k-code (glob)
  Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob)
  Skipping mercurial/httpclient/_readers.py it has no-che?k-code (glob)
  Skipping mercurial/httpclient/socketutil.py it has no-che?k-code (glob)