2014-11-04 10:03:09 +03:00
|
|
|
# Copyright 2014 Facebook Inc.
|
|
|
|
#
|
2017-06-15 14:20:52 +03:00
|
|
|
"""upload useful diagnostics and give instructions for asking for help
|
2014-11-04 10:03:09 +03:00
|
|
|
|
2017-06-15 14:20:52 +03:00
|
|
|
[rage]
|
|
|
|
# Name of the rpm binary
|
|
|
|
rpmbin = rpm
|
|
|
|
"""
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import socket
|
2018-05-16 19:35:08 +03:00
|
|
|
import struct
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
import subprocess
|
|
|
|
import tempfile
|
|
|
|
import time
|
|
|
|
import traceback
|
2017-06-15 14:20:52 +03:00
|
|
|
from functools import partial
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2017-03-07 12:27:12 +03:00
|
|
|
from mercurial import (
|
|
|
|
bookmarks,
|
2018-03-09 19:56:07 +03:00
|
|
|
cmdutil,
|
2017-03-07 12:27:12 +03:00
|
|
|
commands,
|
|
|
|
encoding,
|
|
|
|
error,
|
2018-03-01 23:23:39 +03:00
|
|
|
progress,
|
|
|
|
pycompat,
|
2017-05-22 23:38:37 +03:00
|
|
|
registrar,
|
2018-03-01 23:23:39 +03:00
|
|
|
scmutil,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
util,
|
2016-07-08 15:15:42 +03:00
|
|
|
)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
from mercurial.i18n import _
|
|
|
|
|
|
|
|
from . import shareutil
|
|
|
|
from .remotefilelog import constants, shallowutil
|
2014-11-04 10:03:09 +03:00
|
|
|
|
2017-10-31 06:48:06 +03:00
|
|
|
|
2014-11-04 10:03:09 +03:00
|
|
|
cmdtable = {}
|
2017-05-22 23:38:37 +03:00
|
|
|
command = registrar.command(cmdtable)
|
rage: silence exceptions when reading details
Summary:
rage is a basic tool to collect diagnostic information that should not break.
To ensure it works all the time, this patch:
- unbreaks hg rage from upstream change dad6404ccd
- wraps every non-trivial functions with `try`, `catch`
- adds a naive test about `hg rage --preview`
Test Plan:
Run `test-rage.t`. Comment out `import blackbox` and check:
```
hg blackbox -l20:
---------------------------
(Failed. See footnote [1])
[1]: global name 'blackbox' is not defined
Traceback (most recent call last):
File "/home/quark/fb-hgext/rage.py", line 22, in _failsafe
return func()
File "/home/quark/fb-hgext/rage.py", line 97, in <lambda>
_failsafe(lambda: hgcmd(blackbox.blackbox, limit=20))),
NameError: global name 'blackbox' is not defined
```
Reviewers: #sourcecontrol, wez, ttung, durham
Reviewed By: durham
Subscribers: durham, wez, mjpieters
Differential Revision: https://phabricator.fb.com/D2928778
Tasks: 10028490
Signature: t1:2928778:1455240651:d39ceed5d045e279160690e0a93a4e326d307db3
2016-02-12 00:00:33 +03:00
|
|
|
_failsafeerrors = []
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
rage: silence exceptions when reading details
Summary:
rage is a basic tool to collect diagnostic information that should not break.
To ensure it works all the time, this patch:
- unbreaks hg rage from upstream change dad6404ccd
- wraps every non-trivial functions with `try`, `catch`
- adds a naive test about `hg rage --preview`
Test Plan:
Run `test-rage.t`. Comment out `import blackbox` and check:
```
hg blackbox -l20:
---------------------------
(Failed. See footnote [1])
[1]: global name 'blackbox' is not defined
Traceback (most recent call last):
File "/home/quark/fb-hgext/rage.py", line 22, in _failsafe
return func()
File "/home/quark/fb-hgext/rage.py", line 97, in <lambda>
_failsafe(lambda: hgcmd(blackbox.blackbox, limit=20))),
NameError: global name 'blackbox' is not defined
```
Reviewers: #sourcecontrol, wez, ttung, durham
Reviewed By: durham
Subscribers: durham, wez, mjpieters
Differential Revision: https://phabricator.fb.com/D2928778
Tasks: 10028490
Signature: t1:2928778:1455240651:d39ceed5d045e279160690e0a93a4e326d307db3
2016-02-12 00:00:33 +03:00
|
|
|
def _failsafe(func):
|
|
|
|
try:
|
|
|
|
return func()
|
|
|
|
except Exception as ex:
|
|
|
|
index = len(_failsafeerrors) + 1
|
|
|
|
message = "[%d]: %s\n%s\n" % (index, str(ex), traceback.format_exc())
|
|
|
|
_failsafeerrors.append(message)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
return "(Failed. See footnote [%d])" % index
|
|
|
|
|
rage: silence exceptions when reading details
Summary:
rage is a basic tool to collect diagnostic information that should not break.
To ensure it works all the time, this patch:
- unbreaks hg rage from upstream change dad6404ccd
- wraps every non-trivial functions with `try`, `catch`
- adds a naive test about `hg rage --preview`
Test Plan:
Run `test-rage.t`. Comment out `import blackbox` and check:
```
hg blackbox -l20:
---------------------------
(Failed. See footnote [1])
[1]: global name 'blackbox' is not defined
Traceback (most recent call last):
File "/home/quark/fb-hgext/rage.py", line 22, in _failsafe
return func()
File "/home/quark/fb-hgext/rage.py", line 97, in <lambda>
_failsafe(lambda: hgcmd(blackbox.blackbox, limit=20))),
NameError: global name 'blackbox' is not defined
```
Reviewers: #sourcecontrol, wez, ttung, durham
Reviewed By: durham
Subscribers: durham, wez, mjpieters
Differential Revision: https://phabricator.fb.com/D2928778
Tasks: 10028490
Signature: t1:2928778:1455240651:d39ceed5d045e279160690e0a93a4e326d307db3
2016-02-12 00:00:33 +03:00
|
|
|
|
Refactoring rage.py
Summary:
A couple of clean-ups for rage.py. They are small and easy to review so I'm doing it in one diff:
- Change the default behavior to print instructions asking for help in the support group.
Since only about 20 hg rage (not counting test ones) tasks are created last year.
The old behavior of creating tasks is still accessible by using the `--oncall` flag.
- Collect more information:
- `hg sparse`
- `hg version`
- `obsstore size`
- `rpm -q mercurial`
- network information
- short `hg config` only including local configs
- Adjust the order of detailed message, move hg config down since it's very long.
- Remove atexit error printer. Instead, put them in rage info directly.
- Fix code style: remove underscores in variable names, remove unnecessary indentation.
- Mark it FBONLY since it uses `tasks` and `oncalls` which are not available outside.
Test Plan:
Make sure these all work as expected:
hg rage
hg rage --preview
hg rage --oncall
Reviewers: #sourcecontrol, ttung, rmcelroy
Reviewed By: rmcelroy
Subscribers: ikostia, ttung, rmcelroy, simonfar, mjpieters, sid0
Differential Revision: https://phabricator.fb.com/D3138673
Tasks: 10654995, 10332733
Signature: t1:3138673:1461070413:4547d8b7e438035d6af73a49094c10eab725af0d
2016-04-19 16:04:42 +03:00
|
|
|
def shcmd(cmd, input=None, check=True, keeperr=True):
|
|
|
|
_, _, _, p = util.popen4(cmd)
|
|
|
|
out, err = p.communicate(input)
|
|
|
|
if check and p.returncode:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(cmd + " error: " + err)
|
Refactoring rage.py
Summary:
A couple of clean-ups for rage.py. They are small and easy to review so I'm doing it in one diff:
- Change the default behavior to print instructions asking for help in the support group.
Since only about 20 hg rage (not counting test ones) tasks are created last year.
The old behavior of creating tasks is still accessible by using the `--oncall` flag.
- Collect more information:
- `hg sparse`
- `hg version`
- `obsstore size`
- `rpm -q mercurial`
- network information
- short `hg config` only including local configs
- Adjust the order of detailed message, move hg config down since it's very long.
- Remove atexit error printer. Instead, put them in rage info directly.
- Fix code style: remove underscores in variable names, remove unnecessary indentation.
- Mark it FBONLY since it uses `tasks` and `oncalls` which are not available outside.
Test Plan:
Make sure these all work as expected:
hg rage
hg rage --preview
hg rage --oncall
Reviewers: #sourcecontrol, ttung, rmcelroy
Reviewed By: rmcelroy
Subscribers: ikostia, ttung, rmcelroy, simonfar, mjpieters, sid0
Differential Revision: https://phabricator.fb.com/D3138673
Tasks: 10654995, 10332733
Signature: t1:3138673:1461070413:4547d8b7e438035d6af73a49094c10eab725af0d
2016-04-19 16:04:42 +03:00
|
|
|
elif keeperr:
|
|
|
|
out += err
|
|
|
|
return out
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2016-05-03 18:12:06 +03:00
|
|
|
def which(name):
|
Refactoring rage.py
Summary:
A couple of clean-ups for rage.py. They are small and easy to review so I'm doing it in one diff:
- Change the default behavior to print instructions asking for help in the support group.
Since only about 20 hg rage (not counting test ones) tasks are created last year.
The old behavior of creating tasks is still accessible by using the `--oncall` flag.
- Collect more information:
- `hg sparse`
- `hg version`
- `obsstore size`
- `rpm -q mercurial`
- network information
- short `hg config` only including local configs
- Adjust the order of detailed message, move hg config down since it's very long.
- Remove atexit error printer. Instead, put them in rage info directly.
- Fix code style: remove underscores in variable names, remove unnecessary indentation.
- Mark it FBONLY since it uses `tasks` and `oncalls` which are not available outside.
Test Plan:
Make sure these all work as expected:
hg rage
hg rage --preview
hg rage --oncall
Reviewers: #sourcecontrol, ttung, rmcelroy
Reviewed By: rmcelroy
Subscribers: ikostia, ttung, rmcelroy, simonfar, mjpieters, sid0
Differential Revision: https://phabricator.fb.com/D3138673
Tasks: 10654995, 10332733
Signature: t1:3138673:1461070413:4547d8b7e438035d6af73a49094c10eab725af0d
2016-04-19 16:04:42 +03:00
|
|
|
""" """
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
for p in encoding.environ.get("PATH", "/bin").split(pycompat.ospathsep):
|
2016-05-03 18:12:06 +03:00
|
|
|
path = os.path.join(p, name)
|
|
|
|
if os.path.exists(path):
|
|
|
|
return path
|
|
|
|
return None
|
Refactoring rage.py
Summary:
A couple of clean-ups for rage.py. They are small and easy to review so I'm doing it in one diff:
- Change the default behavior to print instructions asking for help in the support group.
Since only about 20 hg rage (not counting test ones) tasks are created last year.
The old behavior of creating tasks is still accessible by using the `--oncall` flag.
- Collect more information:
- `hg sparse`
- `hg version`
- `obsstore size`
- `rpm -q mercurial`
- network information
- short `hg config` only including local configs
- Adjust the order of detailed message, move hg config down since it's very long.
- Remove atexit error printer. Instead, put them in rage info directly.
- Fix code style: remove underscores in variable names, remove unnecessary indentation.
- Mark it FBONLY since it uses `tasks` and `oncalls` which are not available outside.
Test Plan:
Make sure these all work as expected:
hg rage
hg rage --preview
hg rage --oncall
Reviewers: #sourcecontrol, ttung, rmcelroy
Reviewed By: rmcelroy
Subscribers: ikostia, ttung, rmcelroy, simonfar, mjpieters, sid0
Differential Revision: https://phabricator.fb.com/D3138673
Tasks: 10654995, 10332733
Signature: t1:3138673:1461070413:4547d8b7e438035d6af73a49094c10eab725af0d
2016-04-19 16:04:42 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
|
|
|
rageopts = [
|
|
|
|
("p", "preview", None, _("print diagnostic information without doing arc paste"))
|
|
|
|
]
|
|
|
|
|
Refactoring rage.py
Summary:
A couple of clean-ups for rage.py. They are small and easy to review so I'm doing it in one diff:
- Change the default behavior to print instructions asking for help in the support group.
Since only about 20 hg rage (not counting test ones) tasks are created last year.
The old behavior of creating tasks is still accessible by using the `--oncall` flag.
- Collect more information:
- `hg sparse`
- `hg version`
- `obsstore size`
- `rpm -q mercurial`
- network information
- short `hg config` only including local configs
- Adjust the order of detailed message, move hg config down since it's very long.
- Remove atexit error printer. Instead, put them in rage info directly.
- Fix code style: remove underscores in variable names, remove unnecessary indentation.
- Mark it FBONLY since it uses `tasks` and `oncalls` which are not available outside.
Test Plan:
Make sure these all work as expected:
hg rage
hg rage --preview
hg rage --oncall
Reviewers: #sourcecontrol, ttung, rmcelroy
Reviewed By: rmcelroy
Subscribers: ikostia, ttung, rmcelroy, simonfar, mjpieters, sid0
Differential Revision: https://phabricator.fb.com/D3138673
Tasks: 10654995, 10332733
Signature: t1:3138673:1461070413:4547d8b7e438035d6af73a49094c10eab725af0d
2016-04-19 16:04:42 +03:00
|
|
|
|
|
|
|
def localconfig(ui):
|
|
|
|
result = []
|
|
|
|
for section, name, value in ui.walkconfig():
|
|
|
|
source = ui.configsource(section, name)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if source.find("/etc/") == -1 and source.find("/default.d/") == -1:
|
|
|
|
result.append("%s.%s=%s # %s" % (section, name, value, source))
|
Refactoring rage.py
Summary:
A couple of clean-ups for rage.py. They are small and easy to review so I'm doing it in one diff:
- Change the default behavior to print instructions asking for help in the support group.
Since only about 20 hg rage (not counting test ones) tasks are created last year.
The old behavior of creating tasks is still accessible by using the `--oncall` flag.
- Collect more information:
- `hg sparse`
- `hg version`
- `obsstore size`
- `rpm -q mercurial`
- network information
- short `hg config` only including local configs
- Adjust the order of detailed message, move hg config down since it's very long.
- Remove atexit error printer. Instead, put them in rage info directly.
- Fix code style: remove underscores in variable names, remove unnecessary indentation.
- Mark it FBONLY since it uses `tasks` and `oncalls` which are not available outside.
Test Plan:
Make sure these all work as expected:
hg rage
hg rage --preview
hg rage --oncall
Reviewers: #sourcecontrol, ttung, rmcelroy
Reviewed By: rmcelroy
Subscribers: ikostia, ttung, rmcelroy, simonfar, mjpieters, sid0
Differential Revision: https://phabricator.fb.com/D3138673
Tasks: 10654995, 10332733
Signature: t1:3138673:1461070413:4547d8b7e438035d6af73a49094c10eab725af0d
2016-04-19 16:04:42 +03:00
|
|
|
return result
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2016-04-28 21:13:28 +03:00
|
|
|
def obsoleteinfo(repo, hgcmd):
|
|
|
|
"""Return obsolescence markers that are relevant to smartlog revset"""
|
|
|
|
unfi = repo.unfiltered()
|
|
|
|
revs = scmutil.revrange(unfi, ["smartlog()"])
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
hashes = "|".join(unfi[rev].hex() for rev in revs)
|
|
|
|
markers = hgcmd("debugobsolete", rev=[])
|
|
|
|
pat = re.compile("(^.*(?:" + hashes + ").*$)", re.MULTILINE)
|
2016-04-28 21:13:28 +03:00
|
|
|
relevant = pat.findall(markers)
|
|
|
|
return "\n".join(relevant)
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2016-05-03 18:00:35 +03:00
|
|
|
def usechginfo():
|
|
|
|
"""FBONLY: Information about whether chg is enabled"""
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
files = {"system": "/etc/mercurial/usechg", "user": os.path.expanduser("~/.usechg")}
|
2016-05-03 18:00:35 +03:00
|
|
|
result = []
|
|
|
|
for name, path in files.items():
|
|
|
|
if os.path.exists(path):
|
|
|
|
with open(path) as f:
|
|
|
|
value = f.read().strip()
|
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
value = "(not set)"
|
|
|
|
result.append("%s: %s" % (name, value))
|
|
|
|
return "\n".join(result)
|
|
|
|
|
2016-05-03 18:00:35 +03:00
|
|
|
|
2017-06-15 14:20:52 +03:00
|
|
|
def rpminfo(ui):
|
2016-05-03 18:12:06 +03:00
|
|
|
"""FBONLY: Information about RPM packages"""
|
|
|
|
result = set()
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
rpmbin = ui.config("rage", "rpmbin", "rpm")
|
|
|
|
for name in ["hg", "hg.real"]:
|
2016-05-03 18:12:06 +03:00
|
|
|
path = which(name)
|
|
|
|
if not path:
|
|
|
|
continue
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
result.add(shcmd("%s -qf %s" % (rpmbin, path), check=False))
|
|
|
|
return "".join(result)
|
|
|
|
|
2016-05-03 18:12:06 +03:00
|
|
|
|
2017-11-03 19:34:36 +03:00
|
|
|
def infinitepushbackuplogs(ui, repo):
|
|
|
|
"""Contents of recent infinitepush log files."""
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
logdir = ui.config("infinitepushbackup", "logdir")
|
2017-11-03 19:34:36 +03:00
|
|
|
if not logdir:
|
|
|
|
return "infinitepushbackup.logdir not set"
|
|
|
|
try:
|
|
|
|
username = util.shortuser(ui.username())
|
|
|
|
except Exception:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
username = "unknown"
|
2017-11-03 19:34:36 +03:00
|
|
|
userlogdir = os.path.join(logdir, username)
|
|
|
|
if not os.path.exists(userlogdir):
|
|
|
|
return "log directory does not exist: %s" % userlogdir
|
|
|
|
|
|
|
|
# Log filenames are the reponame with the date (YYYYMMDD) appended.
|
|
|
|
reponame = os.path.basename(repo.origroot)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
logfiles = sorted([f for f in os.listdir(userlogdir) if f[:-8] == reponame])
|
2017-11-03 19:34:36 +03:00
|
|
|
if not logfiles:
|
|
|
|
return "no log files found for %s in %s" % (reponame, userlogdir)
|
|
|
|
|
|
|
|
# Display the last 100 lines from the most recent log files.
|
|
|
|
logs = []
|
|
|
|
linelimit = 100
|
|
|
|
for logfile in reversed(logfiles):
|
|
|
|
loglines = open(os.path.join(userlogdir, logfile)).readlines()
|
|
|
|
linecount = len(loglines)
|
|
|
|
if linecount > linelimit:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
logcontent = " ".join(loglines[-linelimit:])
|
|
|
|
logs.append(
|
|
|
|
"%s (first %s lines omitted):\n %s\n"
|
|
|
|
% (logfile, linecount - linelimit, logcontent)
|
|
|
|
)
|
2017-11-03 19:34:36 +03:00
|
|
|
break
|
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
logcontent = " ".join(loglines)
|
2017-11-03 19:34:36 +03:00
|
|
|
logs.append("%s:\n %s\n" % (logfile, logcontent))
|
|
|
|
linelimit -= linecount
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
return "".join(reversed(logs))
|
|
|
|
|
2017-11-03 19:34:36 +03:00
|
|
|
|
2018-03-12 12:52:27 +03:00
|
|
|
def readfsmonitorstate(repo):
|
2018-05-16 19:35:08 +03:00
|
|
|
"""
|
|
|
|
Read the fsmonitor.state file and pretty print some information from it.
|
|
|
|
Based on file format version 4. See hgext/fsmonitor/state.py for real
|
|
|
|
implementation.
|
|
|
|
"""
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
f = repo.vfs("fsmonitor.state", "rb")
|
2018-05-16 19:35:08 +03:00
|
|
|
versionbytes = f.read(4)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
version = struct.unpack(">I", versionbytes)[0]
|
2018-05-16 19:35:08 +03:00
|
|
|
data = f.read()
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
state = data.split("\0")
|
2018-05-16 19:35:08 +03:00
|
|
|
hostname, clock, ignorehash = state[0:3]
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
files = state[3:-1] # discard empty entry after final file
|
2018-05-16 19:35:08 +03:00
|
|
|
numfiles = len(files)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
prettyfiles = "\n".join(files[:20])
|
2018-05-16 19:35:08 +03:00
|
|
|
return """\
|
|
|
|
version: %d
|
|
|
|
hostname: %s
|
|
|
|
clock: %s
|
|
|
|
ignorehash: %s
|
|
|
|
files (first 20 of %d):
|
|
|
|
%s
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
""" % (
|
|
|
|
version,
|
|
|
|
hostname,
|
|
|
|
clock,
|
|
|
|
ignorehash,
|
|
|
|
numfiles,
|
|
|
|
prettyfiles,
|
|
|
|
)
|
|
|
|
|
2018-03-12 12:52:27 +03:00
|
|
|
|
2018-03-01 23:23:39 +03:00
|
|
|
def _makerage(ui, repo, **opts):
|
2017-12-15 17:38:23 +03:00
|
|
|
srcrepo = shareutil.getsrcrepo(repo)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2015-03-08 22:22:25 +03:00
|
|
|
def format(pair, basic=True):
|
|
|
|
if basic:
|
|
|
|
fmt = "%s: %s\n"
|
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
fmt = "%s:\n---------------------------\n%s\n"
|
2015-03-08 22:22:25 +03:00
|
|
|
return fmt % pair
|
|
|
|
|
2018-03-09 19:56:07 +03:00
|
|
|
def hgcmd(cmdname, *args, **additional_opts):
|
|
|
|
cmd, opts = cmdutil.getcmdanddefaultopts(cmdname, commands.table)
|
|
|
|
opts.update(additional_opts)
|
|
|
|
|
2016-09-29 21:19:52 +03:00
|
|
|
_repo = repo
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if "_repo" in opts:
|
|
|
|
_repo = opts["_repo"]
|
|
|
|
del opts["_repo"]
|
2016-09-29 21:19:52 +03:00
|
|
|
ui.pushbuffer(error=True)
|
2017-08-31 00:05:55 +03:00
|
|
|
try:
|
2018-03-09 19:56:07 +03:00
|
|
|
cmd(ui, _repo, *args, **opts)
|
2017-08-31 00:05:55 +03:00
|
|
|
finally:
|
|
|
|
return ui.popbuffer()
|
2015-03-08 22:22:25 +03:00
|
|
|
|
2017-12-15 17:38:23 +03:00
|
|
|
def hgsrcrepofile(filename):
|
|
|
|
if srcrepo.vfs.exists(filename):
|
|
|
|
return srcrepo.vfs(filename).read()
|
2017-11-03 19:34:36 +03:00
|
|
|
else:
|
2017-12-15 17:38:23 +03:00
|
|
|
return "File not found: %s" % srcrepo.vfs.join(filename)
|
2017-11-03 19:34:36 +03:00
|
|
|
|
2015-03-08 22:22:25 +03:00
|
|
|
basic = [
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
("date", time.ctime()),
|
|
|
|
("unixname", encoding.environ.get("LOGNAME")),
|
|
|
|
("hostname", socket.gethostname()),
|
|
|
|
("repo location", _failsafe(lambda: repo.root)),
|
|
|
|
(
|
|
|
|
"active bookmark",
|
|
|
|
_failsafe(lambda: bookmarks._readactive(repo, repo._bookmarks)),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"hg version",
|
|
|
|
_failsafe(lambda: __import__("mercurial.__version__").__version__.version),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"obsstore size",
|
|
|
|
_failsafe(lambda: str(srcrepo.vfs.stat("store/obsstore").st_size)),
|
|
|
|
),
|
2015-03-08 22:22:25 +03:00
|
|
|
]
|
|
|
|
|
2018-03-01 23:23:39 +03:00
|
|
|
oldcolormode = ui._colormode
|
2015-03-08 22:22:25 +03:00
|
|
|
ui._colormode = None
|
|
|
|
|
|
|
|
detailed = [
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
("df -h", _failsafe(lambda: shcmd("df -h", check=False))),
|
|
|
|
(
|
|
|
|
"hg sl (filtered)",
|
|
|
|
_failsafe(lambda: hgcmd("smartlog", template="{sl_debug}")),
|
|
|
|
),
|
2017-11-03 19:34:36 +03:00
|
|
|
# unfiltered smartlog for recent hidden changesets, including full
|
|
|
|
# node identity
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
(
|
|
|
|
"hg sl (unfiltered)",
|
|
|
|
_failsafe(
|
|
|
|
lambda: hgcmd(
|
|
|
|
"smartlog", _repo=repo.unfiltered(), template="{node}\n{sl_debug}"
|
|
|
|
)
|
|
|
|
),
|
|
|
|
),
|
2018-03-09 19:56:07 +03:00
|
|
|
# smartlog as the user sees it
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
(
|
|
|
|
'first 20 lines of "hg status"',
|
|
|
|
_failsafe(lambda: "\n".join(hgcmd("status").splitlines()[:20])),
|
|
|
|
),
|
|
|
|
("hg blackbox -l60", _failsafe(lambda: hgcmd("blackbox", limit=60))),
|
|
|
|
("hg summary", _failsafe(lambda: hgcmd("summary"))),
|
|
|
|
("hg config (local)", _failsafe(lambda: "\n".join(localconfig(ui)))),
|
|
|
|
("hg sparse", _failsafe(lambda: hgcmd("sparse"))),
|
|
|
|
("usechg", _failsafe(usechginfo)),
|
|
|
|
("rpm info", _failsafe(partial(rpminfo, ui))),
|
|
|
|
("klist", _failsafe(lambda: shcmd("klist", check=False))),
|
|
|
|
("ifconfig", _failsafe(lambda: shcmd("ifconfig"))),
|
|
|
|
(
|
|
|
|
"airport",
|
|
|
|
_failsafe(
|
|
|
|
lambda: shcmd(
|
|
|
|
"/System/Library/PrivateFrameworks/Apple80211."
|
|
|
|
+ "framework/Versions/Current/Resources/airport "
|
|
|
|
+ "--getinfo",
|
|
|
|
check=False,
|
|
|
|
)
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("hg debugobsolete <smartlog>", _failsafe(lambda: obsoleteinfo(repo, hgcmd))),
|
|
|
|
(
|
|
|
|
"infinitepush backup state",
|
|
|
|
_failsafe(lambda: hgsrcrepofile("infinitepushbackupstate")),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"infinitepush backup logs",
|
|
|
|
_failsafe(lambda: infinitepushbackuplogs(ui, repo)),
|
|
|
|
),
|
|
|
|
("hg config (all)", _failsafe(lambda: hgcmd("config"))),
|
|
|
|
("fsmonitor state", _failsafe(lambda: readfsmonitorstate(repo))),
|
2015-03-08 22:22:25 +03:00
|
|
|
]
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
msg = ""
|
2018-03-01 23:23:39 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if util.safehasattr(repo, "name"):
|
2017-10-31 06:48:06 +03:00
|
|
|
# Add the contents of both local and shared pack directories.
|
|
|
|
packlocs = {
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"local": lambda category: shallowutil.getlocalpackpath(
|
|
|
|
repo.svfs.vfs.base, category
|
|
|
|
),
|
|
|
|
"shared": lambda category: shallowutil.getcachepackpath(repo, category),
|
2017-10-31 06:48:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
for loc, getpath in packlocs.iteritems():
|
|
|
|
for category in constants.ALL_CATEGORIES:
|
|
|
|
path = getpath(category)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
detailed.append(
|
|
|
|
(
|
|
|
|
"%s packs (%s)" % (loc, constants.getunits(category)),
|
|
|
|
"%s:\n%s"
|
|
|
|
% (path, _failsafe(lambda: shcmd("ls -lhS %s" % path))),
|
|
|
|
)
|
|
|
|
)
|
2017-10-31 06:48:06 +03:00
|
|
|
|
2016-06-07 21:40:24 +03:00
|
|
|
# This is quite slow, so we don't want to do it by default
|
|
|
|
if ui.configbool("rage", "fastmanifestcached", False):
|
|
|
|
detailed.append(
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
(
|
|
|
|
'hg sl -r "fastmanifestcached()"',
|
|
|
|
_failsafe(lambda: hgcmd("smartlog", rev=["fastmanifestcached()"])),
|
|
|
|
)
|
2016-06-07 21:40:24 +03:00
|
|
|
)
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
msg = (
|
|
|
|
"\n".join(map(format, basic))
|
|
|
|
+ "\n"
|
|
|
|
+ "\n".join(map(lambda x: format(x, False), detailed))
|
|
|
|
)
|
Refactoring rage.py
Summary:
A couple of clean-ups for rage.py. They are small and easy to review so I'm doing it in one diff:
- Change the default behavior to print instructions asking for help in the support group.
Since only about 20 hg rage (not counting test ones) tasks are created last year.
The old behavior of creating tasks is still accessible by using the `--oncall` flag.
- Collect more information:
- `hg sparse`
- `hg version`
- `obsstore size`
- `rpm -q mercurial`
- network information
- short `hg config` only including local configs
- Adjust the order of detailed message, move hg config down since it's very long.
- Remove atexit error printer. Instead, put them in rage info directly.
- Fix code style: remove underscores in variable names, remove unnecessary indentation.
- Mark it FBONLY since it uses `tasks` and `oncalls` which are not available outside.
Test Plan:
Make sure these all work as expected:
hg rage
hg rage --preview
hg rage --oncall
Reviewers: #sourcecontrol, ttung, rmcelroy
Reviewed By: rmcelroy
Subscribers: ikostia, ttung, rmcelroy, simonfar, mjpieters, sid0
Differential Revision: https://phabricator.fb.com/D3138673
Tasks: 10654995, 10332733
Signature: t1:3138673:1461070413:4547d8b7e438035d6af73a49094c10eab725af0d
2016-04-19 16:04:42 +03:00
|
|
|
if _failsafeerrors:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
msg += "\n" + "\n".join(_failsafeerrors)
|
Refactoring rage.py
Summary:
A couple of clean-ups for rage.py. They are small and easy to review so I'm doing it in one diff:
- Change the default behavior to print instructions asking for help in the support group.
Since only about 20 hg rage (not counting test ones) tasks are created last year.
The old behavior of creating tasks is still accessible by using the `--oncall` flag.
- Collect more information:
- `hg sparse`
- `hg version`
- `obsstore size`
- `rpm -q mercurial`
- network information
- short `hg config` only including local configs
- Adjust the order of detailed message, move hg config down since it's very long.
- Remove atexit error printer. Instead, put them in rage info directly.
- Fix code style: remove underscores in variable names, remove unnecessary indentation.
- Mark it FBONLY since it uses `tasks` and `oncalls` which are not available outside.
Test Plan:
Make sure these all work as expected:
hg rage
hg rage --preview
hg rage --oncall
Reviewers: #sourcecontrol, ttung, rmcelroy
Reviewed By: rmcelroy
Subscribers: ikostia, ttung, rmcelroy, simonfar, mjpieters, sid0
Differential Revision: https://phabricator.fb.com/D3138673
Tasks: 10654995, 10332733
Signature: t1:3138673:1461070413:4547d8b7e438035d6af73a49094c10eab725af0d
2016-04-19 16:04:42 +03:00
|
|
|
|
2018-03-01 23:23:39 +03:00
|
|
|
ui._colormode = oldcolormode
|
|
|
|
return msg
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
|
|
|
@command("^rage", rageopts, _("hg rage"))
|
2018-03-01 23:23:39 +03:00
|
|
|
def rage(ui, repo, *pats, **opts):
|
|
|
|
"""collect useful diagnostics for asking help from the source control team
|
|
|
|
|
|
|
|
The rage command collects useful diagnostic information.
|
|
|
|
|
|
|
|
By default, the information will be uploaded to Phabricator and
|
|
|
|
instructions about how to ask for help will be printed.
|
|
|
|
|
|
|
|
After submitting to Phabricator, it prints configerable advice::
|
|
|
|
|
2018-03-06 03:51:55 +03:00
|
|
|
[rage]
|
2018-03-01 23:23:39 +03:00
|
|
|
advice = Please see our FAQ guide: https://...
|
|
|
|
|
|
|
|
"""
|
|
|
|
with progress.spinner(ui, "Generating paste"):
|
|
|
|
msg = _makerage(ui, repo, **opts)
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if opts.get("preview"):
|
|
|
|
ui.write("%s\n" % msg)
|
2015-12-03 05:44:42 +03:00
|
|
|
return
|
|
|
|
|
2018-03-01 23:23:39 +03:00
|
|
|
with progress.spinner(ui, "Saving paste"):
|
2018-03-22 18:49:00 +03:00
|
|
|
try:
|
|
|
|
p = subprocess.Popen(
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
["arc", "paste", "--lang", "hgrage", "--title", "hgrage"],
|
2018-03-22 18:49:00 +03:00
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stdin=subprocess.PIPE,
|
2018-03-23 00:20:28 +03:00
|
|
|
stderr=subprocess.PIPE,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
shell=pycompat.iswindows,
|
|
|
|
)
|
|
|
|
out, err = p.communicate(input=msg + "\n")
|
2018-03-22 18:49:00 +03:00
|
|
|
ret = p.returncode
|
2018-05-03 06:52:00 +03:00
|
|
|
except OSError:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.write(_("Failed calling arc. (is it in your PATH?)\n"))
|
2018-03-22 18:49:00 +03:00
|
|
|
ret = 1
|
2018-03-01 23:23:39 +03:00
|
|
|
|
2017-12-21 06:01:30 +03:00
|
|
|
if ret:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
fd, tmpname = tempfile.mkstemp(prefix="hg-rage-")
|
|
|
|
with os.fdopen(fd, r"w") as tmpfp:
|
rage: use conduit instead of arc cli
Summary:
The arc cli often depends on some checked-in code. If the repo is in a bad
state (when `hg rage` is most often needed), then arc may fail to load. A
less flaky approach is to create the paste by calling conduit directly instead
of relying on the arc cli.
* The paste now has a title – it's "hg rage for path/to/repo".
* If the paste creation fails, then the rage content is saved to a temp file.
Test Plan:
Confirmed that the paste and the temp files had the `hg rage` content:
* Success:
```
$ hg rage
Please post your problem and the following link at xxx (xxx) for help:
xxx/P58168469
```
* Failures:
```
# Missing "hosts" in ~/.arcconfig:
$ hg rage
arcconfig configuration problem.
No paste was created.
Saved contents to /var/folders/jr/_rg2cglx58z6_fnksmnlmc2w71b1w9/T/hg-rage-fMVgGr
# Bad "user" in ~/.arcconfig:
$ hg rage
Error talking to phabricator.
No paste was created.
Saved contents to /var/folders/jr/_rg2cglx58z6_fnksmnlmc2w71b1w9/T/hg-rage-HeWjHA
# Off the corporate network:
$ hg rage
Bad response from phabricator.
No paste was created.
Saved contents to/var/folders/jr/_rg2cglx58z6_fnksmnlmc2w71b1w9/T/hg-rage-x4IBMT
```
Reviewers: #mercurial, medson, rmcelroy, mitrandir
Reviewed By: medson, rmcelroy, mitrandir
Subscribers: #mercurial, mitrandir, rmcelroy, medson, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D5793911
Tasks: T19966776
Signature: 5793911:1504883514:29dc2c388819ba0d570a69f97eacb77884a2f983
2017-09-09 01:11:06 +03:00
|
|
|
tmpfp.write(msg)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.write(
|
|
|
|
_(
|
|
|
|
"Failed to post the diagnostic paste to Phabricator, "
|
|
|
|
"but its contents have been written to:\n\n"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
ui.write(_(" %s\n") % tmpname, label="rage.link")
|
|
|
|
ui.write(
|
|
|
|
_("\nPlease include this file in the %s.\n")
|
|
|
|
% ui.config("ui", "supportcontact")
|
|
|
|
)
|
2017-12-21 06:01:30 +03:00
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.write(
|
|
|
|
_("Please post in %s with the following link:\n\n")
|
|
|
|
% (ui.config("ui", "supportcontact"))
|
|
|
|
)
|
|
|
|
ui.write(" " + out + "\n", label="rage.link")
|
|
|
|
ui.write(ui.config("rage", "advice", "") + "\n")
|
|
|
|
|
|
|
|
|
|
|
|
colortable = {"rage.link": "blue bold"}
|