Commit Graph

45292 Commits

Author SHA1 Message Date
Jun Wu
eaebf8d02d commands: drop unnecessary "config(..., default=...)"
Summary:
The default value is specified in configitems.py. Remove the `default`
argument.

Reviewed By: phillco

Differential Revision: D13909730

fbshipit-source-id: ca45c63be7d48e04e71a6f5b3b682f625a3030f6
2019-02-05 20:36:03 -08:00
Jun Wu
50932456ad tests: drop experimental.single-head-per-branch feature
Summary:
This reverts the upstream changeset:

  changeset:   66ecde8a704d9fa92bd99720923524c4bd3f315b
  user:        Boris Feld <boris.feld@octobus.net>
  date:        Wed, 15 Nov 2017 18:52:42 -0800
  summary:     server: introduce a 'experimental.single-head-per-branch' option

Named branches are going to be removed. Remove experimental dependent feature.

Reviewed By: phillco

Differential Revision: D13909727

fbshipit-source-id: 3baf101e5a038b58bc01506826b631a2a58a7782
2019-02-05 20:36:03 -08:00
Jun Wu
57079875b1 tests: remove tests mainly related to named branches
Summary: Named branches are going to be removed. Remove directly related tests.

Reviewed By: phillco

Differential Revision: D13909726

fbshipit-source-id: 6f7f39b4129bb5840a90501ef251b3f5971c82fe
2019-02-05 20:36:03 -08:00
Jun Wu
eb0ce36ac2 util: make timer return constant on tests
Summary:
Lots of places use it to print some thing like "fetched x files in y seconds (1KB/s)".

In tests, these have to be manually replaced to "* (glob)" patterns.

This diff makes test output static without using globs. So `run-tests.py -i` would just fix things.

Reviewed By: phillco

Differential Revision: D13954456

fbshipit-source-id: d139c7c5e268d3bab562c266335d740986780924
2019-02-05 20:36:03 -08:00
Jun Wu
f8f8e3962a status: add a way to log more details about why hg thinks a file was modified
Summary:
We're seeing issues where a file show up as "M" while it isn't expected so. When
running "hg status" again, the file disappeared. Existing logs suggest that
watchman does not think anything has changed between the two "status" commands.
Therefore add more logs of the internals to try to get more insights.

Differential Revision: D13954209

fbshipit-source-id: 0b89a6da5e8702e707440ef2e1823eb4968c10be
2019-02-05 19:41:35 -08:00
Durham Goode
3309a8090a pushrebase: read the manifest before looping through files
Summary:
pushrebase has logic that loops through all the files and builds a list
of what has changed. Unfortunately, Mercurial has some optimizations where if
the manifest isn't loaded already, it tries to only load the manifest delta, and
checks if this might be a good idea by first checking if the file is in the
commit metadata file list. The commit metadata is a list, which makes it a O(n)
scan to check containment. Since we do this for every file, it becomes O(n^2).

To avoid this, let's just make sure the actual manifest is loaded.

Once every repo is a tree repo, we can get rid of the manifest delta
optimization and get rid of the need to prefetch here.

Reviewed By: singhsrb

Differential Revision: D13944829

fbshipit-source-id: c0f33ca650b7956a1f39e961c94678a6f7f380b6
2019-02-05 16:05:50 -08:00
Durham Goode
f3a5d55c2b changelog: cache commit files list
Summary:
During pushrebase there is code that says 'for each file, do some work
that involves listing the changed files'. Because we reparse the list each time,
this becomes n^2 behavior. Let's cache the list to avoid this.

Reviewed By: singhsrb

Differential Revision: D13944830

fbshipit-source-id: 4fd0dbf26b6cee9d0c01879cafb9837262f7afa0
2019-02-05 15:52:00 -08:00
Stanislau Hlebik
ff74d1cc82 remotefilelog: add an option to verify all the hashes
Reviewed By: DurhamG

Differential Revision: D13838772

fbshipit-source-id: e7220ba8a0e07f3003693199086e3a3512023857
2019-02-05 15:03:24 -08:00
Michael Bolin
55e1814f4d Move the DotSlash build process out of scm/hg/setup.py and into hgbuild.
Summary:
As requested by DurhamG, bundle DotSlash in the same way that scmtelemetry
is bundled rather than as directly part of the Mercurial package.
This approach makes it possible for DotSlash to leverage Hg's contbuild
while still being in its own package.

To implement this, I copypasta'd scmtelemetry's setup and modified it
for DotSlash, as appropriate.

Although I tried to port the Windows configuration over in addition to
Mac and Linux, I'm going to disable it for now because I want to limit
how many things I'm going to try to get working on the initial rollout.

Reviewed By: singhsrb

Differential Revision: D13950939

fbshipit-source-id: 5d8393d756e23f1ac228c7315a4b95a36288ac3a
2019-02-05 10:51:39 -08:00
Michael Bolin
8e8365cc04 Move DotSlash out of scm/hg.
Summary:
Ran `hg mv ../hg/exec/fb/dotslash ../dotslash` and edited
`fbcode/scm/hg/setup.py`.

Reviewed By: singhsrb

Differential Revision: D13950938

fbshipit-source-id: 2cd68e9704121623881c575ac27cc6d4d7de3740
2019-02-05 10:51:39 -08:00
Jun Wu
452e2bd5d6 commandserver: import mercurial.__version__ from the right place
Summary: It was moved to edenscm.

Reviewed By: singhsrb

Differential Revision: D13955193

fbshipit-source-id: 79ec1a314398813de4f686f104b17cda0f43a92d
2019-02-05 09:47:34 -08:00
Fatih Aydin
64bd91b7f4 commands: add option to disable the outgoing command
Summary: Extend the option to disable `incoming` to also disable `outgoing`.

Reviewed By: markbt

Differential Revision: D13877971

fbshipit-source-id: c4f994d536dda5db7c0e9f14656be48fc757c237
2019-02-04 14:25:27 -08:00
Mark Thomas
f402b4f525 lfs: include name of file being downloaded in progress bar
Summary:
When doing lfs prefetch, pass the filenames that correspond to each oid to lfs
so that it can include them in the progress bar.

Reviewed By: DurhamG

Differential Revision: D13716078

fbshipit-source-id: c91eca6b342996c0c3d1ee43f3b1e98db4ed64d4
2019-02-04 11:44:28 -08:00
Durham Goode
5eced4c533 watchman: canonicalize repo root before querying watchman
Summary:
If the repository was mounted into a different directory than the
source of truth, our watchman integration would not work. To fix this, Mercurial
now applies the same canonicalization logic to the path before passing it to
watchman. This logic is stolen verbatim from watchmans integration test path
utility.

This also requires updating our copy of pywatchman to match the upstream
pywatchman.

Reviewed By: quark-zju

Differential Revision: D13886207

fbshipit-source-id: ea72166edf2eb30f2bee992d9aa936e2e9729e63
2019-02-04 10:34:08 -08:00
Xavier Deguillard
747cc15fbf revisionstore: remove Rc from UnionDataStore and UnionHistoryStore
Summary:
The Rc is required by the c_api, but there is no longer a reason for
UnionDataStore and UnionHistoryStore to use an Rc, so let's move the Rc into
c_api.

Reviewed By: DurhamG

Differential Revision: D13928332

fbshipit-source-id: a93b54e022d539dc4df9144a8c59e9ffbe3453e0
2019-02-04 09:30:23 -08:00
Xavier Deguillard
f11c7fbf26 revisionstore: remove Clone requirement from UnionStore
Summary:
By specifying the IntoIterator differently, we can avoid the clone requirement.
Since Clone isn't implemented on either DataPack or HistoryPack, this will
simplify the callers a bit

Reviewed By: DurhamG

Differential Revision: D13928274

fbshipit-source-id: f0261c50d73868689ebb3ae226f84d41c4c40925
2019-02-04 09:30:23 -08:00
Xavier Deguillard
82af74b019 revisionstore: add blanket HistoryStore implementation Rc, Arc and Box
Summary: This way, HistoryStore type constraint will work with these types.

Reviewed By: DurhamG

Differential Revision: D13928128

fbshipit-source-id: aaa9f2633166c137dca5fc2b1f44caab92b57a80
2019-02-04 09:30:23 -08:00
Xavier Deguillard
fb2b0f48d3 revisionstore: add blanket DataStore implementation for Rc, Arc and Box
Summary: This way, DataStore type constraint will work with these types.

Reviewed By: DurhamG

Differential Revision: D13928090

fbshipit-source-id: 1567556e3ffea2901acbc754b3bd67491e23056b
2019-02-04 09:30:23 -08:00
Xavier Deguillard
4c4e2a6909 revisionstore: remove RefCell from UnionStore
Summary: The UnionStore doesn't need internal mutability, so let's simplify it.

Reviewed By: DurhamG

Differential Revision: D13928058

fbshipit-source-id: f0ba085ff8401dcc99fc69c3eb6f5e20c071d650
2019-02-04 09:30:23 -08:00
Fatih Aydin
7e7faeea81 commands: add option to disable the incoming command
Summary: In repositories which change quickly, the incoming and outgoing commands aren't useful.  Add an option to disable these commands.

Reviewed By: markbt

Differential Revision: D13859604

fbshipit-source-id: c4784b7eafbe3c4a6cf03686f1431204089b0155
2019-02-04 07:09:37 -08:00
Mark Thomas
b44e2103d7 simplecache: don't use memcache in tests
Summary:
The simplecache test attempts to connect to a memcache instance on localhost.
This means the test fails if a memcache instance is not available.

Remove the use of memcache in the test.  We still test local files, and assume
that memcache itself works.

Also corrupt the correct key when testing corruption handling, and document the
config options.

Reviewed By: quark-zju

Differential Revision: D13818471

fbshipit-source-id: 6ca7f575aa813f95773144be5337796f029ffd90
2019-02-01 19:19:36 -08:00
Mark Thomas
ae0a81f2c2 rust: move bindings to a single python extension
Summary:
Move all Rust bindings to a single python extension, `bindings`.  This should
improve compilation time and make things simpler.

Reviewed By: quark-zju

Differential Revision: D13923866

fbshipit-source-id: 560592b5a6c0c4f1b836c755ef123666a1059164
2019-02-01 17:53:22 -08:00
Mark Thomas
87ba57b104 doctest: use new package path
Reviewed By: DurhamG, ikostia

Differential Revision: D13932057

fbshipit-source-id: 3b7cb640c7c510bd60ee2a3d1de737743686878b
2019-02-01 17:53:22 -08:00
Xavier Deguillard
b1203c00a5 asyncpacks: add AsyncMutableHistoryPack
Summary: This allows writing historypacks from an async context.

Reviewed By: DurhamG

Differential Revision: D13891932

fbshipit-source-id: b90ada657ee33d4736060eeaaf70a9d766b3aa31
2019-02-01 17:12:52 -08:00
Xavier Deguillard
edabec3c30 asyncpacks: add AsyncHistoryPack
Summary: This just reuses the AsyncHistoryStore methods.

Reviewed By: DurhamG

Differential Revision: D13891142

fbshipit-source-id: 9553e9824eebc5eacf6a82f9d0f212a62ec8955f
2019-02-01 17:12:52 -08:00
Xavier Deguillard
aead487e94 asyncpacks: add AsyncHistoryStore
Summary:
Similarly to AsyncDataStore, this is just a blocking wrapper around a
HistoryStore.

Reviewed By: DurhamG

Differential Revision: D13891140

fbshipit-source-id: 76acadfc1849770b47e2400ce8c70f7e32bba4df
2019-02-01 17:12:52 -08:00
Saurabh Singh
1752853929 commit: remove option to specify secret phase
Summary:
We will probably not be supporting secret phase in the future anyway
so lets get rid of it.

Reviewed By: quark-zju

Differential Revision: D13928907

fbshipit-source-id: 7edcd84d2ee3c37124dcf9d3ba92c0610d074157
2019-02-01 15:36:44 -08:00
Xavier Deguillard
259c19c598 asyncpacks: move the asynchronous wrapper to util.rs
Summary: This will be used to wrap an HistoryStore into a AsyncHistoryStore.

Reviewed By: DurhamG

Differential Revision: D13891139

fbshipit-source-id: 41a0ec740f05268259a654e769ff0909617102ff
2019-02-01 15:30:54 -08:00
Stanislau Hlebik
6adfda0e99 pushrebase: move selecting commit date in a separate file
Summary:
Add an option that let's us specify the date of each commit in a pushrebase.
It should be specified via a config option, which accepts a name of a file in
which json dictionary should be stored. Key of this dictionary is a commit hash, value
is a date.

Reviewed By: ikostia

Differential Revision: D13803174

fbshipit-source-id: 6271c18c61399b89c92dce7a4fe63c8fae8dae7c
2019-02-01 09:42:57 -08:00
Arun Kulshreshtha
d9439db691 mononokeapi: add metadata to datapack
Summary: Add metadata to each delta entry written to the datapack. Since the HTTP API never serves LFS files, and the only flag currently used simple indicates whether a file should use LFS, the flag field is intentionally set to `None`, leaving only the size in the metadata (which, since we're storing full file content, is the same as the content length).

Differential Revision: D13894292

fbshipit-source-id: 36db25adb0c46cd1c7fde841a69d3e6d48d08d06
2019-02-01 01:41:31 -08:00
Arun Kulshreshtha
78ba8186f3 remotefilelog: add debug command to fetch multiple files over HTTP
Summary: Previously, `hg debuggetfile` would allow fetching a single file from the API server. This diff updates the command to `hg debuggetfiles`, which accepts a list of filenode/path pairs on stdin, and fetches all the files concurrently, writing the contents to a single datapack.

Reviewed By: DurhamG

Differential Revision: D13893894

fbshipit-source-id: 36fc54f1870273ab4b447de5d615b3fb6aaa3378
2019-02-01 01:41:31 -08:00
Arun Kulshreshtha
50c293b94e pymononokeapi: add Python API for batch file downloads
Summary: Expose `MononokeClient`'s multi-get functionality through the Python bindings using a builder-style API.

Differential Revision: D13893748

fbshipit-source-id: 312e7449eb8300432b1f1de28e0c6fc3e47d1d53
2019-02-01 01:41:31 -08:00
Arun Kulshreshtha
f02ebcffb7 mononokeapi: support fetching multiple files concurrently
Summary: Give MononokeClient the ability to fetch multiple files concurrently. Right now this functionality is not exposed via the Python bindings, so as far as the Mercurial Python code is concerned, nothing has changed. The multi-get functionality will be used later in the stack.

Differential Revision: D13893575

fbshipit-source-id: c9e514fbeb41bbb37f52f6df3920eb01a66df293
2019-02-01 01:41:31 -08:00
Arun Kulshreshtha
a035c8783a mononokeapi: split out MononokeClientBuilder into separate module
Summary: As `MononokeClient` grows, we're going to add more inherent methods on the struct. To avoid cluttering the `client` module, split out all the builder-related things into a separate module.

Reviewed By: singhsrb

Differential Revision: D13892198

fbshipit-source-id: 42918d8a775d8328cfad8a6ac0365cb336893d8f
2019-02-01 01:41:31 -08:00
Arun Kulshreshtha
1b74af2ace mononokeapi: add ability to fetch a file and write it to a datapack
Summary: Add a new `get_file()` method to `MononokeClient` that fetches Mercurial file content from the API server and writes it to a datapack in the cache. This functionality is exposed via the new `hg debuggetfile` debug command, which takes a filenode and file path and fetches the corresponding file.

Differential Revision: D13889829

fbshipit-source-id: 2b68bf114ee72d641de7a1043cca1975e34cf4e6
2019-02-01 01:41:31 -08:00
Michael Bolin
bfc7d3cf4f Move dotslash into fbcode/scm/hg/exec and add to the release script.
Summary:
This change is to get DotSlash (https://fb.quip.com/7BbiAmxAK09T)
in the Mercurial release. It renames the build rule from `dotslash` to
`dsl` under the assumption that that determines the name of the binary
to be deployed.

Reviewed By: quark-zju

Differential Revision: D13868779

fbshipit-source-id: dd44d874a60ab85b3dcca79ba5076a6f2fa64135
2019-01-31 18:57:40 -08:00
Zeyi Fan
18dba7c3e4 Update to Rust 1.32.0
Reviewed By: pixelb

Differential Revision: D13833031

fbshipit-source-id: bec117160ff95f78d49bba7d9b73818f7aeb74bf
2019-01-31 16:44:57 -08:00
Durham Goode
f176bf5b5f tests: fix p4fastimport tests
Summary:
The rename to edenscm broke the test.

(Note: this ignores all push blocking failures!)

Reviewed By: phillco, ikostia

Differential Revision: D13900989

fbshipit-source-id: ad04fcb6889a273bb39901b2288ae1aef74531a6
2019-01-31 11:35:24 -08:00
Arun Kulshreshtha
f19e1e6771 remotefilelog: rename debugmononokeapi to debughttphealthcheck
Summary: Rename this debug command to make it obvious what it does (i.e., perform a health check) and make it print more useful output (i.e., the name of the server for which it performs the health check).

Reviewed By: DurhamG

Differential Revision: D13890867

fbshipit-source-id: 8fc96bcc06d04611a308ecc0b870049936f1cb29
2019-01-30 18:30:49 -08:00
Arun Kulshreshtha
5ae0d91378 url-ext: add url-ext crate
Summary:
Crate adding easy conversions between `http::Uri` and `url::Url`.

Rust has two main types for working with URLs: `http::Uri` and `url::Url`.  `http::Uri` comes from the `http` crate, which is supposed to be a set of common types to be used throughout the Rust HTTP ecosystem, to ensure mutual compatibility between different HTTP crates and web frameworks. This is the type that HTTP clients like Hyper expect when specifying URLs.

Unfortunately, `http::Uri` is a very simple type that does not expose any means of mutating or otherwise manipulating the URL. It can only parse URLs from strings, forcing the users to construct URLs via error-prone string concatenation.

In contrast, the `url::Url` comes from the `rust-url` crate from the Servo project. This type does support easily constructing and manipulating URLs, making it very useful for assembling a URL from components.

The only way to convert between the two types is to first convert back to a string, and then re-parse as the desired type. Several issues [have](https://github.com/hyperium/hyper/issues/1219) [been](https://github.com/hyperium/hyper/issues/1102) [raised](https://github.com/hyperium/hyper/issues/1219) about this upstream, but there has been no consensus or action as of yet. To get around the problem for now, this crate adds convenience methods to perform the conversions.

Reviewed By: DurhamG

Differential Revision: D13887403

fbshipit-source-id: ecfaf3ea9d884621493b0fe44a6b5658d10108b4
2019-01-30 18:30:49 -08:00
Jun Wu
b557ea167b doc: fix rst format
Summary: Fix ill-formatted content that breaks `make doc`.

Reviewed By: singhsrb

Differential Revision: D13885565

fbshipit-source-id: 1b4a771e535f76679d73d9081714ad4c36b1db8c
2019-01-30 14:57:42 -08:00
Jun Wu
415f3fd88c gendoc: import extensions properly
Summary:
The script tries to extract docstrings of all extensions. It failed to do so
because the extension directory was moved. Fix it by using the default path to
import extensions.

Note: this was half broken before the `edenscm` move because the extensions
cannot be imported correctly so every extension fall backs to "None" in their
help text. This diff fixes that so `man hg` would actually include actual
extension helps. However, some extensions have ill-formatted rst docstrings.
They are fixed in the next diff.

Reviewed By: singhsrb

Differential Revision: D13885567

fbshipit-source-id: 0aba1bc4b0f09fbd8e55d9c8e6ff2587ff6be3f7
2019-01-30 14:57:42 -08:00
Jun Wu
824632606f makefile: remove hgext3rd
Summary: `hgext3rd` was gone. Remove it.

Reviewed By: singhsrb

Differential Revision: D13885071

fbshipit-source-id: 9b82b24b17de61546f3beaeb6c3c3123ab2d2524
2019-01-30 14:57:42 -08:00
Liubov Dmitrieva
aadd79c27f Back out "Back out "[mercurial] enable modern way to transport phases on client side""
Summary:
Original commit changeset: 1cdd43658889

Trying to enable this again.

The details are in the original diff: D13622994

Reviewed By: quark-zju

Differential Revision: D13801916

fbshipit-source-id: a7a1aee6faa0d1db7535dfd3cfab523829c62900
2019-01-29 21:47:11 -08:00
Jun Wu
a5fcac6954 setup: remove inaccurate comment about vendored crates
Summary:
`.hg-vendored-crates` is no longer a thing.

Now, the hg vendored crates always match tp2 crates, managed by the
`fbcode/tools/lfs/crates-io.py` script.

Reviewed By: ikostia

Differential Revision: D13873209

fbshipit-source-id: 6b5782b4834c49fa7d88aa1870703138eb9feb00
2019-01-29 17:59:29 -08:00
Jun Wu
9dc21f8d0b codemod: import from the edenscm package
Summary:
D13853115 adds `edenscm/` to `sys.path` and code still uses `import mercurial`.
That has nasty problems if both `import mercurial` and
`import edenscm.mercurial` are used, because Python would think `mercurial.foo`
and `edenscm.mercurial.foo` are different modules so code like
`try: ... except mercurial.error.Foo: ...`, or `isinstance(x, mercurial.foo.Bar)`
would fail to handle the `edenscm.mercurial` version. There are also some
module-level states (ex. `extensions._extensions`) that would cause trouble if
they have multiple versions in a single process.

Change imports to use the `edenscm` so ideally the `mercurial` is no longer
imported at all. Add checks in extensions.py to catch unexpected extensions
importing modules from the old (wrong) locations when running tests.

Reviewed By: phillco

Differential Revision: D13868981

fbshipit-source-id: f4e2513766957fd81d85407994f7521a08e4de48
2019-01-29 17:25:32 -08:00
Wez Furlong
83f00ab318 hg: restore spawning watchman on-demand
Summary:
A while back, as a startup optimization, we started to hard code
the path to the watchman socket in the mercurial config.  This meant
that we could avoid running a subprocess for every command.

Today, a chef configuration change was rolled out that caused watchman
to be stopped on all of the corpnet macs with the result being that
all mercurial commands are slow because it never uses and never restarts
watchman.

This diff adds some fallback logic to allow spawning the server in
the case that we have a connection error.

Reviewed By: DurhamG

Differential Revision: D13855696

fbshipit-source-id: 44c0ad36b6e80520912e42bcea9e04f4f165b588
2019-01-29 15:49:37 -08:00
Xavier Deguillard
fcd2fb9642 asyncpacks: fix compilation warnings
Summary: Some of the revisionstore imports were unused.

Reviewed By: kulshrax

Differential Revision: D13865074

fbshipit-source-id: 79c7c2ba869f2e1d72fa06aac70a4b027367c831
2019-01-29 14:10:31 -08:00
Adam Simpkins
043e2016ac fix some additional edenscm name changes
Summary:
Follow up to D13853115 to fix test failures:
- Update an `__import__` statement in dispatch.py to use the new
  `edenscm.mercurial` package path.
- Make sure the `__version__.py` file is generated at the correct location by
  the buck build files.

Reviewed By: quark-zju

Differential Revision: D13858016

fbshipit-source-id: 54ac4a02274cf921397932e9625f422c5f427623
2019-01-29 12:26:10 -08:00
Arun Kulshreshtha
e80ea448d2 revisionstore: reexport Key at top level
Summary: title

Differential Revision: D13858151

fbshipit-source-id: 9f188c2a21382de65eb7febc45a46e10763771b3
2019-01-29 11:45:23 -08:00