Commit Graph

13 Commits

Author SHA1 Message Date
Zeyi (Rice) Fan
f1bec6dc68 mkscratch: remove old code
Summary: throw-in-trash-delete

Reviewed By: chadaustin

Differential Revision: D26534019

fbshipit-source-id: 59b0050a3851cb80da7cbeccf3940fd13094165f
2021-02-20 15:42:37 -08:00
Zeyi (Rice) Fan
58a9d11260 scratch: validate subdir path in mirror mode
Summary:
This diff ensures no one can exploit mkscratch's scratch directory. In reality probably no one would do this but just to add it as a precaution.

And also the renaming, I didn't land the rename changes in my previous diff and this diff fix that so we don't roll the "nested" mode name out.

Reviewed By: xavierd

Differential Revision: D26526702

fbshipit-source-id: 04ec883e4d1c0c3e9b54b6274e5113c8b4845b3f
2021-02-20 15:42:37 -08:00
Zeyi (Rice) Fan
77cc18b459 scratch: support nested scratch style
Summary:
Address yarn's `node_modules` problem on Winodws.

The design is debatable and probably not the best. Another approach could be simply special casing subdir path ends with `node_modules`. This won't require any user configuration but it would be a special case.

Reviewed By: chadaustin

Differential Revision: D26149393

fbshipit-source-id: b3e66cb2d4b70078bb25e7329988cd5ff8fdeadd
2021-02-01 21:17:14 -08:00
Saurabh Singh
a703572183 fb-scratch: stop building the package
Summary:
`scratch` provided by `fb-scratch` was replaced by `mkscratch` provided by
the Mercurial package. See linked task for details.

Reviewed By: quark-zju

Differential Revision: D23773840

fbshipit-source-id: de0582069ce1a09c3cd9fc6b02d2d149f70d0d78
2020-09-17 18:32:19 -07:00
Zeyi (Rice) Fan
619904bc69 re-implement normalize_windows_path
Summary: This diff fixes the issue that mkscratch does not build on Rust < 1.45.0

Reviewed By: xavierd

Differential Revision: D23325087

fbshipit-source-id: 7e737eb5bc0d75255a84c8ac353bf3a17c269300
2020-08-25 12:38:07 -07:00
Zeyi (Rice) Fan
7f0f310af3 handle extended-length on Windows
Summary:
On Windows, Rust's `std::fs::canonicalize` [1] will generate extended-length path that will include a `\\?\` prefix [2]. This has subsequently cause `encode` to generate a path that contains a question mark, which is an invalid path on Windows.

This diff teaches `encode` to handle extended-length path on Windows. It essentially converts the path back so it no longer contains the prefix.

[1] http://doc.rust-lang.org/1.45.2/std/fs/fn.canonicalize.html
[2] https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation

Reviewed By: wez

Differential Revision: D22956659

fbshipit-source-id: 54691e204d7cb481bdb40f62c6520c0f70c3f648
2020-08-24 21:38:12 -07:00
Zeyi (Rice) Fan
8934b0719d fix test on Windows
Summary: The original function is changing behavior on non-UNIX platforms. Let's honor it in tests too.

Reviewed By: wez

Differential Revision: D22901850

fbshipit-source-id: 7c4e7dbfa0526d482f86794758e7ad39feacce10
2020-08-04 10:37:25 -07:00
Xavier Deguillard
ef70d9eb08 scratch: silence warnings
Summary: The compiler was complaining about these on Windows.

Reviewed By: quark-zju

Differential Revision: D20250719

fbshipit-source-id: 89405e155875a4a549b243e93ce63cf3f53b1fab
2020-03-05 09:35:58 -08:00
Jun Wu
245f179697 scratch: drop dependency on telemetry
Summary:
The buck generated binary is 1.2GB in size. Drop dependency to reduce the size.
Dependent functions are re-invented.

New size is 31MB under `mode/opt` build, and 28MB under `mode/dev` build.

Reviewed By: wez

Differential Revision: D18900827

fbshipit-source-id: 536fa969d69f6261d812c2320795780d839b6ced
2019-12-20 16:14:19 -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
David Tolnay
b1793a4416 rust: Rename Fallible<T> to Result<T>
Summary:
This diff is preparation for migrating off of failure::Fail / failure::Error for errors in favor of errors that implement std::error::Error. The Fallible terminology is unique to failure and in non-failure code we should be using Result<T>. To minimize the size of the eventual diff that removes failure, this codemod replaces all use of Fallible with Result by:

- In modules that do not use Result<T, E>, we import `failure::Fallible as Result`;
- In modules that use a mix of Result<T, E> and Fallible<T> (only 5) we define `type Result<T, E = failure::Error> = std::result::Result<T, E>` to allow both Result<T> and Result<T, E> to work simultaneously.

Reviewed By: Imxset21

Differential Revision: D18499758

fbshipit-source-id: 9f5a54c47f81fdeedbc6003cef42a1194eee55bf
2019-11-14 14:11:01 -08:00
Adam Simpkins
46890ae1ec Merge fb-mercurial sources into the eden repository
Summary:
Merge the fb-mercurial code into the Eden repository, under the
`eden/scm` subdirectory.

Reviewed By: quark-zju

Differential Revision: D18445774

fbshipit-source-id: fc3307f9937e0c7e1c8f7d03c5102c4fe5dedb10
2019-11-13 20:20:32 -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