Summary:
Those types were internally using DataPack/HistoryPack, limiting their use. We
can make them more generic by using the DataStore/HistoryStore traits. The only
drawback is having to implement the new method for each store type.
Ideally, we could have a trait StoreFromPath (or use the experimental TryFrom)
that all the datastore/historystore types would implement.
As a bonus change, I got rid of the *Builder type, these were required as the
new method was already implemented in the AsyncHistoryStore/AsyncDataStore. We
can simply rename the later and use a new method elsewhere.
Reviewed By: DurhamG
Differential Revision: D14060159
fbshipit-source-id: 31fa278f650ba979eecd3df4175cbac30ebb8180
Summary:
Starting the implementation of tree manifest with the in memory nodes and implementing `get` and `insert`. The in memory nodes are called `Ephemeral` and the stored immutable nodes are going to be called `Durable`.
Using a `BTreeMap` for storing the children because we want to efficiently insert, fetch and remove path components. We also want iteration to be done in ordered fashion so BTreeMap is our collection in this case.
Removing elements from the tree is going to be implemented in a future update.
Reviewed By: DurhamG
Differential Revision: D14016273
fbshipit-source-id: d3bc22e5ddb21b689d07a7d74bd639b8c2b138ce
Summary:
The seed for the rust implementation of manifests.
We start with the most primitive API for manifests and maps a paths to a `Node`. At the basic level we need the same operations that a map implements so we start with `insert`, `get` and `remove`. We know that retrieving data for Manifests can fail so we encode that in our interface using `Fallible`.
I let for future iterations requiring iterator or returning manifest flags.
Reviewed By: DurhamG
Differential Revision: D14016274
fbshipit-source-id: 8f1f83610933b9e9a96f8c5ba2c6e50567c76e06
Summary:
`Node` is not friendly with plain old unit tests because constructing them is a bit involved. This diff adds a constructor from u8 purely for test puposes.
I picked an u8 for input because it is the most convenient type. When we move past rust 1.31 it might make sense to use an u32 and use https://doc.rust-lang.org/std/primitive.u32.html#method.to_le_bytes
To note that property testing is best used in addition to plain old unit testing.
Reviewed By: DurhamG
Differential Revision: D14016272
fbshipit-source-id: 5b831ab0011ef2575f7e94d158ab4ddf30d1ac06
Summary:
During repack, the repacked files are deleted without any verification. Since
Adam saw some data loss, it's possible that somehow repack didn't fully repack
a packfile but it was deleted. Let's verify that the entire packfile was
repacked before deleting it.
Since repack is mostly a background operation, we don't have a way to notify
the user, but we can log the error to a scuba table to analyse further.
Reviewed By: DurhamG
Differential Revision: D14069766
fbshipit-source-id: 4358a87deeb9732eec1afdfb742e8d81db41cd87
Summary:
Removing files on Windows is hard. It can fail for many reasons, many of which
involves another process having the file opened in some way. One way to solve
this problem is that renaming the file isn't as restrictive as removing it.
Since hg repack will attempt removing any temporary files it will also try to
remove the packfiles that we failed to remove earlier.
Reviewed By: DurhamG
Differential Revision: D14030445
fbshipit-source-id: 1f3799e021c2e0451943a1d5bd4cd25ed608ffb6
Summary:
Packfiles are named based on their content, so having an on-disk file with the
same name means that they have the same content. If that happens, let's simply
continue without failing.
Reviewed By: DurhamG
Differential Revision: D14030446
fbshipit-source-id: f04c15507c89b2fca19c95a7b41d8e65c88da019
Summary:
Preloading all the pack files on initialization ties the lifetime of the
packfiles to the repo. For normal operations, this is fine, as packfiles are
mostly read. During a repack however, we need to be able to remove them, and
while having an open file handle allows deletion on unix OSes, it prevents it
on Windows.
The Rust repack now succeeds on Windows.
Reviewed By: DurhamG
Differential Revision: D14013786
fbshipit-source-id: 99279d4af67a0dfe8679159e9409186f56a09296
Summary:
Since september (D9840431) rcutil.rccomponents is no longer source of truth
about which config files we load. In fact we use it only in the
`hg config --debug`. This leads to situations where the debug command mentions
loading a specific config file and then ignores it completely which is very
confusing.
Let's remove it.
Reviewed By: suitingtseng
Differential Revision: D14083220
fbshipit-source-id: 362fd9bf574e24639f99a1203206184da42d1e24
Summary:
When using query strings or fragments in an URL we should treat repository paths
as the same repo. This allows servers to use query strings for metadata, without
treating the urls as different servers. By introducing normalization in our grouping,
we will consider the normalized result to be the qualifier for what is the same repo,
rather then the full absolute path - which includes query strings and fragments.
Reviewed By: DurhamG
Differential Revision: D14051479
fbshipit-source-id: c82fe041467f6bd6af210688c0be873e2da93781
Summary: We're using query strings to provide metadata to the server, but they should be stripped before they actually reach the core Mercurial handling. Let's update the tests to simulate this behavior.
Reviewed By: DurhamG
Differential Revision: D14051480
fbshipit-source-id: a9b448fd193f17aeab93c4886efdec3fda533c4d
Summary: Same as D14074466, I did not notice this failure at first.
Reviewed By: stashuk
Differential Revision: D14078919
fbshipit-source-id: 3da9de3f1a2d29efe7a9f11809b4a950b4c06b67
Summary: We were reading the `edenapi.url` config item without explicitly setting it up with the `configitem()` function. Not sure what negative impact this would have, but it's probably a good idea to have the explicit call in place.
Reviewed By: quark-zju
Differential Revision: D14075080
fbshipit-source-id: bb4e25de273341768f850f1d5aab6ac21e7f2fc5
Summary: Now that the `edenapi` module in bindings is always available for all platforms, we no longer need a try block around the import.
Reviewed By: quark-zju
Differential Revision: D14075082
fbshipit-source-id: e3f45e67ef4572e58f85875af12390ea5d697d43
Summary:
This shouldn't change any behavior, but should allow
deploying scratch to mac and windows in D14060864
Reviewed By: simpkins
Differential Revision: D14060865
fbshipit-source-id: 8daf65739fa6835c6df682484a8f2dba432977dd
Summary: Followed quark-zju's advice to get stable passing of the test
Reviewed By: quark-zju
Differential Revision: D14075062
fbshipit-source-id: 0ed0d5597d1be25607f93a527b27b37e89702c81
Summary: Who knows why the percent-encoding became lowercase on OSX.
Reviewed By: strager
Differential Revision: D14074466
fbshipit-source-id: 75918a4558a2ea362efa857840606af89919d202
Summary: Move the edenapi Python bindings into the common `bindings` crate.
Reviewed By: quark-zju
Differential Revision: D13963179
fbshipit-source-id: 76dead82af992615a9e452ee6fbb9f66639c822c
Summary:
Switch from using OpenSSL (via `native-tls`) to [Rustls](https://github.com/ctz/rustls), a pure-Rust TLS implementation based on the `ring` crypto crate.
Unlike `native-tls`, Rustls supports ALPN, which means it can be used along with Hyper to perform HTTP/2 requests over TLS. (OpenSSL also supports ALPN, but older versions of Windows' `schannel` library do not, and as such `native-tls` doesn't support ALPN either regardless of platform.)
Rustls also builds on Windows without any special configuration, sidestepping the issues we've been having with OpenSSL in the Windows build.
Reviewed By: quark-zju
Differential Revision: D14070084
fbshipit-source-id: 25268c58a88177f4708370696d326b4c0bdc89a0
Summary:
Add a new `init` module to the `bindings` crate. This is intended as a place to put global Rust initialization code for Mercurial's Rust extensions. Ordinarily, such code would go at the start of `main()`, but since `hg` doesn't have a Rust main, putting initialization here at least guarantees that it will happen before any of the Rust extension code runs.
Right now, the only thing initialized in the new module is `env_logger`.
Reviewed By: quark-zju
Differential Revision: D14072560
fbshipit-source-id: 0f2770d0a3a6e9c6b7fe68eb62007cc091adad59
Summary: This wasn't being included before.
Reviewed By: vipannalla, quark-zju
Differential Revision: D14071697
fbshipit-source-id: 15f78c74a9629a8000ec1125c3e9e30e124c3d51
Summary: Files were moved around and Makefile needs update.
Reviewed By: ikostia
Differential Revision: D14062591
fbshipit-source-id: 5478cf75bc3ff431fc7b24fe7df03e9599c0817f
Summary:
if server already have everything, the function should return True
otherwise we treat it as fail to backup in pushbackupbundlestacks function
failed to push stack bundle rooted at ...
Reviewed By: quark-zju
Differential Revision: D14048141
fbshipit-source-id: 288291db2f31b0d284c97fecbd61049a58c045de
Summary:
The test uses named branches in an extensive way that is hard to fix. In
production we have been using different code paths for years: hgsql +
pushrebase has its own locking to avoid race conditions. Mononoke would
have its own way of handling concurrent pushes. Therefore remove the test to
make the named branches deprecation easier.
Logic related to the push-race test is not removed in this diff, in the future
we'll probably just replace server-side logic entirely in the code base so I'm
not dealing with the "to-be-replaced" code right now.
Differential Revision: D14059833
fbshipit-source-id: de20e8fc93ff1253d03ad9397a7490052a54b43c
Summary:
Monotone repos are rare these days. Drop support for it.
This also solves an issue that test-convert-mtn.t uses named branches.
Differential Revision: D14059836
fbshipit-source-id: 1e9d4fe6fdc295393ff67c5e068b230b9ed0c0af
Summary: Use bookmarks instead and remove parts related to named branches.
Differential Revision: D14000989
fbshipit-source-id: 802f5c7273b7ac5d9347e68a0f7dd25d9ae48222
Summary: Use `debugsetparents` to create a merge commit instead.
Differential Revision: D14000098
fbshipit-source-id: a954b7a1aa29dc531bf6af19641d0a089e5e2e36
Summary:
The (disabled by default) `transplant` command is similar to `graft` or
`rebase`. It makes sense to removeit.
This diff removes the extension.
Reviewed By: singhsrb
Differential Revision: D14000099
fbshipit-source-id: a03e4925cefa4236bd9d62cfe9d33d140707bd7c
Summary: They will be replaced by successors and predecessors.
Reviewed By: singhsrb
Differential Revision: D14000097
fbshipit-source-id: 07f0c97edd7eb16ad665c00886c00212d516ae72
Summary:
Rewrite "graft --force" and "empty graft" test cases to not depend on the
previous repo state. Remove the "same origin policy" test since eventually
we'll use mutation history to test origins and the code path here would be
rewritten.
This makes it easier to change the rest of the test.
Differential Revision: D14000100
fbshipit-source-id: 26002774c370a965a9bca157e08246c89aa5e274
Summary:
The test has many problems. Namely, it depends too much on previous repo state,
uses legacy features like named branches, revision numbers, unsafe strip, and rollback,
and is too verbose and over-testing a lot of things (ex. test commit template
many times, test diff output many times, test bundle debug output
unnecessarily, etc).
Rewrite the test to solve all of the above issues:
- Every individual test case uses separate small repos.
- Do not use revision numbers.
- Do not use legacy strip.
- Do not use named branch.
This also reveals that amending a merge commit is buggy in many ways. We can
probably fix them up when cleaning up the commit/merge logic.
Differential Revision: D13993825
fbshipit-source-id: 9e1ff8054741b4356319ce37daea3c5184933927
Summary:
The use of branches is only to create a merge commit. Use drawdag to do that
instead.
Differential Revision: D13993829
fbshipit-source-id: b5f217e7d9ba535b7fd379ec4ca31b899350de02
Summary:
The test is mainly about warnings of new heads, which we might want to remove
entirely (see D8148016). The test is also deeply coupled with named branches,
which will be removed.
Differential Revision: D13993828
fbshipit-source-id: 950f0cb98cd6cb2c8192f1ff36ce2d6b642d1225
Summary:
test-tag.t uses named branches too much. Since global tags are also going away,
replace the test with a simple one about local tags. The local tag portion in
test-tag.t is not too much, though.
Differential Revision: D13993827
fbshipit-source-id: b3a86fa1e07b945fc2926f00ef9de31a4506ba37
Summary:
Rewrite the test:
- Use drawdag to create test repos.
- Use commit hash instead of revision numbers for new test cases.
- Remove unrelated test cases (ex. strip, branch heads).
- Remove use of named branch.
Differential Revision: D13993823
fbshipit-source-id: d20954dec1b39313f08699f796d5db167dfee641