view tests/test-check-help.t @ 42126:ef0e3cc684b3

repoview: introduce a filter for serving hidden changesets There are multiple usecase for being able to explicitly view or pull obsolete from a server. We need to be able to do so without exposing the secret changesets. We introduces a dedicated repository "view" to do so. Way to expose this "view" to the user will come later. To keep a behavior consistent with expected client/server behavior, the general idea is for the obsolete access to be explicitly requested by the code generating the request. In addition, the will be server side configuration to restrict the access to this feature.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 21 May 2018 17:28:35 +0200
parents b6c610bf567e
children 42d2b31cee0b
line wrap: on
line source

#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 msvcrt
  >     import os
  >     msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
  > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
  > topics = set()
  > topicre = re.compile(br':hg:`help ([a-z0-9\-.]+)`')
  > for fname in sys.argv:
  >     with open(fname, 'rb') as f:
  >         topics.update(m.group(1) for m in topicre.finditer(f.read()))
  > for s in sorted(topics):
  >     stdout.write(b'%s\n' % s)
  > EOF

  $ cd "$TESTDIR"/..

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

  $ testrepohg files 'glob:{hgdemandimport,hgext,mercurial}/**/*.py' \
  > | sed 's|\\|/|g' \
  > | xargs "$PYTHON" "$TESTTMP/scanhelptopics.py" \
  > | xargs -n1 hg help --config extensions.phabricator= > /dev/null