Summary:
This replaces RustError that might happen during `addcommits`, and allow us to
handle it without having a stacktrace.
Reviewed By: DurhamG
Differential Revision: D22539564
fbshipit-source-id: 356814b9baf0b31528dfc92d62b0dcf352bc1e24
Summary:
Extend `_log_exception` to inspect exceptions for metadata, and log any that is found to Scuba. Eventually I'd like to merge at least some of this information from the `perfpipe_hg_errors` table into the `perfpipe_dev_command_timers`.
Introduce `Tagged` mixin and `Fault` enum Python types for tagging Python exceptions.
Introduce `debugthrowexception` for testing Python error handling flow.
Reviewed By: DurhamG
Differential Revision: D22585764
fbshipit-source-id: f6300ae25db25d5e75fab9c2a03fb4f9beb06c1f
Summary:
So automation can detect abandoned transactions and run `hg recover`,
define an exit code. None of sysexit.h seemed to fit this case, so
start with 90.
Reviewed By: quark-zju
Differential Revision: D22198980
fbshipit-source-id: 5f267a2671c843f350668daaa14de34752244d4b
Summary:
Adds a simple ui.deprecate() function for deprecating code paths. It
has several levels of deprecation and can optionally automatically escalate
through those levels across a specified time frame.
The levels are:
- Log - just logs the usage to scuba
- Warn - same as Log but also prints a warning to the user
- Slow - same as Warn but also sleeps for 2 seconds
- OptIn - throws an exception, but hints that the exception can be bypassed by
setting 'deprecated.bypass-XXXX=True'
- Block - throws an exception that cannot be bypassed
I also call it from a few locations that are expected to be deprecated already.
Reviewed By: markbt
Differential Revision: D21890496
fbshipit-source-id: faddb301888ef75cc71d46ffb7374f3fe3d044bd
Summary:
The latest version of Black removes unneccessary parenthesis. Mercurial's
test-check-code currently uses extra parentheses to signal untranslated strings, so
Black's reformatting breaks this test.
Capitulate to Black by adding a new `_x` translation marker that means "untranslated".
Reviewed By: quark-zju
Differential Revision: D21426335
fbshipit-source-id: a6c26d7c6365c49530a7dee3a5f9ed71ff166835
Summary:
This allows providing context about errors, similar to Rust's "context"
features.
Reviewed By: sfilipco
Differential Revision: D20845160
fbshipit-source-id: 789a4c1b7356fd6eb4b1bcb71efd205d2d45e984
Summary:
On bad network link (such as on VPN), the reliability of the connection to
Mercurial might be fairly flaky. Instead of failing fetching files, let's retry
a bit first, in the hope that the connection will be back by then.
Reviewed By: quark-zju
Differential Revision: D20295255
fbshipit-source-id: d3038f5e4718b521ae4c3f2844f869a04ebb25e3
Summary: fixes printing for no match found in revlog match
Reviewed By: quark-zju
Differential Revision: D19652374
fbshipit-source-id: 55bfcbff7919ad817173241e2792df27311b931e
Summary:
Add a partial stub so pyre stops complaining about "bindings" being unknown.
Pyre's "search_path" was adjusted to read the new "pystubs" directory.
Reviewed By: DurhamG
Differential Revision: D19669131
fbshipit-source-id: a592ed411d1689058405689eb657e543b7172774
Summary:
The error message and the exception type are slightly different between the
Rust and Python ContentStore. For now, let's just fix this up manually.
Reviewed By: quark-zju
Differential Revision: D19394350
fbshipit-source-id: e432094a9dfcf605568a1890c0303b733e98d203
Summary:
Make cpython-ext free from business logic. This adds a bit overhead.
But it should be fine given the error cases are considered rare.
Reviewed By: markbt
Differential Revision: D19186692
fbshipit-source-id: daaffc1369a36c781d1badea822bf62a144eb54e
Summary:
The `map_pyerr<PE>` API is kind of hard to use correctly since the
code that calls `map_pyerr` does not really know the best suitable error type.
The existing code also "encourage"s the use of stdlib error types like
RuntimeError, ValueError, etc since the code is shorter, which is not great.
Error types from `mercurial.error` are better choices.
With previous diffs in this stack, we now decide the Python error type based
on the Rust error type. It's no longer necessary to specify an error type
with `map_pyerr<PE>`. So let's just drop the type parameter.
A `RustError` was added for error types that `cpython-ext` does not know how
to convert. We should avoid leaking it to the Python land by just implementing
how to convert `anyhow::Error` to `PyErr` in `cpython-ext`.
Reviewed By: markbt
Differential Revision: D19169527
fbshipit-source-id: f4563c36174cd51201b526bbc92a3f1c8a3da864
Summary:
Since we now have the indexedlog error type. Match it and print helpful
messages.
Reviewed By: markbt
Differential Revision: D19169207
fbshipit-source-id: cd874f651b681d2dbbb5aea613c56721c4ab6181
Summary:
In preparation for merging fb-mercurial sources to the Eden repository,
move everything from the top-level directory into an `eden/scm`
subdirectory.