durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
I've tried to pick knobs that more or less conform to our current
style. I ran the formatter on the same set of files as the black
proposal (see https://phab.mercurial-scm.org/D5064), but it resulted in many
fewer edits.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5539
AFFECTED FILES
.style.yapf
mercurial/dirstateguard.py
mercurial/httpconnection.py
mercurial/lsprofcalltree.py
mercurial/mergeutil.py
mercurial/minifileset.py
mercurial/node.py
mercurial/policy.py
mercurial/pushkey.py
mercurial/rcutil.py
mercurial/scmposix.py
mercurial/scmwindows.py
mercurial/state.py
tests/test-check-code.t
CHANGE DETAILS
diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -42,6 +42,7 @@
.hgsigs
.hgtags
.jshintrc
+ .style.yapf
CONTRIBUTING
CONTRIBUTORS
COPYING
diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -4,7 +4,6 @@
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
-
"""
This file contains class to wrap the state for commands and other
related logic.
diff --git a/mercurial/scmwindows.py b/mercurial/scmwindows.py
--- a/mercurial/scmwindows.py
+++ b/mercurial/scmwindows.py
@@ -32,7 +32,8 @@
if f.endswith('.rc'):
rcpath.append(os.path.join(progrcd, f))
# else look for a system rcpath in the registry
-value = util.lookupreg('SOFTWARE\\Mercurial', None,
+value = util.lookupreg('SOFTWARE\\Mercurial',
+ None,
winreg.HKEY_LOCAL_MACHINE)
if not isinstance(value, str) or not value:
return rcpath
@@ -49,8 +50,7 @@
def userrcpath():
'''return os-specific hgrc search path to the user dir'''
home = os.path.expanduser('~')
-path = [os.path.join(home, 'mercurial.ini'),
-os.path.join(home, '.hgrc')]
+path = [os.path.join(home, 'mercurial.ini'), os.path.join(home, '.hgrc')]
userprofile = encoding.environ.get('USERPROFILE')
if userprofile and userprofile != home:
path.append(os.path.join(userprofile, 'mercurial.ini'))
diff --git a/mercurial/scmposix.py b/mercurial/scmposix.py
--- a/mercurial/scmposix.py
+++ b/mercurial/scmposix.py
@@ -22,9 +22,11 @@
rcs = [os.path.join(path, 'hgrc')]
rcdir = os.path.join(path, 'hgrc.d')
try:
-rcs.extend([os.path.join(rcdir, f)
-for f, kind in util.listdir(rcdir)
-if f.endswith(".rc")])
+rcs.extend([
+os.path.join(rcdir,
+ f) for f,
+kind in util.listdir(rcdir) if f.endswith(".rc")
+])
except OSError:
pass
return rcs
@@ -53,13 +55,17 @@
if confighome is None or not os.path.isabs(confighome):
confighome = os.path.expanduser('~/.config')
-return [os.path.expanduser('~/.hgrc'),
-os.path.join(confighome, 'hg', 'hgrc')]
+return [
+os.path.expanduser('~/.hgrc'),
+os.path.join(confighome,
+ 'hg',
+ 'hgrc')
+]
def termsize(ui):
try:
import termios
-TIOCGWINSZ = termios.TIOCGWINSZ # unavailable on IRIX (issue3449)
+TIOCGWINSZ = termios.TIOCGWINSZ # unavailable on IRIX (issue3449)
except (AttributeError, ImportError):
return 80, 24
diff --git a/mercurial/rcutil.py b/mercurial/rcutil.py
--- a/mercurial/rcutil.py
+++ b/mercurial/rcutil.py
@@ -43,9 +43,15 @@
if env is None:
env = encoding.environ
checklist = [
-('EDITOR', 'ui', 'editor'),
-('VISUAL', 'ui', 'editor'),
-('PAGER', 'pager', 'pager'),
+('EDITOR',
+ 'ui',
+ 'editor'),
+('VISUAL',
+ 'ui',
+ 'editor'),
+('PAGER',
+ 'pager',
+ 'pager'),
]
result = []
for envname, section, configname in checklist:
diff --git a/mercurial/pushkey.py b/mercurial/pushkey.py
--- a/mercurial/pushkey.py
+++ b/mercurial/pushkey.py
@@ -22,11 +22,16 @@
n.pop('obsolete')
return n
-_namespaces = {"namespaces": (lambda *x: False, _nslist),
- "bookmarks": (bookmarks.pushbookmark, bookmarks.listbookmarks),
- "phases": (phases.pushphase, phases.listphases),
- "obsolete": (obsolete.pushmarker, obsolete.listmarkers),
- }
+_namespaces = {
+"namespaces": (lambda *x: False,
+ _nslist),
+"bookmarks": (bookmarks.pushbookmark,
+ bookmarks.listbookmarks),
+"phases": (phases.pushphase,
+ phases.listphases),
+"obsolete":