mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
440d3ebb04
Summary: An extension replacing dirstate file with sqlite database so we can have incremental changes and we don't have to read the whole dirstate on every op. This makes sense only when hgwatchan/fsmonitor is on so we don't iterate through whole dirstate. This is also using the sqlite transactions to handle dirstate transactions instead of copying db around. As a result of that "hg rollback" doesn't work anymore. You can fall back to copying things by setting sqldirstate.skipbackups to False. Needs those to go to upstream to work: https://phabricator.intern.facebook.com/P56319612 (will send them once the freeze is over) To use make sure that the extension is loaded *before* hgwatchman (watchman should be outmost layer). Test Plan: Passing all but few mercurial tests (when running with skipbackups=False) The failures are described in blacklist file. Reviewers: lcharignon, wez, quark, durham Reviewed By: durham Subscribers: laurent, mjpieters, #sourcecontrol Differential Revision: https://phabricator.intern.facebook.com/D3242547 Signature: t1:3242547:1462577481:fdbfb5287fb8d3e58f7b4d587c01de79ce6b78df
60 lines
2.0 KiB
Python
Executable File
60 lines
2.0 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import optparse
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
# PassThroughOptionParse is from the Optik source distribution, (c) 2001-2006
|
|
# Gregory P. Ward. Used under the BSD license.
|
|
class PassThroughOptionParser(optparse.OptionParser):
|
|
def _process_long_opt(self, rargs, values):
|
|
try:
|
|
optparse.OptionParser._process_long_opt(self, rargs, values)
|
|
except optparse.BadOptionError as err:
|
|
self.largs.append(err.opt_str)
|
|
|
|
def _process_short_opts(self, rargs, values):
|
|
try:
|
|
optparse.OptionParser._process_short_opts(self, rargs, values)
|
|
except optparse.BadOptionError as err:
|
|
self.largs.append(err.opt_str)
|
|
|
|
def parseargs(argv):
|
|
parser = PassThroughOptionParser(usage='%prog [options]',
|
|
epilog='Any additional options and arguments are passed through to '
|
|
'REPO/tests/run-tests.py.')
|
|
|
|
parser.add_option('--hg', type='string',
|
|
metavar='REPO',
|
|
help='Mercurial repository to run tests against')
|
|
parser.add_option('--disable-blacklist', action='store_true',
|
|
default=False,
|
|
help='disable default test blacklist')
|
|
|
|
options, args = parser.parse_args(argv)
|
|
if not options.hg:
|
|
parser.error('Mercurial repository not specified')
|
|
|
|
return options, args
|
|
|
|
def main(argv):
|
|
options, args = parseargs(argv)
|
|
|
|
thisdir = os.path.dirname(os.path.realpath(__file__))
|
|
extroot = os.path.join(os.path.dirname(thisdir), 'sqldirstate')
|
|
extopts = ['--extra-config-opt', 'extensions.sqldirstate=%s' % extroot,
|
|
'--extra-config-opt', 'sqldirstate.skipbackups=False',
|
|
'--extra-config-opt', 'format.sqldirstate=True']
|
|
if not options.disable_blacklist:
|
|
extopts += ['--blacklist',
|
|
os.path.join(thisdir, 'blacklist-sqldirstate')]
|
|
|
|
cwd = os.path.expanduser(os.path.join(options.hg, 'tests'))
|
|
cmd = [os.path.join(cwd, 'run-tests.py')] + extopts + args
|
|
|
|
return subprocess.call(cmd, cwd=cwd)
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main(sys.argv[1:]))
|