Commit Graph

13 Commits

Author SHA1 Message Date
Zeyi (Rice) Fan
c78cf6ca3b hgmain: check if EdenFS is running on Windows
Summary:
On Windows, some Mercurial commands may create files in `.hg` directory even if
EdenFS is not running. As a result, the command itself will fail while the file
still left in the directory. Users typically will then start EdenFS and repeat
the same command.

However, due to the current design of EdenFS, it will not be able to recognize
these files created when it is stopped and return errors for any attempts to
write/remove the file, generate another error. Users then need to stop EdenFS
and manually remove the file in `.hg` directory to recover the repository. This
creates a very bad user experience.

The correct way to fix this is to teach EdenFS to track the modifications
happened when it is not running, however this will take a few weeks to get
there. For a temporary measurement, we teach Mercurial to abort when EdenFS
isn't running to avoid trickier recoveries.

Reviewed By: quark-zju

Differential Revision: D24001090

fbshipit-source-id: abc1ebcdae3819756fe64b5321f52a6e62c0c360
2020-09-30 15:39:34 -07:00
David Tolnay
e62b176170 Prepare for rustfmt 2.0
Summary:
Generated by formatting with rustfmt 2.0.0-rc.2 and then a second time with fbsource's current rustfmt (1.4.14).

This results in formatting for which rustfmt 1.4 is idempotent but is closer to the style of rustfmt 2.0, reducing the amount of code that will need to change atomically in that upgrade.

 ---

*Why now?* **:** The 1.x branch is no longer being developed and fixes like https://github.com/rust-lang/rustfmt/issues/4159 (which we need in fbcode) only land to the 2.0 branch.

 ---

Reviewed By: zertosh

Differential Revision: D23568779

fbshipit-source-id: 477200f35b280a4f6471d8e574e37e5f57917baf
2020-09-07 20:47:59 -07:00
Durham Goode
3ac2be361a configs: move fbrules to a Facebook only part of the crate
Summary:
We'll be adding a bunch of Facebook specific configuration and values
here. Let's move it to someplace not open source.

Reviewed By: quark-zju

Differential Revision: D21241038

fbshipit-source-id: 2ac9cdce40b1b46f15f171d9d1f6b6692dcd29bf
2020-05-01 13:17:21 -07:00
Andres Suarez
7ebf66c8b8 chg: avoid needless allocations
Summary:
* Unnecessary clone of `osstring_to_local_cstring` value.
* Unnecessary UTF-8 conversion in `file_decision`.
* Neater "debugpython" if.
* Unnecessary `CHGDISABLE` `OsString` allocation.

Reviewed By: quark-zju

Differential Revision: D21171329

fbshipit-source-id: 1241066b4a01600c436709d1a5fe95d6a13634ba
2020-04-22 09:34:27 -07:00
Jun Wu
52bb1ab77e clidispatch: add start_pager API for IO
Summary:
Implement the core API to start pager in native Rust. For now it is only
enabled for the entire command if `--pager=always` is set.

Reviewed By: DurhamG

Differential Revision: D20849644

fbshipit-source-id: 860b4e18d841da607864c3447d78dbac126f5f18
2020-04-07 15:57:06 -07:00
Jun Wu
6e7cffbda4 chg: disable chg when file paths like /proc/self/... are used
Summary: This will allow bash users to use things like `hg commit -l <(echo foo)`.

Reviewed By: krallin

Differential Revision: D20810653

fbshipit-source-id: 42e420e608d41704387a9011cf14a28f92192e5d
2020-04-02 10:09:50 -07:00
Durham Goode
0913d16fb1 py3: support python3 for the builtin interpretter
Summary:
The builtin interpreter currently only responds to "python" as the
input arg. Let's also support python3.

Reviewed By: farnz

Differential Revision: D19613372

fbshipit-source-id: 5d2eed85c2d9546808c1661f12681b03f1edc40f
2020-01-29 10:11:24 -08:00
Jun Wu
8703970cea py3: update Cargo.toml to make py3 buildable
Summary:
This makes `make hg3` work. It requires cleaning up the `build` directory when
switching between py2 and py3 build, which will be fixed later.

Reviewed By: DurhamG

Differential Revision: D19604824

fbshipit-source-id: 060ff313420126a5dba935c4451b45dc9af45f13
2020-01-28 13:39:38 -08:00
Xavier Deguillard
fe8855e9fb hgmain: initialize fbinit
Summary:
The memcache code assumes it's initialized, let's actually do it.

The test change is required due to fbinit installing its own SIGTERM handler
that shows a backtrace. Installing our own SIGTERM handler makes it closer to
what Mercurial does already.

Reviewed By: quark-zju

Differential Revision: D19518698

fbshipit-source-id: bc8c2311e65c9c00678756abae3979ccda4453ea
2020-01-23 08:57:22 -08:00
Jun Wu
1be7e2ea4c hgmain: explicitly flush IO on exit
Summary: Without this, `hg status --print0` can output nothing and break tests.

Reviewed By: xavierd

Differential Revision: D19387317

fbshipit-source-id: 4feb82889df9bd1705526027f491db90a2a5f946
2020-01-14 09:42:48 -08:00
Jun Wu
4dd04bf02f hgpython: replace hgpython interpreter with native Rust implementation
Summary:
The hgpython interpreter was used to run Python scripts in tests that might
rely on Mercurial modules.

The previous hgpython implementation is Python PAR based, which does not have
access to native Rust modules like bindings. Change it to use the native
"hg debugpython" implementation that is more compatible.

Reviewed By: markbt

Differential Revision: D19190496

fbshipit-source-id: 9791dbf9ba0ed92de702291faa9145f01b05ec40
2019-12-22 11:27:27 -08:00
David Tolnay
d1d8fb939a Switch from failure::Fail trait to std::error::Error for errors
Summary:
This diff replaces eden's dependencies on failure::Error with anyhow::Error.

Failure's error type requires all errors to have an implementation of failure's own failure::Fail trait in order for cause chains and backtraces to work. The necessary methods for this functionality have made their way into the standard library error trait, so modern error libraries build directly on std::error::Error rather than something like failure::Fail. Once we are no longer tied to failure 0.1's Fail trait, different parts of the codebase will be free to use any std::error::Error-based libraries they like while still working nicely together.

Reviewed By: xavierd

Differential Revision: D18576093

fbshipit-source-id: e2d862b659450f2969520d9b74877913fabb2e5d
2019-11-22 08:53:31 -08:00
Adam Simpkins
ab3a7cb21f Move fb-mercurial sources into an eden/scm subdirectory.
Summary:
In preparation for merging fb-mercurial sources to the Eden repository,
move everything from the top-level directory into an `eden/scm`
subdirectory.
2019-11-13 16:04:48 -08:00