Commit Graph

45774 Commits

Author SHA1 Message Date
Mark Thomas
60e99a245c ui: add labelled prefixes to ui.write
Summary:
Add optional prefix keyword arguments to `ui.write` (and thus `ui.status`,
`ui.warn`, etc.).  These prefixes can be used to indicate an error condition,
some notice to the user, or to mark a message as coming from a particular
component.  The prefixes are labelled so that they can be colored to stand
out from the surrounding text.  The default colors are red for errors, yellow
for notices, and cyan for components.

Add a component parameter to `error.Abort` (and thus any exception that
inherits from it) that can be used by callers to mark which component is
responsible for the exception.   When the error is printed, the component is
passed as the component prefix of the error message.

Reviewed By: mitrandir77

Differential Revision: D15201946

fbshipit-source-id: 02e3da40e9563704fa1d7ce81366e6e7f66c7f34
2019-05-09 06:55:11 -07:00
Mark Thomas
51ef0b524e commitcloud: refactor sync functions into the sync module
Reviewed By: quark-zju

Differential Revision: D15201943

fbshipit-source-id: 851c1a678ded0491c749e09467a86379e2e72128
2019-05-09 06:55:10 -07:00
Saurabh Singh
145ef2b991 metaedit: fix the tests for the --batch option on OSX
Summary:
D15188668 added the `--batch` option to the `metaedit` command along
with updating the tests. Unfortunately, the test is broken on OSX. This commit
fixes the test to be compatible with OSX.

Differential Revision: D15273960

fbshipit-source-id: 57a67b9d7ab2b471ee205db4fdfc7f3e6e2e553b
2019-05-08 20:49:45 -07:00
Xavier Deguillard
d150a1273b remotefilelog: commit pending packfiles before closing the repo
Summary:
While closing the repo, hg_memcache_client is terminated, and later, the
pending packfiles are commited. Unfortunately, the commit phase is also when
the content of the pending packfiles will be sent to memcache, and since the
connection is at this point closed, nothing is sent then.

Reviewed By: quark-zju

Differential Revision: D15247639

fbshipit-source-id: 8719cb8bbc3c9571b9cfe250ba4be2b745e4ba15
2019-05-08 11:07:47 -07:00
Stefan Filip
4e9787b879 manifest: handle missing line feed in tree manifest entries
Summary:
A tree manifest entry must always end with a line feed. It is somewhat
redundant but that's how the serialization is defined. Sometimes that last
line feed is missing in our data. I don't know why.

Reviewed By: quark-zju

Differential Revision: D15110860

fbshipit-source-id: c4ac5075e22a8b8851f6b246d22af8ab68f42a74
2019-05-08 10:07:28 -07:00
Stefan Filip
a8bc9fc3a7 manifest: use dynamic dispatch for tree manifest store
Summary:
This is a quality of life improvement for working with the storage layer.
We probably don't gain a whole lot by statically linking the store and it is
useful to have some flexibility in the storage layer.

Differential Revision: D15110859

fbshipit-source-id: 6102acafa21dd1dbaeed0f8fc3147538a8c301d1
2019-05-08 10:07:27 -07:00
Xavier Deguillard
10c8dd46e1 remotefilelog: simplify the creation of the remotefilelog unionstores
Summary:
With the mutablestores, this code was starting to be too messy and hard to
follow. Let's simplify it a bit.

Reviewed By: quark-zju

Differential Revision: D15200748

fbshipit-source-id: 2c0cc5a4ff5057f7a9590fcc602afc2b1cc72dcd
2019-05-08 09:16:49 -07:00
Durham Goode
4a3e46181a docs: fix doc indentation error
Summary: This is breaking the build.

Differential Revision: D15260335

fbshipit-source-id: 0d52414ac465d5ebeb4ba31ec9bf4016e193c7ed
2019-05-08 09:09:07 -07:00
Kostia Balytskyi
7cdba1875d pushrebase: move var initialization out of try
Summary:
The `finally` block relies on this name being in scope. If the exception
happens before this name is initialized, the finally block also throws and we
loose the original root cause exception.

Reviewed By: singhsrb, HarveyHunt

Differential Revision: D15244583

fbshipit-source-id: fd8be11987c3028f775a62cb3ae308b30a9d5e75
2019-05-07 15:01:28 -07:00
Marla Azriel
18f2c260d9 commands: help text for purge, revert
Summary: Updated help text for hg purge, hg revert

Reviewed By: kulshrax

Differential Revision: D15200356

fbshipit-source-id: 99a30a5cccca22b66245264f0f7ed761dc48e256
2019-05-07 14:07:34 -07:00
Jun Wu
3d025d497a chg: do not start or use a chg server if the process was running with low priority
Summary:
If a chg server was started by a low priority process, it will inherit the low
priority and can be painfully slow.

On the other hand, if the chg client was low priority, the user or the automation
wants the process to be low priority intentionally. Therefore connecting to an
existing chg server might bypass intention.

Therefore, detect the low priority case, and refuse to start or connect to a
chg server.

Previous attempts to workaround slow chg server were removed as they are
probably no longer necessary.

Reviewed By: singhsrb

Differential Revision: D15223518

fbshipit-source-id: 718e807820d481eac204f2293f949c3b315f923d
2019-05-06 15:50:43 -07:00
Durham Goode
34d0345ce3 worker: fix string formatting issue
Summary:
In a previous diff I did a last minute refactor that apparently broke a
test. I needed to update this line as well to swap the arguments.

Reviewed By: singhsrb

Differential Revision: D15219418

fbshipit-source-id: c66a2cf7bbbec80ebbbd6ca818151de5f0c2d2c5
2019-05-06 14:46:01 -07:00
Adam Simpkins
9b6992506a tracing: fix the perftrace tests
Summary: Update the tests to expect the new output added by D15173846.

Reviewed By: quark-zju

Differential Revision: D15212315

fbshipit-source-id: 82bb3b4e67a28eb8905d35fcaa8251947163f521
2019-05-06 12:17:40 -07:00
Xavier Deguillard
f94c1f0c69 revisionstore: repack packfiles to get under 50 packfiles.
Summary:
When remotefilelog.fetchpacks is enabled, it's possible that 100 packfiles of
100MB each are present. In this case, every new packfiles that
hg_memcache_client would write will force an incremental repack, which will
only reduce the number of packfiles by a small number.

Let's have a simple heuristic that tries to bring the number of packfiles to be
lower than 50.

Reviewed By: DurhamG

Differential Revision: D15203771

fbshipit-source-id: 18c39487d5ac087d4879004993c1c1add087249c
2019-05-06 12:07:31 -07:00
Adam Simpkins
38819c08e8 add a copyright header to lib/dag/src/tests.rs
Summary: This fixes the test-check-fix-code.t test.

Reviewed By: quark-zju

Differential Revision: D15212386

fbshipit-source-id: b9125d691b50ca44e59674da818666b0b2633ee5
2019-05-06 11:59:04 -07:00
Adam Simpkins
6c30a172a9 fix the test-worker.t test
Summary: Update the test code to return a 3-tuple as required after D15173846.

Reviewed By: singhsrb

Differential Revision: D15212317

fbshipit-source-id: 5c5ecaae858a3eaab23f624c11f0dda3ac74a870
2019-05-06 11:50:11 -07:00
Wez Furlong
1b444df83d scratch: specify windows config path
Summary:
Previously we would only look for `/etc/scratch.toml`,
which doesn't exist on windows and would resolve ambiguously
depending on the current working directory drive letter.

This diff sets up scratch to look for a site configuration
in a similar location to where we deploy the watchman
configuration on windows systems.

Reviewed By: simpkins

Differential Revision: D15208158

fbshipit-source-id: 3b7e26f14f5b35c6fe7e196eba4e482b26bdeb01
2019-05-03 17:52:00 -07:00
Stefan Filip
935c02e6f2 reset: fix visibility interaction
Summary:
`visibility.add` expects to be given a list of nodes. From reset
we pass a single node which makes the underlying code break it up.

Reviewed By: singhsrb

Differential Revision: D15207234

fbshipit-source-id: 9e0dd0cc8dde0eac69d20816923b39f20963237c
2019-05-03 17:44:51 -07:00
Jun Wu
6510e40568 makefile: add a RFLAG parameter
Summary:
This allows us to pass flags to the step building Rust extensions.

For example, `make RFLAG=--debug local` would build extensions in debug mode,
which might take less time.

Reviewed By: singhsrb

Differential Revision: D15204831

fbshipit-source-id: 8906884e6617e20abaabb0d1f2b4e33bb9e304ba
2019-05-03 16:02:12 -07:00
Jun Wu
a0bccf8b7b metaedit: allow editing commit messages in batch
Summary:
I wanted this feature in multiple cases. For example, I have renamed
`segdag::SegDag` to `segment::Dag`, and want to edit commit message for
`D15055347::D15055347`, a 9-diff stack. Editing them one by one is
painful.

Reviewed By: singhsrb

Differential Revision: D15188668

fbshipit-source-id: c7cc11aca0a5e16992b5246a74346a35bec00770
2019-05-03 15:55:20 -07:00
Jun Wu
5aff235940 dag: add some ancestor related algorithms
Summary:
Add simple algorithms to select all ancestors of a single node, or calculate a
"random" gca of two nodes.

Mercurial supports more "advanced" operations, like calculating ancestors of
multiple nodes, or calculating all ancestors of more than 2 nodes. We'll
see if those are necessary and maybe build fast or slow paths for them.

Reviewed By: sfilipco

Differential Revision: D15055347

fbshipit-source-id: c8c2bac2797d0389adb58c89b67e3ddfb62eb06f
2019-05-03 13:35:41 -07:00
Jun Wu
0be69e90e3 dag: add some tests about segmentation and id assignments
Summary:
We now have enough building blocks to put things together.

The tests are taken from the slides. Both examples and some corner cases, plus
two maybe-interesting synthetic cases.

There are probably more details to test. But this should give us some level of
confidence.

Reviewed By: sfilipco

Differential Revision: D15055346

fbshipit-source-id: a76b70fec0ec7e88378830f251f997d147416db0
2019-05-03 13:35:41 -07:00
Jun Wu
a04bdd0ab9 dag: add logic to build high level segments
Summary:
High-level segments are built on top of lower level segments.
We simply scan through them, and greedily pick the longest ones.

Reviewed By: sfilipco

Differential Revision: D15055348

fbshipit-source-id: 3b72dc766abd46669b787187b7d1d5f7171c026a
2019-05-03 13:35:41 -07:00
Jun Wu
c0295c5218 dag: add logic to build flat segments
Summary:
To build flat segments, we take a `get_parents(id) -> [id]` function and an end
`id`. Then scan through the missing ids and try to make them segments greedly.

Reviewed By: sfilipco

Differential Revision: D15055351

fbshipit-source-id: 21a503d4c3894583a314c6dfd4c7b87fafb95d95
2019-05-03 13:35:40 -07:00
Jun Wu
73fdb98c4c idmap: add logic to translate parent function
Summary:
segment::Dag wants a `get_parents` function that speaks Ids instead of slices,
as segment::Dag works entirely on Ids.

Provide a function to translate `get_parents` on byte slices to Ids.

Reviewed By: sfilipco

Differential Revision: D15055350

fbshipit-source-id: 795367cf809f068c0cad2515af02c93e14960236
2019-05-03 13:35:40 -07:00
Jun Wu
a45f29ebcd idmap: add logic to assign IDs
Summary:
Assigning IDs affects performance of segments. Therefore

The logic is abstracted in a way that the callsite only needs to provide a
`get_parents(slice) -> [slice]` function, and a slice to begin with. This
is intended to make it reusable for multiple cases:

- drawdag get_parents, for tests
- revlog get_parents
- Mononoke get_parents

Reviewed By: sfilipco

Differential Revision: D15055349

fbshipit-source-id: d6475737eb87f5ab7d7bd8123a8f4ae2b6d108e8
2019-05-03 13:35:40 -07:00
Jun Wu
c32c89ffa4 drawdag: implement a Rust drawdag library
Summary:
This library parses an ASCII DAG. It is similar to mercurial/drawdag.py, which
was added by me in [1].

There are some (intentional) differences from the Python drawdag:

- Stricter. Confusing DAG characters like `+` or crossing lines are forbidden.
- Do not special handle `o` as a name.
- Do not try to be compatible with `hg log -G` output.
- Do not support special comments (yet).
- Support both left to right and bottom to top directions.

This library tries to be abstract. i.e. it does not have actual logic about
how to make a commit. Its intended users are Mononoke and scmdag, which have
different ways to make commits.

Since this is a library that is intended to be used only for tests. I didn't spend too
much effort to optimize its performance.

[1]: https://www.mercurial-scm.org/repo/hg/rev/a31634336471

Reviewed By: kulshrax

Differential Revision: D15039768

fbshipit-source-id: 4c33d44759ecf59aadc3d443a84db07d702dc69b
2019-05-03 13:35:40 -07:00
Jun Wu
771b6f05e5 dag: implement basic operations
Summary: Implement basic lookup by head, lookup by id, and write operations.

Reviewed By: sfilipco

Differential Revision: D15019663

fbshipit-source-id: 3747f7e855a20120762d4e12b098e99b2ed3dfcb
2019-05-03 13:35:40 -07:00
Jun Wu
a84e552e85 dag: introduce segment::Dag
Summary:
The segment::Dag structure stores all levels of segments. The "segment" concept
is introduced by D14937221.

This diff adds empty structures and the serialization format.

Reviewed By: sfilipco

Differential Revision: D15019662

fbshipit-source-id: 8136acd45dc8526391e94c5ae98b609d4f8b392a
2019-05-03 13:35:39 -07:00
Durham Goode
520f62ff69 tracing: record how many bytes are written to disk
Summary:
This updates our apply updates logic to record how many files and how
many bytes were written to disk.

Reviewed By: quark-zju

Differential Revision: D15173846

fbshipit-source-id: c26d2b17f45e407f837c78c93fc440e960d4f922
2019-05-03 13:09:34 -07:00
Durham Goode
ba7bbeca36 tracing: track non-prefetch tree fetchs
Summary:
We already had tracing for tree prefetches, but in some cases the
fetching happens ondemand and goes through a different code path. Now that we
have pack file receive size tracking, let's annotate this appropriately.

Differential Revision: D15172482

fbshipit-source-id: 2db1dc8464ed9e0b8f6987718c448e391744f445
2019-05-03 13:09:34 -07:00
Durham Goode
f6ba729791 tracing: record size of pack files received
Summary: This will let us get a feel for download speeds.

Reviewed By: kulshrax

Differential Revision: D15168153

fbshipit-source-id: 86291b8eb3393d54271d574250291ed691a64a86
2019-05-03 13:09:33 -07:00
Durham Goode
d797d52db4 tracing: record the number of memcache misses
Summary: Records how many memcache misses we hit.

Reviewed By: kulshrax

Differential Revision: D15168154

fbshipit-source-id: 53e105999d0af566666fcfaecc5bcaf414c5e804
2019-05-03 13:09:33 -07:00
Durham Goode
44ef67cc59 tracing: record lfs download size
Summary:
Adds tracing support for recording how many bytes we download for lfs,
including the download speed.

Reviewed By: kulshrax

Differential Revision: D15167587

fbshipit-source-id: fb76bbf15cd44dcef2601d9e750794816d273120
2019-05-03 13:09:33 -07:00
Durham Goode
c5b3e4bcb6 packs: refresh stores after fetching packs
Summary:
The prefetch code was not refreshing the pack stores after writing
stuff into packs. This meant that in some cases we would execute a prefetch,
then when we went to read an entry from the store it wouldn't be found. That
would trigger a one-by-one download, which would happen to trigger a pack store
refresh (since remotecontentstore had a refresh) which would cause the rest of
the prefetched data to then become visible.

This fixes it to make prefetch responsible for refreshing the pack data.

This also caused issues where prefetching lfs files requires the hg fetching to
get the metadata, then it reads that metadata and does an lfs fetch. Since the
original metadata wasn't visible (since the packs had not refreshed), this
resulted in infinite recursion until the default 100ms refresh time passed.

Differential Revision: D15171701

fbshipit-source-id: 190b1da542675265efaad75a2a6826cbe3c9631c
2019-05-03 13:09:33 -07:00
Mark Thomas
5588453fb6 threading: suppress non_camel_case_types warning
Summary:
`bug29988wrapper` is a non-camel-case type, which fits the Mercurial Python
code style, but the Rust compiler warns about it.  Suppress the Rust warning.

Reviewed By: quark-zju

Differential Revision: D15197827

fbshipit-source-id: 54d0b4020f8e43e3bc24f9ab37e0ede55dc919e9
2019-05-03 11:17:51 -07:00
Aida Getoeva
10e0a1143a remotenames: separate lock for the accessed bookmarks file
Summary:
File that tracks accessed bookmarks doesn't interact with anything else and doesn't really need repo.wlock. However if does use wlock, hg commands like `hg log -r`, which normally are read-only, start waiting for the lock and thus are blocked by other writing commands, that might be running in different checkouts of the same repo.

Let's use a different lock for this feature.

Reviewed By: simpkins

Differential Revision: D15165788

fbshipit-source-id: f04c7196d51db67069c6420545be24d2b7c0af27
2019-05-03 06:49:10 -07:00
Mark Thomas
75ca3f73f7 infinitepush: delay import of sqlindex
Summary:
`infinitepush.sqlindex` depends on `mysql.connector`, which is only needed on
infinitepush servers using the sqlstore, and may not be otherwise available.
Delay the import of this module until we know for sure that it is needed.

Reviewed By: ikostia

Differential Revision: D15197758

fbshipit-source-id: 34f166ceab2530c875a4539089e544755f199b7b
2019-05-03 04:09:54 -07:00
Jun Wu
7e40e48447 linkrevcache: keep memory usage bounded
Summary:
Do not keep all revlogs in memory. Detect memory usage and drop filelogs on
demand.

Reviewed By: ikostia

Differential Revision: D15186221

fbshipit-source-id: 8311d479e8dd4f8f449981873a98940410c20c9e
2019-05-02 19:13:30 -07:00
Xavier Deguillard
f094ccb2e3 remotefilelog: download packfiles to a pending mutable pack
Summary:
On a memcache miss, let's put the server data into a pending packfile. This
will greatly reduce the number of packfiles being created, and thus reduce the
need to run repack.

Reviewed By: DurhamG

Differential Revision: D15154509

fbshipit-source-id: 661efd7fde4fc4f3f6441eebeaf7d3ff4c43871a
2019-05-02 15:32:25 -07:00
Xavier Deguillard
90d96e6971 remotefilelog: add a pendingmutablepack class
Summary:
The code to handle pending mutable packs was effectively duplicated in 3
places. The new class allows refactoring of all of it. The use of several
lambdas is unfortunate, but required as the repo and the cache path are dynamic
and can't be obtained when constructing the pendingmutablepack object.

Reviewed By: DurhamG

Differential Revision: D15023059

fbshipit-source-id: 1eae68fe66ce741eb36baa0c8db318ba32957b41
2019-05-02 15:32:25 -07:00
Mark Thomas
4fe3f41877 infinitepush: remove import cycle
Summary:
There is an import cycle where `server` imports `common` imports `bundleparts`
imports `server`.

Reviewed By: quark-zju

Differential Revision: D15186907

fbshipit-source-id: 4766e02daee3340f9bee8509c790b9584eae1ac8
2019-05-02 14:48:34 -07:00
Arun Kulshreshtha
60f8a0938f edenapi: improve progress reporting
Summary:
This diff adds a new progress reporting framework to the Eden API crate and uses it to power progress bars for HTTP file downloads in Mercurial.

The new `ProgressManager` type is designed to aggregate progress values across multiple concurrent HTTP transfers. The API is currently designed to integrate well with libcurl's progress callback API, allowing all of the curl handles within a curl multi session to concurrently report their progress.

This progress can then be reported (in aggregate) to a user-provided callback. In most cases, this callback will be a Rust wrapper around a callback provided by the Python code. The `EdenAPI` trait and FFI bindings have been updated accordingly to allow optionally passing in a callback for long-running operations.

Lastly, in `remotefilelog`'s Python code, the callback is specified as a Python closure that simply updates the progress bar.

Reviewed By: quark-zju

Differential Revision: D15179983

fbshipit-source-id: ee677b71beff730f91aafe0364124f7ea0671387
2019-05-02 14:20:55 -07:00
Thomas Orozco
398d8bcc1f hgsql: expose reason on top of sqlisreporeadonly
Summary:
This introduces `repo.sqlreporeadonlystate()`, which works similarly to `repo.sqlisreporeadonly()`, but also gets the reason why the read only state is the way it is.

The underlying goal is to use this in a repo hook to report the lock state.

I retained the `sqlisreporeadonly` function so that we don't need to synchronize deployment of this code and the underlying hook.

Reviewed By: quark-zju

Differential Revision: D15165946

fbshipit-source-id: 0a62147167fa826b575178dd261990a956b5f317
2019-05-02 09:08:51 -07:00
Mark Thomas
0327e01223 infinitepush: refactor common functions into common modules
Reviewed By: DurhamG

Differential Revision: D15170161

fbshipit-source-id: c3e6e9f309a22ac6ed258f484ca625633c434405
2019-05-02 07:06:46 -07:00
Mark Thomas
23f7bbf387 infinitepush: refactor client-specific functions into client module
Reviewed By: DurhamG

Differential Revision: D15170163

fbshipit-source-id: 21ae784c5867bcf198aaa8c079c21b00ae5334fb
2019-05-02 07:06:45 -07:00
Mark Thomas
7ff9b4e72d infinitepush: refactor server-specific functions into server module
Reviewed By: DurhamG

Differential Revision: D15170160

fbshipit-source-id: e83d2d49e78aa7a6a7ba5e06b171694f020b34ee
2019-05-02 07:06:45 -07:00
Mark Thomas
522e0f2ec4 infinitepush: refactor bundlestore
Summary:
Move all the store creation and access code into bundlestore.  Clean up the
interfaces to the index and store, removing the abstract base classes as no
code was being shared.

Reviewed By: DurhamG

Differential Revision: D15170164

fbshipit-source-id: f22ec4a266333b3100074b21cf9577c82f56e4c6
2019-05-02 07:06:45 -07:00
Mark Thomas
104261775b visibility: add unamend support
Summary:
Add support for the `unamend` command.  It should use the mutation predecessors
if mutation is enabled, and update the visibility of the commits.

Reviewed By: quark-zju

Differential Revision: D15146976

fbshipit-source-id: e9ee4d26f45ba9e5c3c05a7bca80c8ac326adb9c
2019-05-02 04:06:26 -07:00
Arun Kulshreshtha
453c7a95fc edenapi: make hg debughttp print real hostname of api server
Summary: Per title, `hg debughttp` now prints out the hostname that the API server reports rather than the hostname in the URL we used to connect to it. The reason for this is that if the API server is behind a VIP, we get the actual hostname rather than just the VIP URL.

Differential Revision: D15170618

fbshipit-source-id: 9af5480f9987d8ea9c914baf3b62a00ad88d1b32
2019-05-01 19:56:32 -07:00