##// 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:

r49801:642e31cb default
r50337:81623652 default
Show More
dumbhttp.py
112 lines | 2.7 KiB | text/x-python | PythonLexer
run-tests: stop writing a `python3` symlink pointing to python2...
r48294 #!/usr/bin/env python
Mike Hommey
tests: pull common http server setup out of individual tests...
r22959
Gregory Szorc
tests/dumbhttp: use absolute_import
r27282
Mike Hommey
tests: pull common http server setup out of individual tests...
r22959 """
Small and dumb HTTP server for use in tests.
"""
Gregory Szorc
tests/dumbhttp: use absolute_import
r27282 import optparse
Jun Wu
dumbhttp: use IPv6 if HGIPV6 is set to 1...
r31004 import os
Gregory Szorc
tests/dumbhttp: use absolute_import
r27282 import signal
Jun Wu
dumbhttp: use IPv6 if HGIPV6 is set to 1...
r31004 import socket
Gregory Szorc
tests/dumbhttp: use absolute_import
r27282 import sys
Mike Hommey
tests: pull common http server setup out of individual tests...
r22959
Gregory Szorc
tests/dumbhttp: use absolute_import
r27282 from mercurial import (
Yuya Nishihara
py3: fix dumbhttp.py to convert --daemon-postexec arguments back to bytes
r38612 encoding,
Pulkit Goyal
py3: make values bytes before passing into server.runservice()...
r37690 pycompat,
Yuya Nishihara
server: move cmdutil.service() to new module (API)...
r30506 server,
Pulkit Goyal
py3: conditionalize BaseHTTPServer, SimpleHTTPServer and CGIHTTPServer import...
r29566 util,
Gregory Szorc
tests/dumbhttp: use absolute_import
r27282 )
Pulkit Goyal
py3: conditionalize BaseHTTPServer, SimpleHTTPServer and CGIHTTPServer import...
r29566 httpserver = util.httpserver
Gregory Szorc
tests/dumbhttp: use absolute_import
r27282 OptionParser = optparse.OptionParser
Mike Hommey
tests: pull common http server setup out of individual tests...
r22959
Jun Wu
dumbhttp: use IPv6 if HGIPV6 is set to 1...
r31004 if os.environ.get('HGIPV6', '0') == '1':
Augie Fackler
formatting: blacken the codebase...
r43346
Jun Wu
dumbhttp: use IPv6 if HGIPV6 is set to 1...
r31004 class simplehttpserver(httpserver.httpserver):
address_family = socket.AF_INET6
Augie Fackler
formatting: blacken the codebase...
r43346
Jun Wu
dumbhttp: use IPv6 if HGIPV6 is set to 1...
r31004 else:
simplehttpserver = httpserver.httpserver
Augie Fackler
formatting: blacken the codebase...
r43346
Yuya Nishihara
test-static-http: flush access log per request...
r34945 class _httprequesthandler(httpserver.simplehttprequesthandler):
def log_message(self, format, *args):
httpserver.simplehttprequesthandler.log_message(self, format, *args)
sys.stderr.flush()
Augie Fackler
formatting: blacken the codebase...
r43346
Gregory Szorc
py3: use class X: instead of class X(object):...
r49801 class simplehttpservice:
Yuya Nishihara
tests: have dumbhttp.py use cmdutil.service() to wait for child to listen()...
r23136 def __init__(self, host, port):
self.address = (host, port)
Augie Fackler
formatting: blacken the codebase...
r43346
Yuya Nishihara
tests: have dumbhttp.py use cmdutil.service() to wait for child to listen()...
r23136 def init(self):
Yuya Nishihara
test-static-http: flush access log per request...
r34945 self.httpd = simplehttpserver(self.address, _httprequesthandler)
Augie Fackler
formatting: blacken the codebase...
r43346
Yuya Nishihara
tests: have dumbhttp.py use cmdutil.service() to wait for child to listen()...
r23136 def run(self):
self.httpd.serve_forever()
Mike Hommey
tests: pull common http server setup out of individual tests...
r22959
Augie Fackler
formatting: blacken the codebase...
r43346
Mike Hommey
tests: pull common http server setup out of individual tests...
r22959 if __name__ == '__main__':
parser = OptionParser()
Augie Fackler
formatting: blacken the codebase...
r43346 parser.add_option(
'-p',
'--port',
dest='port',
type='int',
default=8000,
help='TCP port to listen on',
metavar='PORT',
)
parser.add_option(
'-H',
'--host',
dest='host',
default='localhost',
help='hostname or IP to listen on',
metavar='HOST',
)
Yuya Nishihara
test-static-http: show all files accessed over HTTP...
r34926 parser.add_option('--logfile', help='file name of access/error log')
Augie Fackler
formatting: blacken the codebase...
r43346 parser.add_option(
'--pid',
dest='pid',
help='file name where the PID of the server is stored',
)
parser.add_option(
'-f',
'--foreground',
dest='foreground',
Mike Hommey
tests: pull common http server setup out of individual tests...
r22959 action='store_true',
Augie Fackler
formatting: blacken the codebase...
r43346 help='do not start the HTTP server in the background',
)
Jun Wu
serve: accept multiple values for --daemon-postexec...
r28451 parser.add_option('--daemon-postexec', action='append')
Mike Hommey
tests: pull common http server setup out of individual tests...
r22959
(options, args) = parser.parse_args()
signal.signal(signal.SIGTERM, lambda x, y: sys.exit(0))
Yuya Nishihara
test-static-http: show all files accessed over HTTP...
r34926 if options.foreground and options.logfile:
Augie Fackler
formatting: blacken the codebase...
r43346 parser.error(
"options --logfile and --foreground are mutually " "exclusive"
)
Mike Hommey
tests: pull common http server setup out of individual tests...
r22959 if options.foreground and options.pid:
parser.error("options --pid and --foreground are mutually exclusive")
Augie Fackler
formatting: blacken the codebase...
r43346 opts = {
b'pid_file': options.pid,
b'daemon': not options.foreground,
b'daemon_postexec': pycompat.rapply(
encoding.strtolocal, options.daemon_postexec
),
}
Yuya Nishihara
tests: have dumbhttp.py use cmdutil.service() to wait for child to listen()...
r23136 service = simplehttpservice(options.host, options.port)
Pulkit Goyal
py3: make values bytes before passing into server.runservice()...
r37690 runargs = [sys.executable, __file__] + sys.argv[1:]
runargs = [pycompat.fsencode(a) for a in runargs]
Augie Fackler
formatting: blacken the codebase...
r43346 server.runservice(
opts,
initfn=service.init,
runfn=service.run,
logfile=options.logfile,
runargs=runargs,
)