Commit Graph

45179 Commits

Author SHA1 Message Date
Mateusz Kwapich
4db0750027 fsmonitor: use correct length for number of files changed
Summary: When comparing the number of files changed, fsmonitor was incorrectly using the length of the result dict (always 4), rather than the number of files watchman returned.  Use the right list of files instead.

Reviewed By: markbt

Differential Revision: D14123604

fbshipit-source-id: 94684f1f189d045b2f6a880180b15e52ba9bba8c
2019-02-18 10:03:12 -08:00
Mateusz Kwapich
9e35a167ef fsmonitor: show that we don't update watchman clock as often as we wish
Summary:
This subtle bug shows only when the watchman-changed-file-threshold is set to a
value higher than 4.

Reviewed By: markbt

Differential Revision: D14123605

fbshipit-source-id: 51ff3172fef5bc65fb9f68bb34826a9181fd64a9
2019-02-18 10:03:12 -08:00
Liubov Dmitrieva
bc43b991a2 fix compilation
Summary:
make local / relase are broken on trunk, fix it

in other modules, this code is only for tests. In toml file it is enabled for tests.

Reviewed By: mitrandir77, ikostia

Differential Revision: D14123392

fbshipit-source-id: eceaf17478b8b7e75ee2ba56df69b28ca8374c64
2019-02-18 04:53:57 -08:00
Liubov Dmitrieva
1c47c775c0 inifinitepush: add new capability
Summary:
this will be used to understand if server supports 'listkeyspatterns'

(Mononoke doesn't support this)

Reviewed By: DurhamG

Differential Revision: D14107742

fbshipit-source-id: c9a42e8516eb5660ab2f498996b211db7086bcb1
2019-02-18 04:30:32 -08:00
Arun Kulshreshtha
8864e6a0da types: move edenapi-types into types crate
Summary: Move the contents of `edenapi-types` into the `types` crate so all of Mercurial's Rust types are in one place.

Reviewed By: quark-zju

Differential Revision: D14114547

fbshipit-source-id: feb8f9c35f102d30bf00b230df81a86a3893a49b
2019-02-15 22:51:04 -08:00
Arun Kulshreshtha
9c6b914a22 types: move Key and NodeInfo out of revisionstore
Summary:
In order to move the types in `edenapi-types` (containing types shared between Mercurial and Mononoke) to the `types` crate, we need to move a few types from the  `revisionstore` crate into this crate first, because `revisionstore` depends on `types`, which would create a circular dependency since `edenapi-types` uses types from `revisionstore`.

In particular, this diff moves the `Key` and `NodeInfo` types into their own modules in the `types` crate.

Reviewed By: quark-zju

Differential Revision: D14114166

fbshipit-source-id: 8f9e78d610425faec9dc89ecc9e450651d24177a
2019-02-15 22:51:04 -08:00
Arun Kulshreshtha
61f9f25a66 edenapi-types: add crate for types shared between Mercurial and Mononoke
Summary:
For HTTP data fetching, it will be necessary to have the same Rust types in Mononoke and Mercurial, so that Mononoke can send down the serialized types and Mercurial can deserialize them. These types must live in the Mercurial codebase since Mercurial can't link to code outside of fbcode/scm/hg. As such, this diff adds a new crate to Mercurial that Mononoke can link to, containing these shared types.

Right now the only shared type is a `HistoryEntry`, designed to match the interface of `MutableDatapack::add`. This type will be used as part of the HTTP history fetching API.

In the longer term, it would probably make sense to use something like Thrift for defining the on-the-wire formats used between Mercurial and Mononoke (and eventually for RPC as well). However, given that using Thrift from Mercurial is currently nontrivial (since Mercurial is typically built with Cargo and needs to be compatible with open source tooling), defining the schema in this crate and using `serde` for serialization and HTTP/2 for transport should be sufficient for now.

Reviewed By: quark-zju

Differential Revision: D14079337

fbshipit-source-id: c7880919aeb3fd7e1cf70067a89a17341c1d973f
2019-02-15 15:17:12 -08:00
Kostia Balytskyi
a61dbb725b branches: delete hgsubversion test related to branches
Summary: It fails the build currently.

Reviewed By: quark-zju

Differential Revision: D14108628

fbshipit-source-id: 5721a3513c5234df1c96756a3ab48b3b6c9c350f
2019-02-15 11:26:56 -08:00
Liubov Dmitrieva
4454d6eeb5 pushbackup: fix early exit logic
Summary:
the early exit logic was incorrect, basically if there is at least 1 bookmark
in the repo and the backup state was not empty, it didn't catch that nothing has been changed.

bookmarks are dicts, so it is fine to compare them

if any bookmarks in the repo, everytime `hg pushbackup` established a connection to mercurial

Reviewed By: quark-zju

Differential Revision: D14103938

fbshipit-source-id: 0edc4d9e186199670765fd2362236330e831c7d9
2019-02-15 10:04:00 -08:00
Jun Wu
f752c4dd75 commands: deprecate "hg id -b"
Summary:
There are still users of "hg id -b", namely shell prompt scripts.
However, it seems fine to remove "branch" from the formatted (JSON or other
formats) output.

Reviewed By: ikostia

Differential Revision: D14076296

fbshipit-source-id: a77f4b9e73161d322da3f1bdec993082ac463939
2019-02-14 17:44:40 -08:00
Jun Wu
dc38aa9d7a commands: remove "clone --branch" flag
Differential Revision: D14076299

fbshipit-source-id: dafbb7866e12e551b162a20ee048264866b67c96
2019-02-14 17:44:40 -08:00
Jun Wu
e257757924 commands: remove "bundle --branch" flag
Summary: Named branches are going away.

Differential Revision: D14076297

fbshipit-source-id: b68356f7075a6a8787cf0d2aa972bb27e1ef9bb1
2019-02-14 17:44:40 -08:00
Jun Wu
37af1cfda3 commands: remove "commit --close-branch" flag
Summary: Without named branch, it is not meaningful to close a branch.

Differential Revision: D14076295

fbshipit-source-id: 527ae457cb14f9415fa7269b7dc123252e7d6867
2019-02-14 17:44:40 -08:00
Jun Wu
35a58e8c24 commands: replace "branch" command with deprecation warnings
Summary:
Unfortunately, there are still users of the "hg branch" command so we cannot
remove it right now. But I'm updating internal tools to not call it.

Reviewed By: ikostia

Differential Revision: D14076300

fbshipit-source-id: a5322d9c9ce8148c6ad0800653bd829736556386
2019-02-14 17:44:40 -08:00
Jun Wu
82b4be9a7f config: hard-code ui.allowbranches=False
Summary: Since it's always False, remove the config option.

Reviewed By: ikostia

Differential Revision: D14076304

fbshipit-source-id: 2cc6409355a0c4514a62bc764e1deec0af1bd3a1
2019-02-14 17:44:40 -08:00
Jun Wu
9a87d9567c commands: remove "branches" command
Summary:
It seems nobody uses it from dev_commands logging. Search for "allowbranches"
in all internal repos suggests nobody turned it on. The tests were also
migrated to not use the command so let's just remove it.

Reviewed By: ikostia

Differential Revision: D14076298

fbshipit-source-id: a1cb03b2da289c01b15f0580ffe77531941be213
2019-02-14 17:44:40 -08:00
Jun Wu
4801f88fad config: set ui.allowbranches to False by default
Summary: This would make the test runner run tests with named branch disabled.

Reviewed By: phillco

Differential Revision: D14059835

fbshipit-source-id: 9fbad5688bd8c69d32016b2ec1f931102638da68
2019-02-14 17:44:40 -08:00
Jun Wu
20da8e235a test-hgsubversion-unaffected-core: remove tests using named branches
Differential Revision: D14063219

fbshipit-source-id: 80cad750bfc5c0ef66d545e4a6be56342a195f8e
2019-02-14 17:44:39 -08:00
Jun Wu
702ed9a453 test-revset: do not use "hg branch" directly
Summary:
Migrate away from using the "hg branch" command to "hg commit --extra branch="
instead. In the future the branch namespace would be removed, so we create
local tags instead.

`test-revset2` was split from `test-revset` and has the same header. Do the
same change to it. Besides, de-duplicate tests about the `tag()` revset.

Reviewed By: ikostia

Differential Revision: D14058435

fbshipit-source-id: b59fadc43939d85d14bbf9f81227c523b65557a0
2019-02-14 17:44:39 -08:00
Wez Furlong
ce8a548d96 hg: rename scratch to mkscratch and include in the hg build
Summary:
My goal is to have `mkscratch` get deployed with the mercurial
release on all platforms.   This is currently deployed via packman
as `scratch` on devservers, and that packman build should continue to
succeed because the TARGETS file in here is left unchanged.

That will allow both `scratch` and `mkscratch` to coexist for a while
until we've made it through a few mercurial releases, and then we can
either fixup existing users of `scratch` to use `mkscratch`, or re-do
the `fb-scratch` rpm so that it symlinks to `mkscratch`.

I don't really know if this diff is sufficient to include the binary
in the mercurial package; I'm cargo culting the `scm_daemon` stuff
and that seems to be included in the omnibus, so maybe this is it?

Reviewed By: quark-zju

Differential Revision: D14060864

fbshipit-source-id: 5fd74a877437d84fe7676819c2cefb902fb7002d
2019-02-14 17:28:14 -08:00
Jun Wu
338fe1197f dirstate: add more logging to debug T39234759
Summary:
"st_size" returned by watchman is sometimes 0. We suspect it's incorrect.
It could be the file on disk is actually empty, or the kernel made it
look empty to watchman in the past, or there is something wrong with
serialization, etc. Let's first add a real os.stat to test if the file
is really empty.

Reviewed By: phillco

Differential Revision: D14090851

fbshipit-source-id: bd75cf86bfd117285658ad0dd7fb28d0e8b5585c
2019-02-14 16:29:46 -08:00
Phil Cohen
50ebbbbb86 hook: print exception message on load failure
Summary: Otherwise mergedrivers become impossible to debug if they don't import correctly.

Reviewed By: ikostia

Differential Revision: D14071200

fbshipit-source-id: 3e677089e6b008d892158290c392e1f9d68a67ae
2019-02-14 16:22:22 -08:00
Kostia Balytskyi
75e854296a fix-code: make the test happy
Reviewed By: singhsrb

Differential Revision: D14094651

fbshipit-source-id: 722022ec09e36f8c17734e6da95ee867d742c196
2019-02-14 16:17:53 -08:00
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