##// END OF EJS Templates
bisect: avoid adding irrelevant revisions to bisect state...
bisect: avoid adding irrelevant revisions to bisect state When adding new revisions to the bisect state, it only makes sense to add information about revisions that are under consideration (i.e., those that are topologically between the known good and bad revisions). However, if the user passes in a revset (e.g., '!merge()' to exclude merge commits), hg will resolve the revset first and add all matching revisions to the bisect state (which in this case would likely be the majority of revisions in the repo). To avoid this, revisions should only be added to the bisect state if they are between the good and bad revisions (and therefore relevant to the bisection). -- Here are the results of some performance tests using the `mozilla-central` repo (since it is one of the largest freely-available hg repositories in the wild). These tests compare the performance of a locally-built `hg` before and after application of this series. Note that `--noupdate` is passed to avoid including update time (which should not vary across cases). Setup (run between each test): $ hg bisect --reset $ hg bisect --noupdate --bad 56c3ad4bde5c70714b784ccf15d099e0df0f5bde $ hg bisect --noupdate --good 57426696adaf08298af3027fa77486fee0633b13 Test using a revset that returns a very large number of revisions: $ time hg bisect --noupdate --skip '!merge()' > /dev/null Before: real 0m9.398s user 0m9.233s sys 0m0.120s After: real 0m1.513s user 0m1.425s sys 0m0.052s Test using a revset that is expensive to compute: $ time hg bisect --noupdate --skip 'desc("Bug")' > /dev/null Before: real 0m49.853s user 0m49.580s sys 0m0.243s After: real 0m4.120s user 0m4.036s sys 0m0.048s

File last commit:

r49730:6000f5b2 default
r50337:81623652 default
Show More
test-ui-config.py
133 lines | 4.7 KiB | text/x-python | PythonLexer
/ tests / test-ui-config.py
Pulkit Goyal
py3: make test-ui-config use absolute_import
r28680 from mercurial import (
dispatch,
error,
Augie Fackler
tests: port test-ui-config to Python 3...
r37956 pycompat,
Yuya Nishihara
tests: alias ui as uimod in test-ui-config
r28776 ui as uimod,
Pulkit Goyal
py3: make test-ui-config use absolute_import
r28680 )
Augie Fackler
formatting: blacken the codebase...
r43346 from mercurial.utils import stringutil
Martin Geisler
tests: renamed Python tests to .py
r8449
Yuya Nishihara
ui: factor out ui.load() to create a ui without loading configs (API)...
r30559 testui = uimod.ui.load()
Boris Feld
configitems: adds a developer warning when accessing undeclared configuration...
r34859
# disable the configuration registration warning
#
# the purpose of this test is to check the old behavior, not to validate the
# behavior from registered item. so we silent warning related to unregisted
# config.
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 testui.setconfig(b'devel', b'warn-config-unknown', False, b'test')
testui.setconfig(b'devel', b'all-warnings', False, b'test')
Boris Feld
configitems: adds a developer warning when accessing undeclared configuration...
r34859
Augie Fackler
formatting: blacken the codebase...
r43346 parsed = dispatch._parseconfig(
testui,
[
b'values.string=string value',
b'values.bool1=true',
b'values.bool2=false',
b'values.boolinvalid=foo',
b'values.int1=42',
b'values.int2=-42',
b'values.intinvalid=foo',
b'lists.list1=foo',
b'lists.list2=foo bar baz',
b'lists.list3=alice, bob',
b'lists.list4=foo bar baz alice, bob',
b'lists.list5=abc d"ef"g "hij def"',
b'lists.list6="hello world", "how are you?"',
b'lists.list7=Do"Not"Separate',
b'lists.list8="Do"Separate',
b'lists.list9="Do\\"NotSeparate"',
b'lists.list10=string "with extraneous" quotation mark"',
b'lists.list11=x, y',
b'lists.list12="x", "y"',
b'lists.list13=""" key = "x", "y" """',
b'lists.list14=,,,, ',
b'lists.list15=" just with starting quotation',
b'lists.list16="longer quotation" with "no ending quotation',
b'lists.list17=this is \\" "not a quotation mark"',
b'lists.list18=\n \n\nding\ndong',
b'date.epoch=0 0',
b'date.birth=2005-04-19T00:00:00',
b'date.invalid=0',
],
)
Martin Geisler
tests: renamed Python tests to .py
r8449
Augie Fackler
tests: port test-ui-config to Python 3...
r37956 def pprint(obj):
Yuya Nishihara
stringutil: flip the default of pprint() to bprefix=False...
r37961 return stringutil.pprint(obj).decode('ascii')
Augie Fackler
tests: port test-ui-config to Python 3...
r37956
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
tests: port test-ui-config to Python 3...
r37956 print(pprint(testui.configitems(b'values')))
print(pprint(testui.configitems(b'lists')))
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 print("---")
Augie Fackler
tests: port test-ui-config to Python 3...
r37956 print(pprint(testui.config(b'values', b'string')))
print(pprint(testui.config(b'values', b'bool1')))
print(pprint(testui.config(b'values', b'bool2')))
print(pprint(testui.config(b'values', b'unknown')))
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 print("---")
Martin Geisler
tests: renamed Python tests to .py
r8449 try:
Augie Fackler
tests: port test-ui-config to Python 3...
r37956 print(pprint(testui.configbool(b'values', b'string')))
Gregory Szorc
global: mass rewrite to use modern exception syntax...
r25660 except error.ConfigError as inst:
Augie Fackler
tests: port test-ui-config to Python 3...
r37956 print(pprint(pycompat.bytestr(inst)))
print(pprint(testui.configbool(b'values', b'bool1')))
print(pprint(testui.configbool(b'values', b'bool2')))
print(pprint(testui.configbool(b'values', b'bool2', True)))
print(pprint(testui.configbool(b'values', b'unknown')))
print(pprint(testui.configbool(b'values', b'unknown', True)))
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 print("---")
Augie Fackler
tests: port test-ui-config to Python 3...
r37956 print(pprint(testui.configint(b'values', b'int1')))
print(pprint(testui.configint(b'values', b'int2')))
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 print("---")
Augie Fackler
tests: port test-ui-config to Python 3...
r37956 print(pprint(testui.configlist(b'lists', b'list1')))
print(pprint(testui.configlist(b'lists', b'list2')))
print(pprint(testui.configlist(b'lists', b'list3')))
print(pprint(testui.configlist(b'lists', b'list4')))
print(pprint(testui.configlist(b'lists', b'list4', [b'foo'])))
print(pprint(testui.configlist(b'lists', b'list5')))
print(pprint(testui.configlist(b'lists', b'list6')))
print(pprint(testui.configlist(b'lists', b'list7')))
print(pprint(testui.configlist(b'lists', b'list8')))
print(pprint(testui.configlist(b'lists', b'list9')))
print(pprint(testui.configlist(b'lists', b'list10')))
print(pprint(testui.configlist(b'lists', b'list11')))
print(pprint(testui.configlist(b'lists', b'list12')))
print(pprint(testui.configlist(b'lists', b'list13')))
print(pprint(testui.configlist(b'lists', b'list14')))
print(pprint(testui.configlist(b'lists', b'list15')))
print(pprint(testui.configlist(b'lists', b'list16')))
print(pprint(testui.configlist(b'lists', b'list17')))
print(pprint(testui.configlist(b'lists', b'list18')))
print(pprint(testui.configlist(b'lists', b'unknown')))
print(pprint(testui.configlist(b'lists', b'unknown', b'')))
print(pprint(testui.configlist(b'lists', b'unknown', b'foo')))
print(pprint(testui.configlist(b'lists', b'unknown', [b'foo'])))
print(pprint(testui.configlist(b'lists', b'unknown', b'foo bar')))
print(pprint(testui.configlist(b'lists', b'unknown', b'foo, bar')))
print(pprint(testui.configlist(b'lists', b'unknown', [b'foo bar'])))
print(pprint(testui.configlist(b'lists', b'unknown', [b'foo', b'bar'])))
Boris Feld
ui: fix ui.configdate for invalid dates...
r32449 print("---")
Augie Fackler
tests: port test-ui-config to Python 3...
r37956 print(pprint(testui.configdate(b'date', b'epoch')))
print(pprint(testui.configdate(b'date', b'birth')))
Martin Geisler
tests: renamed Python tests to .py
r8449
Augie Fackler
tests: port test-ui-config to Python 3...
r37956 print(pprint(testui.config(b'values', b'String')))
Martin Geisler
tests: renamed Python tests to .py
r8449
Augie Fackler
formatting: blacken the codebase...
r43346
Martin Geisler
tests: renamed Python tests to .py
r8449 def function():
pass
Augie Fackler
formatting: blacken the codebase...
r43346
Martin Geisler
tests: renamed Python tests to .py
r8449 # values that aren't strings should work
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 testui.setconfig(b'hook', b'commit', function)
print(function == testui.config(b'hook', b'commit'))
Sune Foldager
ui: add configint function and tests
r14171
# invalid values
try:
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 testui.configbool(b'values', b'boolinvalid')
Sune Foldager
ui: add configint function and tests
r14171 except error.ConfigError:
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 print('boolinvalid')
Sune Foldager
ui: add configint function and tests
r14171 try:
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 testui.configint(b'values', b'intinvalid')
Sune Foldager
ui: add configint function and tests
r14171 except error.ConfigError:
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 print('intinvalid')
Boris Feld
ui: fix ui.configdate for invalid dates...
r32449 try:
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 testui.configdate(b'date', b'invalid')
Boris Feld
ui: fix ui.configdate for invalid dates...
r32449 except error.ConfigError:
print('dateinvalid')