Mercurial > evolve
changeset 5670:777ca21a6f71
branching: merge with stable into default
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 26 Nov 2020 07:40:10 +0100 |
parents | b0a103e08d89 (current diff) 1d80cda7fe93 (diff) |
children | 8c5f2c37b911 |
files | |
diffstat | 10 files changed, 100 insertions(+), 75 deletions(-) [+] |
line wrap: on
line diff
--- a/.gitlab-ci.yml Thu Nov 26 14:26:40 2020 +0800 +++ b/.gitlab-ci.yml Thu Nov 26 07:40:10 2020 +0100 @@ -70,13 +70,15 @@ TEST_HGMODULEPOLICY: "py" doc: - image: octobus/ci-py2-evolve-doc + image: octobus/ci-py3-evolve-doc script: - cd docs/ - make variables: - LANG: en_us.UTF-8 + LANG: en_US.UTF-8 + PYTHON: python3 PYTHONPATH: "/ci/repos/mercurial:$PYTHONPATH" + SPHINXBUILD: python3 -m sphinx -b html artifacts: paths: - html/*
--- a/docs/conf.py Thu Nov 26 14:26:40 2020 +0800 +++ b/docs/conf.py Thu Nov 26 07:40:10 2020 +0100 @@ -2,12 +2,22 @@ # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. from mercurial import demandimport demandimport.disable() + +from os.path import ( + abspath, + dirname, + join, +) + from docutils import nodes from docutils.parsers.rst import Directive -from mercurial import ui -from mercurial import extensions as hgext -from mercurial import commands -import os + +from mercurial import ( + commands, + extensions as hgext, + pycompat, + ui as uimod, +) extensions = ["sphinx.ext.graphviz"] @@ -139,20 +149,17 @@ has_content = True def run(self): - u = ui.ui() - if not hasattr(u, 'disablepager'): + ui = uimod.ui() + if not hasattr(ui, 'disablepager'): return [] - u.disablepager() - u.setconfig( - 'extensions', 'evolve', - os.path.join( - os.path.abspath(os.path.dirname(__file__)), - os.pardir, 'hgext3rd', 'evolve')) - hgext.loadall(u) - u.pushbuffer() - commands.help_(u, self.content[0].encode('utf-8')) - return [ - nodes.literal_block(text=u.popbuffer().decode('utf-8'))] + ui.disablepager() + rootdir = abspath(dirname(dirname(__file__))) + evolvepath = join(rootdir, 'hgext3rd', 'evolve') + ui.setconfig(b'extensions', b'evolve', pycompat.bytestr(evolvepath)) + hgext.loadall(ui) + ui.pushbuffer() + commands.help_(ui, self.content[0].encode('utf-8')) + return [nodes.literal_block(text=ui.popbuffer().decode('utf-8'))] def setup(app):
--- a/docs/makefile Thu Nov 26 14:26:40 2020 +0800 +++ b/docs/makefile Thu Nov 26 07:40:10 2020 +0100 @@ -1,14 +1,14 @@ -SPHINXBUILD ?= sphinx-build +SPHINXBUILD ?= python3 -m sphinx -b html .PHONY: all all: tutorials/tutorial.rst tutorials/topic-tutorial.rst static/logo-evolve.ico $(SPHINXBUILD) . ../html/ tutorials/tutorial.rst: tutorials/tutorial.t test2rst.py - python test2rst.py tutorials/ + python3 test2rst.py $< tutorials/topic-tutorial.rst: tutorials/topic-tutorial.t test2rst.py - python test2rst.py tutorials/ + python3 test2rst.py $< static/logo-evolve.ico: static/logo-evolve.svg convert -resize 36x36 $< $@
--- a/docs/test2rst.py Thu Nov 26 14:26:40 2020 +0800 +++ b/docs/test2rst.py Thu Nov 26 07:40:10 2020 +0100 @@ -1,17 +1,9 @@ -#!/usr/bin/env python - -import re -import os -import os.path as op -import sys +#!/usr/bin/env python3 -INDEX = ''' -Mercurial tests -=============== +import argparse +import os +import re -.. toctree:: - :maxdepth: 1 -''' ignored_patterns = [ re.compile(r'^#if'), @@ -21,7 +13,8 @@ ] -def rstify(orig, name): +def rstify(orig): + """Take contents of a .t file and produce reStructuredText""" newlines = [] code_block_mode = False @@ -29,7 +22,7 @@ for line in orig.splitlines(): - # Emtpy lines doesn't change output + # Empty lines doesn't change output if not line: newlines.append(line) code_block_mode = False @@ -67,40 +60,19 @@ return "\n".join(newlines) -def main(base): - if os.path.isdir(base): - one_dir(base) - else: - one_file(base) +def main(): + ap = argparse.ArgumentParser() + ap.add_argument('testfile', help='.t file to transform') - -def one_dir(base): - index = INDEX - # doc = lambda x: op.join(op.dirname(__file__), 'docs', x) + opts = ap.parse_args() - for fn in sorted(os.listdir(base)): - if not fn.endswith('.t'): - continue - name = os.path.splitext(fn)[0] - content = one_file(op.join(base, fn)) - target = op.join(base, name + '.rst') - # with file(doc(name + '.rst'), 'w') as f: - with open(target, 'w') as f: - f.write(content) - - index += '\n ' + name - - # with file(doc('index.rst'), 'w') as f: - # f.write(index) - - -def one_file(path): - name = os.path.basename(path)[:-2] - return rstify(open(path).read(), name) + with open(opts.testfile) as f: + content = f.read() + rst = rstify(content) + target = os.path.splitext(opts.testfile)[0] + '.rst' + with open(target, 'w') as f: + f.write(rst) if __name__ == '__main__': - if len(sys.argv) != 2: - print('Please supply a path to tests dir as parameter') - sys.exit() - main(sys.argv[1]) + main()
--- a/tests/test-check-commit.t Thu Nov 26 14:26:40 2020 +0800 +++ b/tests/test-check-commit.t Thu Nov 26 07:40:10 2020 +0100 @@ -1,12 +1,12 @@ #require test-repo -Enable obsolescence to avoid the warning issue when obsmarker are found +Enable obsolescence to avoid the warning issue when obsmarkers are found $ cat << EOF >> $HGRCPATH + > [experimental] + > evolution = all > [diff] > git = yes - > [experimental] - > evolution=all > EOF Go back in the hg repo
--- a/tests/test-check-debian.t Thu Nov 26 14:26:40 2020 +0800 +++ b/tests/test-check-debian.t Thu Nov 26 07:40:10 2020 +0100 @@ -1,3 +1,5 @@ +#require test-repo + Enable obsolescence to avoid the warning issue when obsmarkers are found $ cat << EOF >> $HGRCPATH
--- a/tests/test-check-flake8.t Thu Nov 26 14:26:40 2020 +0800 +++ b/tests/test-check-flake8.t Thu Nov 26 07:40:10 2020 +0100 @@ -4,7 +4,7 @@ $ cd "`dirname "$TESTDIR"`" -run flake8 if it exists; if it doesn't, then just skip +run flake8 on all tracked files ending in .py or with a python shebang $ hg files -0 'set:(**.py or grep("^#!.*python")) - removed()' \ > -X hgext3rd/evolve/thirdparty \
--- a/tests/test-check-pyflakes.t Thu Nov 26 14:26:40 2020 +0800 +++ b/tests/test-check-pyflakes.t Thu Nov 26 07:40:10 2020 +0100 @@ -4,8 +4,7 @@ $ cd "`dirname "$TESTDIR"`" -run pyflakes on all tracked files ending in .py or without a file ending -(skipping binary file random-seed) +run pyflakes on all tracked files ending in .py or with a python shebang $ hg files -0 'set:(**.py or grep("^#!.*python")) - removed()' \ > -X hgext3rd/evolve/thirdparty \
--- a/tests/test-check-setup-manifest.t Thu Nov 26 14:26:40 2020 +0800 +++ b/tests/test-check-setup-manifest.t Thu Nov 26 07:40:10 2020 +0100 @@ -1,8 +1,10 @@ #require test-repo check-manifest +Enable obsolescence to avoid the warning issue when obsmarkers are found + $ cat << EOF >> $HGRCPATH > [experimental] - > evolution=all + > evolution = all > EOF Run check manifest:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-check-tag.t Thu Nov 26 07:40:10 2020 +0100 @@ -0,0 +1,41 @@ +#require test-repo + +Enable obsolescence to avoid the warning issue when obsmarkers are found + + $ cat << EOF >> $HGRCPATH + > [experimental] + > evolution = all + > EOF + + $ cd "$TESTDIR"/.. + +Checking all non-public tagged revisions up to the current commit, see our +release checklist for more ideas + + $ for node in `hg log --rev 'tag() and ::. and not public() and not desc("# no-check-commit")' --template '{node|short}\n'`; do + > tags=`hg log --rev $node --template '{tags}\n'` + > if echo "$tags" | grep -q ' '; then + > echo "Revision $node is tagged multiple times: $tags" + > fi + > branch=`hg log --rev $node --template '{branch}\n'` + > if [ "$branch" != "stable" ]; then + > echo "Revision $node is not on stable branch: $branch" + > fi + > # Here we skip: + > # - pullbundle because it usually has no changes (so no version bump) + > # - serverminitopic because it's not actively maintained + > if hg grep --rev $node '^__version__ = .*\.dev' hgext3rd/evolve/ hgext3rd/topic/; then + > echo "Versions should not end with .dev at tagged revision $node" + > fi + > entry=`hg cat --rev $node CHANGELOG | fgrep "$tags"` + > if [ -z "$entry" ]; then + > echo "Revision $node has no CHANGELOG entry for $tags" + > fi + > if echo "$entry" | egrep -vq ' -- [0-9]{4}-[0-9]{2}-[0-9]{2}'; then + > echo "CHANGELOG entry for $tags should have a date in YYYY-MM-DD format: $entry" + > fi + > entry=`hg cat --rev $node debian/changelog | fgrep "$tags"` + > if [ -z "$entry" ]; then + > echo "Revision $node has no debian/changelog entry for $tags" + > fi + > done