tests/test-check-help.t
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Sat, 15 Apr 2017 02:54:36 +0200
changeset 32018 090fff9b6d65
parent 31498 a248bbfa0bc7
child 32421 778dc37ce683
permissions -rw-r--r--
obsolescence: add test for the "branch replacement" logic during push, case D7 Mercurial checks for the introduction of new heads on push. Evolution comes into play to detect if existing branches on the server are being replaced by some of the new one we push. This changeset adds test for the improved "branch replacement" logic introduce in an earlier commits. This tests initially lived in the evolve extensions. Since we now have the code handling this logic in core, it make sense to have the tests in core too. See inline documentation for details about the test case added in this changeset.

#require test-repo

  $ . "$TESTDIR/helpers-testrepo.sh"

  $ cat <<'EOF' > scanhelptopics.py
  > from __future__ import absolute_import, print_function
  > import re
  > import sys
  > if sys.platform == "win32":
  >     import os, msvcrt
  >     msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
  > topics = set()
  > topicre = re.compile(r':hg:`help ([a-z0-9\-.]+)`')
  > for fname in sys.argv:
  >     with open(fname) as f:
  >         topics.update(m.group(1) for m in topicre.finditer(f.read()))
  > for s in sorted(topics):
  >     print(s)
  > EOF

  $ cd "$TESTDIR"/..

Check if ":hg:`help TOPIC`" is valid:
(use "xargs -n1 -t" to see which help commands are executed)

  $ hg files 'glob:{hgext,mercurial}/**/*.py' | sed 's|\\|/|g' \
  > | xargs python "$TESTTMP/scanhelptopics.py" \
  > | xargs -n1 hg help > /dev/null