##// END OF EJS Templates
revlog: fix revset in reachableroots docstring...
revlog: fix revset in reachableroots docstring `reachableroots` will only return a subset of `roots` when `includepath` is False. For example, given the following linear DAG: 2 | 1 | 0 Using roots=0+2, heads=1, the definition in the docstring does not match what `reachableroots` actually does: ipdb> repo.changelog.reachableroots(0, roots=[0,2],heads=[1]) [0] ipdb> repo.revs('heads(::(0+2) & (0+2)::1)') <baseset+ [1]> The fix is to do `heads & ::roots` (or `heads & heads::roots`) first, then select their ancestors: ipdb> repo.revs('heads(::((0+2) & (0+2)::1))') <baseset+ [0]> The docstring was introduced by fd92bfbbe02d9 (2015-06-19 "revset: rename revsbetween to reachableroots and add an argument"), which introduced the `includepath=False` behavior for graphlog grandparents use-case. I believe the docstring instead of the code should be changed because changing the code to match the docstring can result in suboptimal graphlog like: o :\ : o : : :/ o As opposite to the current "linearized" graphlog: o | o : o Differential Revision: https://phab.mercurial-scm.org/D7518

File last commit:

r43346:2372284d default
r44168:1a42f845 default
Show More
test-doctest.py
94 lines | 2.8 KiB | text/x-python | PythonLexer
Mads Kiilerich
tests: fix readline escape characters in output for test-doctest.py
r7041 # this is hack to make sure no escape characters are inserted into the output
Pulkit Goyal
tests: make test-doctest use absolute_import
r28933
from __future__ import absolute_import
import doctest
import os
Yuya Nishihara
doctest: normalize b'', u'' and exception output on Python 3...
r34142 import re
Pulkit Goyal
tests: make test-doctest use absolute_import
r28933 import sys
Yuya Nishihara
tests: allow running doctests selectively on Python 3...
r31438
Augie Fackler
formatting: blacken the codebase...
r43346 ispy3 = sys.version_info[0] >= 3
Yuya Nishihara
tests: allow running doctests selectively on Python 3...
r31438
Patrick Mezard
test-doctest: remove TERM env variable only if it's there
r7078 if 'TERM' in os.environ:
Dirkjan Ochtman
clean up trailing spaces
r7184 del os.environ['TERM']
Benoit Boissinot
[extendedchangelog] encode/decode function...
r3232
Augie Fackler
formatting: blacken the codebase...
r43346
Yuya Nishihara
doctest: normalize b'', u'' and exception output on Python 3...
r34142 class py3docchecker(doctest.OutputChecker):
def check_output(self, want, got, optionflags):
want2 = re.sub(r'''\bu(['"])(.*?)\1''', r'\1\2\1', want) # py2: u''
got2 = re.sub(r'''\bb(['"])(.*?)\1''', r'\1\2\1', got) # py3: b''
# py3: <exc.name>: b'<msg>' -> <name>: <msg>
# <exc.name>: <others> -> <name>: <others>
Augie Fackler
formatting: blacken the codebase...
r43346 got2 = re.sub(
r'''^mercurial\.\w+\.(\w+): (['"])(.*?)\2''',
r'\1: \3',
got2,
re.MULTILINE,
)
Yuya Nishihara
doctest: normalize b'', u'' and exception output on Python 3...
r34142 got2 = re.sub(r'^mercurial\.\w+\.(\w+): ', r'\1: ', got2, re.MULTILINE)
Augie Fackler
formatting: blacken the codebase...
r43346 return any(
doctest.OutputChecker.check_output(self, w, g, optionflags)
for w, g in [(want, got), (want2, got2)]
)
Yuya Nishihara
doctest: normalize b'', u'' and exception output on Python 3...
r34142
Yuya Nishihara
doctest: drop hack to run py2/3 tests selectively...
r34425 def testmod(name, optionflags=0, testtarget=None):
Mads Kiilerich
tests: make doctest test runner less verbose
r20047 __import__(name)
mod = sys.modules[name]
if testtarget is not None:
mod = getattr(mod, testtarget)
Yuya Nishihara
doctest: normalize b'', u'' and exception output on Python 3...
r34142
# minimal copy of doctest.testmod()
finder = doctest.DocTestFinder()
checker = None
if ispy3:
checker = py3docchecker()
runner = doctest.DocTestRunner(checker=checker, optionflags=optionflags)
for test in finder.find(mod, name):
runner.run(test)
runner.summarize()
Sune Foldager
ui: add configint function and tests
r14171
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
changegroup: introduce cg3, which has support for exchanging treemanifests...
r27432 testmod('mercurial.changegroup')
Mads Kiilerich
tests: make doctest test runner less verbose
r20047 testmod('mercurial.changelog')
Yuya Nishihara
cmdutil: expand filename format string by templater (BC)...
r36528 testmod('mercurial.cmdutil')
Yuya Nishihara
color: insert color code after every "\e[0m" (issue5413)...
r31518 testmod('mercurial.color')
Jun Wu
ui: move configlist parser to config.py...
r31481 testmod('mercurial.config')
Siddharth Agarwal
annotate: add core algorithm to skip a rev...
r32485 testmod('mercurial.context')
Yuya Nishihara
py3: iterate bytes as a byte string in dagparser.py
r34209 testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE)
Mads Kiilerich
tests: make doctest test runner less verbose
r20047 testmod('mercurial.dispatch')
Yuya Nishihara
py3: use 'surrogatepass' error handler to process U+DCxx transparently...
r34215 testmod('mercurial.encoding')
Yuya Nishihara
fancyopts: add early-options parser compatible with getopt()...
r35179 testmod('mercurial.fancyopts')
Yuya Nishihara
py3: convert system strings to bytes in doctest of formatter.py
r34257 testmod('mercurial.formatter')
Yuya Nishihara
clone: add doctest for default destination
r20799 testmod('mercurial.hg')
Yuya Nishihara
py3: remove use of str() in hgwebdir...
r34354 testmod('mercurial.hgweb.hgwebdir_mod')
Mads Kiilerich
tests: make doctest test runner less verbose
r20047 testmod('mercurial.match')
Denis Laxalde
mdiff: add a hunkinrange helper function...
r31808 testmod('mercurial.mdiff')
Mads Kiilerich
tests: make doctest test runner less verbose
r20047 testmod('mercurial.minirst')
Yuya Nishihara
py3: fix doctests in patch.py to be compatible with Python 3...
r34254 testmod('mercurial.patch')
Yuya Nishihara
py3: use bytes os.sep in doctest of pathutil.py
r34255 testmod('mercurial.pathutil')
Yuya Nishihara
parser: add helper to reduce nesting of chained infix operations...
r25306 testmod('mercurial.parser')
Yuya Nishihara
doctest: enable tests by default on Python 3...
r34143 testmod('mercurial.pycompat')
Boris Feld
revlog: add a doctest to _trimchunk
r38657 testmod('mercurial.revlog')
Boris Feld
tests: add `revlogutils.deltas` module to doctests...
r40676 testmod('mercurial.revlogutils.deltas')
av6
revset: support ranges in #generations relation
r41395 testmod('mercurial.revset')
Yuya Nishihara
revset: split language services to revsetlang module (API)...
r31024 testmod('mercurial.revsetlang')
Yuya Nishihara
smartset: move set classes and related functions from revset module (API)...
r30881 testmod('mercurial.smartset')
Yuya Nishihara
py3: iterate bytes as a byte string in store.lowerencode()
r34212 testmod('mercurial.store')
Siddharth Agarwal
subrepo: factor out Git version check to add doctests...
r20840 testmod('mercurial.subrepo')
Mads Kiilerich
tests: make doctest test runner less verbose
r20047 testmod('mercurial.templatefilters')
Yuya Nishihara
templater: introduce one-pass parsing of nested template strings...
r25783 testmod('mercurial.templater')
Yuya Nishihara
py3: convert function name to bytes in ui.configwith()
r34205 testmod('mercurial.ui')
Mads Kiilerich
tests: make doctest test runner less verbose
r20047 testmod('mercurial.url')
Yuya Nishihara
py3: work around bytes/unicode divergence in parsedate()
r34358 testmod('mercurial.util')
Mads Kiilerich
tests: make doctest test runner less verbose
r20047 testmod('mercurial.util', testtarget='platform')
Yuya Nishihara
stringutil: move generic string helpers to new module...
r37101 testmod('mercurial.utils.stringutil')
Yuya Nishihara
py3: replace str(None) with literal in convcmd.py
r34355 testmod('hgext.convert.convcmd')
Mads Kiilerich
tests: make doctest test runner less verbose
r20047 testmod('hgext.convert.cvsps')
Mads Kiilerich
convert: readability and test of rpairs function
r20048 testmod('hgext.convert.filemap')
Eugene Baranov
convert: unescape Perforce-escaped special characters in filenames
r25788 testmod('hgext.convert.p4')
Mads Kiilerich
convert: make subversion revsplit more stable when meeting revisions without @...
r20419 testmod('hgext.convert.subversion')
Danny Hooper
fix: new extension for automatically modifying file contents...
r37200 testmod('hgext.fix')
Mads Kiilerich
mq: refactor patchheader header ordering to match export (BC)...
r22546 testmod('hgext.mq')
Augie Fackler
drawdag: add a couple of doctests to help with python3 porting
r34203 # Helper scripts in tests/ that have doctests:
testmod('drawdag')