D5539: style: run yapf on a subset of mercurial

2020-01-24 Thread baymax (Baymax, Your Personal Patch-care Companion)
This revision now requires changes to proceed.
baymax added a comment.
baymax requested changes to this revision.


  There seems to have been no activities on this Diff for the past 3 Months.
  
  By policy, we are automatically moving it out of the `need-review` state.
  
  Please, move it back to `need-review` without hesitation if this diff should 
still be discussed.
  
  :baymax:need-review-idle:

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D5539/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D5539

To: durin42, #hg-reviewers, baymax
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5539: style: run yapf on a subset of mercurial

2019-01-09 Thread durin42 (Augie Fackler)
durin42 added a comment.


  I see a few minor issues here, but it's at least plausible?

INLINE COMMENTS

> minifileset.py:57-58
>  symbols = {
> -'all': lambda n, s: True,
> -'none': lambda n, s: False,
> -'size': lambda n, s: _sizep(tree[2])(s),
> +'all': lambda n,
> +s: True,
> +'none': lambda n,

yapf bug here, filed as https://github.com/google/yapf/issues/662

> scmwindows.py:53
>  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')

We could force this to one-per-line by adding a trailing comma.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5539

To: durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5539: style: run yapf on a subset of mercurial

2019-01-09 Thread durin42 (Augie Fackler)
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":