Jun Wu <quark@fb.com> [Thu, 13 Jul 2017 18:31:35 -0700] rev 33438
codemod: simplify nested withs
This is the result of running:
python codemod_nestedwith.py **/*.py
where codemod_nestedwith.py looks like this:
#!/usr/bin/env python
# codemod_nestedwith.py - codemod tool to rewrite nested with
#
# Copyright 2017 Facebook, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import, print_function
import sys
import redbaron
def readpath(path):
with open(path) as f:
return f.read()
def writepath(path, content):
with open(path, 'w') as f:
f.write(content)
def main(argv):
if not argv:
print('Usage: codemod_nestedwith.py FILES')
for i, path in enumerate(argv):
print('(%d/%d) scanning %s' % (i + 1, len(argv), path))
changed = False
red = redbaron.RedBaron(readpath(path))
processed = set()
for node in red.find_all('with'):
if node in processed or node.type != 'with':
continue
top = node
child = top[0]
while True:
if len(top) > 1 or child.type != 'with':
break
# estimate line length after merging two "with"s
new = '%swith %s:' % (top.indentation, top.contexts.dumps())
new += ', %s' % child.contexts.dumps()
# only do the rewrite if the end result is within 80 chars
if len(new) > 80:
break
processed.add(child)
top.contexts.extend(child.contexts)
top.value = child.value
top.value.decrease_indentation(4)
child = child[0]
changed = True
if changed:
print('updating %s' % path)
writepath(path, red.dumps())
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
Differential Revision: https://phab.mercurial-scm.org/D77
Boris Feld <boris.feld@octobus.net> [Mon, 08 Aug 2016 18:14:42 +0200] rev 33437
reposvfs: add a ward to check if locks are properly taken
we wrap 'repo.svfs.audit' to check for the store lock when accessing file in
'.hg/store' for writing. This caught a couple of instance where the transaction
was released after the lock, we should probably have a dedicated checker for
that case.
Boris Feld <boris.feld@octobus.net> [Tue, 11 Jul 2017 12:38:17 +0200] rev 33436
repovfs: add a ward to check if locks are properly taken
When the appropriate developer warnings are enabled, We wrap 'repo.vfs.audit' to
check for locks when accessing file in '.hg' for writing. Another changeset will
add a 'ward' for the store vfs (svfs).
This check system has caught a handful of locking issues that have been fixed
in previous series (mostly in 4.0). I expect another batch to be caught in third
party extensions.
We introduce two real exceptions from extensions 'blackbox.log' (because a lot of
read-only operations add entry to it), and 'last-email.txt' (because 'hg email'
is currently a read only operation and there is value to keep it this way).
In addition we are currently allowing bisect to operate outside of the lock
because the current code is a bit hard to get properly locked for now. Multiple
clean up have been made but there is still a couple of them to do and the freeze
is coming.
Boris Feld <boris.feld@octobus.net> [Tue, 11 Jul 2017 12:27:58 +0200] rev 33435
vfs: allow to pass more argument to audit
We want to be able to do more precise check when auditing a path depending of
the intend of the file access (eg read versus write). So we now pass the 'mode'
value to 'audit' and update the audit function to accept them.
This will be put to use in the next changeset.
Martin Tietze <mtietze@gmx.com> [Wed, 12 Jul 2017 10:11:02 +0200] rev 33434
zsh_completion: add '--partial' flag to completions for 'import' (issue5618)
When using the 'import' command running ZSH together with its
Mercurial-specific completions the flag '--partial' (introduced in Mercurial
3.1, 2014-08-01) is not offered as completion option.
This patch adds it to the list of completions for the 'import' command.
Boris Feld <boris.feld@octobus.net> [Fri, 07 Jul 2017 10:04:05 +0200] rev 33433
configitems: register the 'bugzilla.password' config
Boris Feld <boris.feld@octobus.net> [Fri, 07 Jul 2017 10:04:03 +0200] rev 33432
configitems: register the 'bugzilla.mocklog' config
Matt Harbison <matt_harbison@yahoo.com> [Thu, 13 Jul 2017 22:57:11 -0400] rev 33431
test-amend: fix HGEDITOR shell script to run on Windows
Windows doesn't know how to launch *.sh directly. This workaround is used in
several other tests.
Matt Harbison <matt_harbison@yahoo.com> [Thu, 13 Jul 2017 22:47:35 -0400] rev 33430
test-paths: mask out JSON specific path differences for Windows
The backslashes in the local paths were being escaped with another backslash,
and $TESTTMP doesn't match against the double backslashed path. This doesn't
happen without the 'json' filter.
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Thu, 13 Jul 2017 03:17:59 +0900] rev 33429
tests: categorize entries in blacklist for fsmonitor for future reference