Summary: This is now enabled for the entire fleet, let's hardcode this in the code now.
Reviewed By: kulshrax
Differential Revision: D16392289
fbshipit-source-id: 462152ded12d00cf8218526d51a911d6fe5975ca
Summary: Checks if the retrieved content of a file is equal to a `magic string` representing a blacklisted file. If so, then the content is replaced by a readable text which suggests a `rebase` or `update` to a newer commit.
Reviewed By: ikostia
Differential Revision: D16260011
fbshipit-source-id: ac1d40132b9c947927271d8e6efda98b19dce984
Summary: The debug messages from Eden API provide Source Control team members with useful diagnostic information about HTTP data fetching, but they have the potential to be spammy when written to log files. To prevent log spam, let's only print these messages during interactive usage.
Reviewed By: quark-zju
Differential Revision: D16445346
fbshipit-source-id: 001dc75e440eaf797f4f953648453086421f624e
Summary:
The `fbsourcepylibrary` class only copies the source files if the destination
directory does not exist. Once the files have been copied, subsequent builds
will not pick up new versions. This means builds can be stale.
Remove the special case of `_isready`. This will fall back to the default
implementation which will copy the files each time the build happens.
Reviewed By: quark-zju
Differential Revision: D16438778
fbshipit-source-id: 66dc0b69b427650087cfb822acdbf1fc797babbc
Summary:
When using fetchpacks, memcache will write to an indexedlog, which can't be
repacked. I'm also suspecting that there is a race between this repack, and
hg_memcache_client opening the newly created packfiles which can cause the
misses to not be sent to memcache.
Reviewed By: kulshrax
Differential Revision: D16432538
fbshipit-source-id: 62362682474883bcd58249791c02b9fed5cb8fea
Summary:
Most operations do not work on iterate on all the files of the repository.
Most operations filter the data set in some way. In many cases this filtering
is to a set of files and in some cases using patterns or subdirectories.
The Python code uses `match.py` to represent this filtering. The parallel
data structure in the rust code is `pathmatcher::Matcher`.
This diff adds `files` integration with `pathmatcher::Matcher`.
Reviewed By: quark-zju
Differential Revision: D16352527
fbshipit-source-id: 8b61ac7399f581773bf61ff648634cbc6e1a27b6
Summary:
This allows us to use python matcher objects in rust. Particularly we are
looking at using these in the manifest implementation for filtering the
file set that is returned.
Reviewed By: quark-zju
Differential Revision: D16352533
fbshipit-source-id: fd6bde6d9223203c69593d5e8830946170363243
Summary:
Title. Small clean up. I think that this makes sense because the code in
file.rs is self contained. It provides a distraction free environment for
adding methods to the structures in there.
Reviewed By: quark-zju
Differential Revision: D16352531
fbshipit-source-id: c23e943198e0a4b50aa00c75e67b13bc4c3ee976
Summary:
"matcher.py" is used in several places where the the file tree is traversed.
We need to use implement the matcher functionality in the Rust manifest
implementation. We define a common type to be used in our internal code.
In our current state of interfacing a lot with Python, fast paths of matching
full trees is useful so we have 3 states for matching a directory:
* everything in the directory subtree should be returned
* nothing in the directory subtree should be returned
* another state where there is no fast path and the directory should be
traversed recusively; this state is always valid to return and doe not
impact correctness
The interface for the Matcher is defined in relationship to RepoPath. We store
paths internally in the same binary format no matter the operating system path
representation. Using std::path would incur a translation cost.
Reviewed By: quark-zju
Differential Revision: D16352528
fbshipit-source-id: 61b259f4347cfaf6f74ee36fa5955e45e4beb739
Summary: Bindings so that the rust manifest code can be used in Python.
Reviewed By: quark-zju
Differential Revision: D16352532
fbshipit-source-id: 34d4522f5e084f531f31bcd21770950f15f2fe13
Summary:
In cross language code it is useful to convert to a String before giving the
object up. Without this method we would have to copy the string before dropping
the current object. This method provides an efficient method for getting the
String from RepoPath objects.
str conversions show up in similar places places.
Reviewed By: quark-zju
Differential Revision: D16352530
fbshipit-source-id: 159f522d0c19287aed29b8cce99c1675b5d801fc
Summary: Remove final fancyopts call to have all python parsing being done through native rust codepath, as well as clean-up some deprecated flags that would be special handling.
Reviewed By: quark-zju
Differential Revision: D16156284
fbshipit-source-id: ec5ccaeb982c78426e12ff1d7342b4ea6653e98e
Summary: Add errors and map them to python exceptions to emulate the original python error handling behavior.
Reviewed By: quark-zju
Differential Revision: D16136571
fbshipit-source-id: eb999162cad040566e30b460f2b873efb05fc67a
Summary: To support 'static and dynamic lifetimes the FlagDefinition will have a Cow<'a, str> allowing the API to remain the same and still be used with strings passed from python.
Reviewed By: quark-zju
Differential Revision: D16136148
fbshipit-source-id: 670925549919a0965287b264704150f6ab638a18
Summary:
Replace the second to last fancyopts call with pure rust code parsing and error handling.
Make slightly nicer help messages for ambiguous commands instead of just saying every possible command possible.
Reviewed By: quark-zju
Differential Revision: D16063049
fbshipit-source-id: bfd9e58649b1de2d3485069ce8d5646927bc77f4
Summary: Expose the alias expansion native rust code to the Python code to be able to utilize the earlier alias expansion as well as custom Rust errors.
Reviewed By: quark-zju
Differential Revision: D16063040
fbshipit-source-id: 58cd8c9f16e07687545ebf19332b32fce8db278d
Summary:
Alias expansion originally occurs in mercurial through a chain of command handlers that point at their alias.
Now, aliases can be fully expanded early on into parsing to only resolve actual commands and not have to follow a chain of executions.
Reviewed By: quark-zju
Differential Revision: D16059122
fbshipit-source-id: cf28fba4a131ab29ceda87bc3e90d7a434e06625
Summary: Very small library ( one file ) that allows for posix-style splitting. The library was not vendored in third-party and therefore was just added to unblock as fast as possible.
Reviewed By: quark-zju
Differential Revision: D15911319
fbshipit-source-id: 2820d5beb5b3493a507f00f4b94e93b0405cf991
Summary: Replacing another fancyopts call to be parsed by native Rust code. This diff introduces slightly hacky feeling behavior in order to handle cycles and resolving aliases, but will be fixed in a follow-up diff where Rust will fully expand the aliases completely removing the need for this confusing alias resolving, chaining, and execution.
Reviewed By: quark-zju
Differential Revision: D15902758
fbshipit-source-id: 11d9a479989a23de09bf96f8020d2fded6c06351
Summary:
Copytrace modified the global definitions table which was making it very difficult to keep track of side-effects as the code was executed, as well as making it harder to replace the fancyopts calls with native Rust.
Since the copytrace behavior can be achieved through a configuration, it now will no longer modify the global definitions table, and will display the correct flag for a user to use in order to get this same behavior.
Reviewed By: quark-zju
Differential Revision: D15902449
fbshipit-source-id: 1c254162d56823e65085b7047bb37513f187b487
Summary: Replace the next usage of fancyopts in dispatch.py with native rust code, and ensure all tests pass with this replacement.
Reviewed By: quark-zju
Differential Revision: D15857997
fbshipit-source-id: ec8722bfe661731a14cb324e97846f861bd60bc8
Summary:
The current Python parsing library fancyopts does an early parse for global flags, as well as slightly different logic for parsing out flags.
Switching this fancyopts call should allow fancyopts to be completely replaced by the native code path, and start using Rust parsing for hg.
This enforces command line arguments to be utf8. At Facebook, our `hg` wrapper already crashes if that is not the case. So it shouldn't cause new issues.
Reviewed By: quark-zju
Differential Revision: D15837079
fbshipit-source-id: 95634ebc814f8865960181f23282e5283068057c
Summary: The global flags currently in Python should be ported to Rust definitions
Reviewed By: quark-zju
Differential Revision: D15782273
fbshipit-source-id: 1cfdb3bbab946d18dc3c899163286e30fa69c2c7
Summary:
Flags should be able to be matched partially by a prefix-match.
If a given prefix returns more than one possible Flag, it is therefore ambiguous and should not choose for the user.
An exact match should always take precedence. A partial match should be tried in the event the argument is not an exact match.
Reviewed By: quark-zju
Differential Revision: D15749936
fbshipit-source-id: 26e699616a1b3fa6871fb50cc6914f916701004c
Summary: This makes sure bytes (Python 2 `str`) is returned as expected.
Reviewed By: xavierd
Differential Revision: D16399693
fbshipit-source-id: c299933cfb5ec57bb46fed1f30a9ad07aa043703
Summary:
The `rust-cpython` library tries to be smart about `String` -> `PyObject` convertion.
It creates a unicode object if string is non-ascii:
impl PyString {
...
pub fn new(py: Python, s: &str) -> PyString {
#[cfg(feature="python27-sys")]
fn new_impl(py: Python, s: &str) -> PyString {
if s.is_ascii() {
PyBytes::new(py, s.as_bytes()).into_basestring()
} else {
PyUnicode::new(py, s).into_basestring()
}
}
...
}
...
}
In hg's case, we almost always want Python 2 bytes and never unicode objects.
Provide a new type for that.
Reviewed By: xavierd
Differential Revision: D16399345
fbshipit-source-id: cf47906ea3c871bcd1289239167241dcc3fedd8d
Summary:
The test was flaky:
--- test-fb-hgext-remotefilelog-local.t
+++ test-fb-hgext-remotefilelog-local.t.err
@@ -31,7 +31,6 @@
M x
M y
? a
- 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over 0.00s
$ hg add a
$ hg status
M x
Reviewed By: xavierd
Differential Revision: D16393051
fbshipit-source-id: 3dad1970200388b8339bc2e73b7a092336edc70d
Summary:
We install the python files under `eden/fs/service` in a package named
`eden/thrift` in the built python binaries that use these modules. This
moves the source files into an `eden/thrift` subdirectory so that the source
directory layout more closely matches the final binary layout.
This will make it easier to run several of Eden's Python-based tools directly
from the source tree, without having to do as much directory layout
transformation. This is particularly helpful on platforms like Windows, which
don't currently have an equivalent of "live PARs" which can be run from the
source tree without requiring a rebuild after each file edit.
Reviewed By: chadaustin
Differential Revision: D16354622
fbshipit-source-id: 4b58cc96451b1ee5441714aaf74f5e3b6ada9eaa
Summary:
We install `eden/py/dirstate.py` as `eden/dirstate.py` in built python
binaries that use this module. This moves the source file into an `eden/`
subdirectory so that the source directory layout more closely matches the
final binary layout.
This will make it easier to run several of Eden's Python-based tools directly
from the source tree, without having to do as much directory layout
transformation. This is particularly helpful on platforms like Windows, which
don't currently have an equivalent of "live PARs" which can be run from the
source tree without requiring a rebuild after each file edit.
Reviewed By: chadaustin
Differential Revision: D16354627
fbshipit-source-id: 578748e76b730db33cf3ea555df48aa94d15019f
Summary:
build_nupkg.py test will copy tests/ to build/embedded/tests/ before running
them. That breaks testutil.dott "edenscm" module discovery. Try to fix it by
making "edenscm" module discovery consider "build/embedded/python27.zip".
Reviewed By: xavierd
Differential Revision: D16383017
fbshipit-source-id: 52e19182d3e5e7267221244bd39d9a146928d8df
Summary: This newly added test keeps failing. Let's remove it from now.
Reviewed By: DurhamG
Differential Revision: D16381346
fbshipit-source-id: 11146d44fbbcd1e1c960fe4a0b6e3c28854f456d
Summary:
When rebasing or showing a diff for a commit which moved files, remotefilectx.ancestors (called by _tracefile) calculates the linkrev for each ancestor. Sometimes [1], this is a disaster:
* remotefilectx._linkrev executes its slow path and scans the change log.
* For each entry in the change log, remotefilectx._linkrev downloads trees if needed.
* Hg downloads trees one-by-one (as of D15964145).
remotefilectx.ancestors is only calculating linkrevs so it can sort the ancestors topologically. _tracefile only needs the ancestors to be ordered topologically, not by linkrev. remotefilectx.ancestors's calls to remotefilectx._linkrev are redundant.
Optimize _tracefile's use of remotefilectx.ancestors: order remotefilectx objects topologically (breadth-first) without sorting by linkrev. Create a new function for this purpose (topological_ancestors) to avoid possibly breaking other callers of remotefilectx.ancestors. As a side effect, make this new function return remotefilectx objects lazily, similar to the filectx.ancestors function.
On my machine, with warm caches, this speeds up 'hg diff -c' and 'hg rebase' for a modestly-sized commit. 'hg diff -c' takes 0.64 seconds, down from 65.6 seconds.
[1] Hypothesis: After 'hg amend', 'hg bundle' packages linkrevs which refer to the pre-amend commit (which is not serialized into the bundle) rather than the post-amend commit. 'hg unbundle' thus creates linkrevs referring to a missing commit.
Reviewed By: DurhamG
Differential Revision: D16297426
fbshipit-source-id: 407597d5e36fc06b33719c28f5ea5052e01dc7a3
Summary:
Testpilot can give us a lot of things for free, including the automatic
detection of flaky tests, disabling of them, re-enabling too, easy retries on
failure, timeouts, better tracking, and the list goes on.
At a first step, I'd like to make the testpilot runner the default in hgbuild
to get all the benefits listed above.
Reviewed By: quark-zju
Differential Revision: D16294182
fbshipit-source-id: aadfbac9eb05e9d64336daba7a50a6263e38c162
Summary: When all tests are skipped, run-tests.py no longer return a 80 error code.
Reviewed By: singhsrb
Differential Revision: D16380129
fbshipit-source-id: e84a3558df8c2c4ebef9a382a1172d859a47e220
Summary:
Streaming clone works only if we fetch all data from the server, however with selective pull feature hg specifies the particular heads it needs to pull. It causes downgrade in clone performance.
I decided to disable selective pull just before the clone operation, so the feature will be working everywhere else. Also I still store, even after clone, only "subscribed" remote bookmarks.
There are, however, artifacts of such behaviour, they are shown by changes in `test-commitcloud-sync-remote-bookmarks.t`: the whole tree of commits now is available locally, except of the remote bookmarks.
Reviewed By: simpkins
Differential Revision: D16223458
fbshipit-source-id: 0564ac23a16fe54d245e0a6ce9db5be4b6e3532f
Summary:
If one of the repo checkouts doesn't have remote bookmarks synchronization enabled, it must not affect the Cloud's remote bookmarks state.
I also changed `localserver` (is used for our tests) because Commit Cloud server deletes the "old" bookmark names from the db and inserts "new". However, the `localserver` just set the "new" books dictionary as a new state, which is not quite correct.
Reviewed By: simpkins
Differential Revision: D16338257
fbshipit-source-id: d77d9218b1c35ea1a097bbe7393d0910ce7b4d38
Summary: While checking if one public commit is an ancestor of another public commit, I used string hashes instead of binary nodes. Fixing.
Reviewed By: farnz
Differential Revision: D16338256
fbshipit-source-id: e27ed8d79ec9ed3a188cdee93366ab2f96526152
Summary:
By default the zsh completion will give me a list of bookmark names which personally I don't think it is useful at all.
I think making it giving me the list of draft commits is much better.
Reviewed By: quark-zju
Differential Revision: D16094724
fbshipit-source-id: 3493895a12ae02df011560b53dd5e55c8d183c79