##// 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
fakedirstatewritetime.py
99 lines | 3.0 KiB | text/x-python | PythonLexer
/ tests / fakedirstatewritetime.py
FUJIWARA Katsunori
tests: add extension to emulate invoking dirstate.write at the specific time...
r25752 # extension to emulate invoking 'dirstate.write()' at the time
# specified by '[fakedirstatewritetime] fakenow', only when
# 'dirstate.write()' is invoked via functions below:
#
Siddharth Agarwal
workingctx: factor out post-status dirstate fixup...
r32812 # - 'workingctx._poststatusfixup()' (= 'repo.status()')
FUJIWARA Katsunori
tests: add extension to emulate invoking dirstate.write at the specific time...
r25752 # - 'committablectx.markcommitted()'
Gregory Szorc
tests/fakedirstatewritetime.py: use absolute_import
r27283
from mercurial import (
context,
dirstate: split dirstatemap in its own file...
r48295 dirstatemap as dirstatemapmod,
Gregory Szorc
tests/fakedirstatewritetime.py: use absolute_import
r27283 extensions,
Yuya Nishihara
parsers: switch to policy importer...
r32372 policy,
Boris Feld
configitems: register the test 'fakedirstatewritetime.fakenow' config
r34772 registrar,
Gregory Szorc
tests/fakedirstatewritetime.py: use absolute_import
r27283 )
Simon Sapin
dirstate: store mtimes with nanosecond precision in memory...
r49079 from mercurial.dirstateutils import timestamp
Boris Feld
util: extract all date-related utils in utils/dateutil module...
r36625 from mercurial.utils import dateutil
FUJIWARA Katsunori
tests: add extension to emulate invoking dirstate.write at the specific time...
r25752
Raphaël Gomès
rust-dirstate: call parse/pack bindings from Python...
r42490 try:
from mercurial import rustext
Augie Fackler
formatting: blacken the codebase...
r43346
Raphaël Gomès
rust-dirstate: call parse/pack bindings from Python...
r42490 rustext.__name__ # force actual import (see hgdemandimport)
except ImportError:
rustext = None
Boris Feld
configitems: register the test 'fakedirstatewritetime.fakenow' config
r34772 configtable = {}
configitem = registrar.configitem(configtable)
Augie Fackler
formatting: blacken the codebase...
r43346 configitem(
Augie Fackler
formating: upgrade to black 20.8b1...
r46554 b'fakedirstatewritetime',
b'fakenow',
default=None,
Boris Feld
configitems: register the test 'fakedirstatewritetime.fakenow' config
r34772 )
Augie Fackler
cleanup: remove pointless r-prefixes on single-quoted strings...
r43906 parsers = policy.importmod('parsers')
Simon Sapin
rust: Remove the `rustext.parsers` module...
r48832 has_rust_dirstate = policy.importrust('dirstate') is not None
Yuya Nishihara
parsers: switch to policy importer...
r32372
Augie Fackler
formatting: blacken the codebase...
r43346
dirstate: remove need_delay logic...
r49221 def pack_dirstate(orig, dmap, copymap, pl):
return orig(dmap, copymap, pl)
FUJIWARA Katsunori
tests: add extension to emulate invoking dirstate.write at the specific time...
r25752
Augie Fackler
formatting: blacken the codebase...
r43346
FUJIWARA Katsunori
tests: add extension to emulate invoking dirstate.write at the specific time...
r25752 def fakewrite(ui, func):
# fake "now" of 'pack_dirstate' only if it is invoked while 'func'
Pulkit Goyal
py3: add b'' prefixes in fakedirstatewritetime.py...
r36342 fakenow = ui.config(b'fakedirstatewritetime', b'fakenow')
FUJIWARA Katsunori
tests: add extension to emulate invoking dirstate.write at the specific time...
r25752 if not fakenow:
# Execute original one, if fakenow isn't configured. This is
# useful to prevent subrepos from executing replaced one,
# because replacing 'parsers.pack_dirstate' is also effective
# in subrepos.
return func()
# parsing 'fakenow' in YYYYmmddHHMM format makes comparison between
# 'fakenow' value and 'touch -t YYYYmmddHHMM' argument easy
Boris Feld
util: extract all date-related utils in utils/dateutil module...
r36625 fakenow = dateutil.parsedate(fakenow, [b'%Y%m%d%H%M'])[0]
dirstate-item: add a "second_ambiguous` flag in the mtime tuple...
r49227 fakenow = timestamp.timestamp((fakenow, 0, False))
FUJIWARA Katsunori
tests: add extension to emulate invoking dirstate.write at the specific time...
r25752
Simon Sapin
rust: Remove the `rustext.parsers` module...
r48832 if has_rust_dirstate:
Raphaël Gomès
rust-parsers: move parser bindings to their own file and Python module...
r42992 # The Rust implementation does not use public parse/pack dirstate
# to prevent conversion round-trips
dirstate: split dirstatemap in its own file...
r48295 orig_dirstatemap_write = dirstatemapmod.dirstatemap.write
dirstate: remove need_delay logic...
r49221 wrapper = lambda self, tr, st: orig_dirstatemap_write(self, tr, st)
dirstate: split dirstatemap in its own file...
r48295 dirstatemapmod.dirstatemap.write = wrapper
Raphaël Gomès
rust-dirstate: call parse/pack bindings from Python...
r42490
dirstate: move "get fs now" in the timestamp utility module...
r49202 orig_get_fs_now = timestamp.get_fs_now
dirstate: remove need_delay logic...
r49221 wrapper = lambda *args: pack_dirstate(orig_pack_dirstate, *args)
FUJIWARA Katsunori
tests: add extension to emulate invoking dirstate.write at the specific time...
r25752
Raphaël Gomès
rust-parsers: move parser bindings to their own file and Python module...
r42992 orig_module = parsers
orig_pack_dirstate = parsers.pack_dirstate
Raphaël Gomès
rust-dirstate: call parse/pack bindings from Python...
r42490 orig_module.pack_dirstate = wrapper
dirstate: remove need_delay logic...
r49221 timestamp.get_fs_now = (
lambda *args: fakenow
) # XXX useless for this purpose now
FUJIWARA Katsunori
tests: add extension to emulate invoking dirstate.write at the specific time...
r25752 try:
return func()
finally:
Raphaël Gomès
rust-dirstate: call parse/pack bindings from Python...
r42490 orig_module.pack_dirstate = orig_pack_dirstate
dirstate: move "get fs now" in the timestamp utility module...
r49202 timestamp.get_fs_now = orig_get_fs_now
Simon Sapin
rust: Remove the `rustext.parsers` module...
r48832 if has_rust_dirstate:
dirstate: split dirstatemap in its own file...
r48295 dirstatemapmod.dirstatemap.write = orig_dirstatemap_write
FUJIWARA Katsunori
tests: add extension to emulate invoking dirstate.write at the specific time...
r25752
Augie Fackler
formatting: blacken the codebase...
r43346
Siddharth Agarwal
workingctx: also pass status tuple into poststatusfixup...
r32813 def _poststatusfixup(orig, workingctx, status, fixup):
FUJIWARA Katsunori
tests: add extension to emulate invoking dirstate.write at the specific time...
r25752 ui = workingctx.repo().ui
Augie Fackler
formatting: blacken the codebase...
r43346 return fakewrite(ui, lambda: orig(workingctx, status, fixup))
FUJIWARA Katsunori
tests: add extension to emulate invoking dirstate.write at the specific time...
r25752
def markcommitted(orig, committablectx, node):
ui = committablectx.repo().ui
Augie Fackler
formatting: blacken the codebase...
r43346 return fakewrite(ui, lambda: orig(committablectx, node))
FUJIWARA Katsunori
tests: add extension to emulate invoking dirstate.write at the specific time...
r25752
def extsetup(ui):
Augie Fackler
formatting: blacken the codebase...
r43346 extensions.wrapfunction(
context.workingctx, '_poststatusfixup', _poststatusfixup
)
extensions.wrapfunction(context.workingctx, 'markcommitted', markcommitted)