Commit Graph

45106 Commits

Author SHA1 Message Date
Kostia Balytskyi
2da9689539 test-hggit: yet another fix
Differential Revision: D14091401

fbshipit-source-id: f712c7796ff3cbd66a0249ba6aeb2405a18ffc68
2019-02-14 14:08:27 -08:00
Xavier Deguillard
b099f733a4 asyncpacks: make asyncunion*store more generic
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
2019-02-14 13:43:51 -08:00
Stefan Filip
1868861442 Add in memory representation for manifest tree
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
2019-02-14 13:32:05 -08:00
Stefan Filip
c1b8cd68d8 Add manifest crate
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
2019-02-14 13:32:05 -08:00
Stefan Filip
63c87a7500 Add test constructor for Node
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
2019-02-14 13:32:05 -08:00
Xavier Deguillard
76316fbf9d revisionstore: verify repacked keys before deleting pack files
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
2019-02-14 13:03:09 -08:00
Michael Liu
8747ff025f Apply modernize-use-override
Summary:
Use C++11’s override and remove virtual where applicable.
Change are automatically generated.

Reviewed By: Orvid

Differential Revision: D14052667

fbshipit-source-id: 119e237155a5318e08e31065c8f87e6b7f3f7c52
2019-02-14 11:57:55 -08:00
Xavier Deguillard
e5a7da32da revisionstore: rename the packfile before removal on windows
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
2019-02-14 10:34:52 -08:00
Xavier Deguillard
8c40ed3a71 revisionstore: ignore AlreadyExists errors when persisting a mutable pack
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
2019-02-14 10:34:52 -08:00
Xavier Deguillard
dc6cbcdfe6 remotefilelog: do not preload packs
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
2019-02-14 10:34:52 -08:00
Mateusz Kwapich
4f58ae8678 config: stop lying about the config locations
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
2019-02-14 09:31:58 -08:00
Mateusz Kwapich
96d0d0889e config: still load configs in legacy configurations (hgrc.d on linux)
Summary: This broke hg configs on Tupperware containers.

Reviewed By: DurhamG

Differential Revision: D14083110

fbshipit-source-id: e49f77235317046931c0e75c98c3e67a617dfd49
2019-02-14 09:31:57 -08:00
Johan Schuijt-Li
09d54f3cf4 remotenames: treat query strings and fragments as parameters
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
2019-02-14 03:21:53 -08:00
Johan Schuijt-Li
8b2b9f0878 tests: dummyssh should have same behavior as hg-ssh-wrapper
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
2019-02-14 03:21:53 -08:00
Kostia Balytskyi
c2d9319e02 test-hggit-clone: fix on OSX
Summary: Yet another unnoticed equivalent to D14074466

Reviewed By: StanislavGlebik

Differential Revision: D14080462

fbshipit-source-id: e5a25e4eb0080fd00df84515cc704ca9e7901334
2019-02-14 00:58:07 -08:00
Kostia Balytskyi
e6620b81ec test-hggit-push: fix
Summary: Same as D14074466, I did not notice this failure at first.

Reviewed By: stashuk

Differential Revision: D14078919

fbshipit-source-id: 3da9de3f1a2d29efe7a9f11809b4a950b4c06b67
2019-02-13 20:08:23 -08:00
Arun Kulshreshtha
a4a155c025 edenapi: add configitem call for edenapi.url
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
2019-02-13 17:41:54 -08:00
Arun Kulshreshtha
c68b388bed edenapi: remove try around import
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
2019-02-13 17:41:54 -08:00
Wez Furlong
6e445711e6 hg: move scratch into hg code base
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
2019-02-13 17:19:46 -08:00
Kostia Balytskyi
8fa8c5ce45 test-hgweb-json: make output more predictable
Summary: Followed quark-zju's advice to get stable passing of the test

Reviewed By: quark-zju

Differential Revision: D14075062

fbshipit-source-id: 0ed0d5597d1be25607f93a527b27b37e89702c81
2019-02-13 16:25:41 -08:00
Kostia Balytskyi
0e8bb9052d test-hggit-pull: fix the test on OSX
Summary: Who knows why the percent-encoding became lowercase on OSX.

Reviewed By: strager

Differential Revision: D14074466

fbshipit-source-id: 75918a4558a2ea362efa857840606af89919d202
2019-02-13 16:15:27 -08:00
Arun Kulshreshtha
575e570a28 bindings: move pyedenapi into bindings crate
Summary: Move the edenapi Python bindings into the common `bindings` crate.

Reviewed By: quark-zju

Differential Revision: D13963179

fbshipit-source-id: 76dead82af992615a9e452ee6fbb9f66639c822c
2019-02-13 16:07:00 -08:00
Arun Kulshreshtha
127ca1a990 edenapi: use rustls instead of openssl
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
2019-02-13 16:07:00 -08:00
Arun Kulshreshtha
1d00a343e4 bindings: add init module
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
2019-02-13 16:07:00 -08:00
Phil Cohen
b4237e4392 setup: include fb.mergedriver package in the build
Summary: This wasn't being included before.

Reviewed By: vipannalla, quark-zju

Differential Revision: D14071697

fbshipit-source-id: 15f78c74a9629a8000ec1125c3e9e30e124c3d51
2019-02-13 15:44:14 -08:00
Jun Wu
0986982f71 Makefile: fix "make clean"
Summary: Files were moved around and Makefile needs update.

Reviewed By: ikostia

Differential Revision: D14062591

fbshipit-source-id: 5478cf75bc3ff431fc7b24fe7df03e9599c0817f
2019-02-13 13:57:07 -08:00
Liubov Dmitrieva
380f425385 infinitepush: fix issue with discovery
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
2019-02-13 08:20:17 -08:00
Jun Wu
685282f716 test-push-race: remove the test
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
2019-02-12 21:45:13 -08:00
Jun Wu
61b3505e30 test-completion: do not use named branches
Differential Revision: D14059837

fbshipit-source-id: 214e585408c5d11693fd4940f7c8b527f8ed6d51
2019-02-12 21:45:13 -08:00
Jun Wu
9d21b98c57 convert: drop monotone support
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
2019-02-12 21:45:13 -08:00
Jun Wu
d4b5e57141 test-hgweb-json: stop using named branches
Summary: Use bookmarks instead.

Differential Revision: D14030468

fbshipit-source-id: e3ebce2712bc7a49f19ffa6ab93823d35fb41975
2019-02-12 21:45:12 -08:00
Jun Wu
ce58d8c7a8 test-hgweb-commands: stop using named branches
Summary: Make it future-proof.

Differential Revision: D14030467

fbshipit-source-id: 73e22dca569fd7b879abcceaa7e6db8a7fef348f
2019-02-12 21:45:12 -08:00
Jun Wu
3ee3ad8d77 test-hgweb-filelog: stop using named branches
Summary: Use bookmark instead.

Differential Revision: D14030472

fbshipit-source-id: 3f4f61ea8fc8bbff4155162634a41c07943867c7
2019-02-12 21:45:12 -08:00
Jun Wu
30ba0e6839 test-clone: stop using or testing named branches
Summary: Make it future proof.

Differential Revision: D14030469

fbshipit-source-id: 84369a7870bcb5703194f2e8cc140b54ce6de458
2019-02-12 21:45:12 -08:00
Jun Wu
e21b3c5432 test-command-template: do not use named branches
Summary: Use bookmarks instead.

Differential Revision: D14030470

fbshipit-source-id: 13ede04d4552b401b34b02c5b36978f1db063951
2019-02-12 21:45:12 -08:00
Jun Wu
9316f5817d test-log: do not use named branches
Summary: Use bookmarks instead and remove parts related to named branches.

Differential Revision: D14000989

fbshipit-source-id: 802f5c7273b7ac5d9347e68a0f7dd25d9ae48222
2019-02-12 21:45:12 -08:00
Jun Wu
484f9e3c42 test-convert-datesort: do not use branches
Summary: Create the repo without using named branched.

Differential Revision: D14000990

fbshipit-source-id: e84ee80ae25c4cbf2776da500bde840d028ae4d8
2019-02-12 21:45:12 -08:00
Jun Wu
d197692cc9 test-fetch: remove parts related to named branch
Summary: Named branches are going away.

Differential Revision: D14000991

fbshipit-source-id: 0528b24dd72579a3a49336378af095c0b503c7b1
2019-02-12 21:45:11 -08:00
Jun Wu
a93a452024 test-convert-filemap: remove parts related to named branches
Summary: Named branches are going away.

Differential Revision: D14000988

fbshipit-source-id: 8a60707278eaa06cccb30fe5732bf1ced7ed608d
2019-02-12 21:45:11 -08:00
Jun Wu
ab0f9bc480 test-graft: do not use named branches
Summary: Use `debugsetparents` to create a merge commit instead.

Differential Revision: D14000098

fbshipit-source-id: a954b7a1aa29dc531bf6af19641d0a089e5e2e36
2019-02-12 21:45:11 -08:00
Jun Wu
4cd0b5c098 transplant: remove the extension
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
2019-02-12 21:45:11 -08:00
Jun Wu
8fd207a853 revset: stop supporting origin() and destination()
Summary: They will be replaced by successors and predecessors.

Reviewed By: singhsrb

Differential Revision: D14000097

fbshipit-source-id: 07f0c97edd7eb16ad665c00886c00212d516ae72
2019-02-12 21:45:11 -08:00
Jun Wu
9210419543 test-graft: rewrite test cases to use smaller repo
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
2019-02-12 21:45:10 -08:00
Jun Wu
7ed91e39b1 test-commit-amend: rewrite the entire test
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
2019-02-12 21:45:10 -08:00
Jun Wu
c8868a0d31 test-commit-interactive: avoid using branches
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
2019-02-12 21:45:10 -08:00
Jun Wu
cd10b49318 test-push-warn: remove the test
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
2019-02-12 21:45:10 -08:00
Jun Wu
ef58a086e5 test-tag: replace the test with a simple local tag test
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
2019-02-12 21:45:10 -08:00
Jun Wu
688f14a527 test-shelve: remove test cases about named branches
Summary: They won't pass with the new code.

Differential Revision: D13993826

fbshipit-source-id: e5156da05ef922940198c2fcf7458a086ce23bb4
2019-02-12 21:45:10 -08:00
Jun Wu
87b87d5490 rebase: remove --keepbranches flag
Summary: Branches are going away. Remove related features.

Differential Revision: D13993824

fbshipit-source-id: 8afb01912df016bda08be5bc22ac52be7f5168eb
2019-02-12 21:45:10 -08:00
Jun Wu
e8b4af8f69 test-rebase-collapse: rewrite the entire test
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
2019-02-12 21:45:10 -08:00