Commit Graph

45785 Commits

Author SHA1 Message Date
Stanislau Hlebik
8adfcdd88c hgsql: use fetchall method in committodb
Summary:
It makes this method 25-30% faster (shaves off 250-300 ms).

Also it counts number of fetched rows correctly - fetchall method was
overriden, but looks like __iter__ method wasn't

Reviewed By: ikostia

Differential Revision: D14915472

fbshipit-source-id: 313695c1a83d05dac2fc801792226b6b64539cb5
2019-04-13 03:20:27 -07:00
Stefan Filip
14fde96b83 tests: fix test-hgsql-encoding
Summary: This test was failing because mercurial wants the file paths to be valid utf-8.

Reviewed By: singhsrb

Differential Revision: D14924604

fbshipit-source-id: be2db5c437df77ad3ad70f6956451e4a03835378
2019-04-12 19:57:44 -07:00
Arun Kulshreshtha
106c528c30 amend: remove dead code
Summary: This extension has been refactored many times, resulting in some code and config options that are (as far as I can tell) completely unused. Let's remove them.

Reviewed By: singhsrb

Differential Revision: D14920751

fbshipit-source-id: 8d716a1d6144ba51cdb2750f6cfc6d6262b3b8a3
2019-04-12 14:24:46 -07:00
Mark Thomas
9160d34e9e histedit: fix call to hex in loginfo
Reviewed By: mitrandir77

Differential Revision: D14911288

fbshipit-source-id: f0cfda26022da98c3722946511e52d889f965810
2019-04-12 01:57:56 -07:00
Jun Wu
4ca0b2c778 indexedlog: move macros to a separate module
Summary:
The internal rustfmt linter suggests wrong autofixes for the `impl_offset!`
macro. That's noisy for every diff touching `index.rs`. Silence it by moving
macros to a separate file.

To be consistent, `define_error!` is also moved.

Differential Revision: D14885746

fbshipit-source-id: d1a518e631f80d6d7945f1ea3c2e4d18e1c799ca
2019-04-11 12:51:26 -07:00
Xavier Deguillard
5ddf39f788 remotefilelog: add an indexedlog contentstore
Summary:
While the Rust code can read/write content out of an indexedlog, the Python
code cannot. For now, all the writes will be done in Rust, and the Python code
will only be able to read from it.

Reviewed By: quark-zju

Differential Revision: D14894330

fbshipit-source-id: 5c1698d31412bc93e93dabb93be106a2ef17d184
2019-04-11 12:07:58 -07:00
Xavier Deguillard
10ae96292e asyncpacks: add indexedlogdatastore
Summary:
As The IndexedLogDataStore will be used in hg_memcache_client, it needs to be
used in async code, and thus needs an async wrapper.

Note: I should probably rename the crate to "asyncrevisionstore" :)

Reviewed By: quark-zju

Differential Revision: D14881362

fbshipit-source-id: 203ce50954d99899715b32f85e6118e757578ece
2019-04-11 12:07:58 -07:00
Xavier Deguillard
301c0f173a remotefilelog: only take repacklock once per repack
Summary:
While not a correctness issue, taking and releasing the repack lock multiple
times per repack makes `hg debugwaitonrepack` unreliable, which in turns makes
test flakey.

Reviewed By: quark-zju

Differential Revision: D14877896

fbshipit-source-id: 682b649f388d19fd51bcf8dd205ac96944039e86
2019-04-11 10:43:38 -07:00
Durham Goode
c32fd83458 tracing: log manifold perftrace samples
Summary:
We currently send perf traces to the blackbox, but we also want to log
them to our metrics. This configures hg to log the perf trace as a sample. Later
diffs will configure our wrapper to route these samples to manifold.

Reviewed By: mitrandir77

Differential Revision: D14881308

fbshipit-source-id: 07690f9af9fe14279a9ebf5089548c5880cba45d
2019-04-11 10:06:37 -07:00
Mark Thomas
a8907ff92c visibility: add telemetry logging
Summary: Add telemetry logging for visible head count.

Reviewed By: ikostia

Differential Revision: D14892255

fbshipit-source-id: 8a141e48ee834c9916b4f6233024a110728734b3
2019-04-11 08:57:52 -07:00
Mark Thomas
105e0dccf6 obsolete: don't create autorels for the final successor
Summary:
Autorels attempts to detect the scenario where `P -> Q` and `X -> Y` are
being added, and there already exists a `P -> ... -> X` relationship.

In this case it will create a `Q -> Y` "copy" marker to express the fact
that `Q` should be copied.

However, this also triggers in the case where `Q == Y`, creating a revive
marker for `Q`.

Normally this is benign, as Q is probably visible anyway, however when there
are two commits associated with a diff that has been landed, pullcreatemarkers
can create two markers: `P -> L` and `X -> L`.  Since P and X are for the same
diff, there probably exists a `P -> ... -> X` relationship, and so autorels
attempts to make an `L -> L` marker.  This fails because L is public.

Differential Revision: D14891063

fbshipit-source-id: 3f076a003508dd7b7d17e3eb7cdaeb8ac09e6b15
2019-04-11 07:49:21 -07:00
Mark Thomas
32b06d418d obsolete: add test demonstrating autorels obsoleting a public commit
Summary:
Demonstrate that a combination of autorels and pullcreatemarkers causes an
attempt to obsolete a public commit.

Differential Revision: D14891064

fbshipit-source-id: 29f5cea9c843cc87aef18f74bad11eaabfa7b311
2019-04-11 07:49:21 -07:00
Mark Thomas
fd1fc9e705 visibility: pullcreatemarkers should exclude hidden commits
Summary:
With explicit visibility tracking, some commits may be hidden but not obsolete.
Pullcreatemarkers should not include these hidden commits when it is considering
what to link to landed commits.

Differential Revision: D14891062

fbshipit-source-id: 542363c979aca85d6de2e2161c00d91f67f0add3
2019-04-11 07:49:21 -07:00
Mark Thomas
9c9b28498c registrar: document 'subonly' option to the command decorator
Summary:
The `subonly` option in the command decorator indicates that a command must be
called with a subcommand.  Document this in the decorator documentation.

Differential Revision: D14876782

fbshipit-source-id: d121f94437e47cad2a7f3abe0faac300792c1c76
2019-04-11 07:49:21 -07:00
Mark Thomas
90b12d41f4 mutation: use tglogm in all tests
Summary:
The `tglogm` test function displays a graph log with mutation information.
Use this common function in all tests.

Differential Revision: D14876688

fbshipit-source-id: 2eb29a45b6267d448d292ac13dbfb0135d6fc8e4
2019-04-11 07:49:20 -07:00
Mark Thomas
511b52863e visibility: support cloud sync
Summary:
Add support for explicit visibility tracking in commit cloud sync.

This means commit cloud reads the visibleheads and syncs these with the commit
cloud heads directly, removing the source of problems where obsmarkers disagree
on different hosts.

Commit cloud requires that the ordering of heads is maintained to get stable
ordering of new commits.  Update the visibleheads tracking to maintain
ordering, rather than using sets.

Finally, the calculation of the replacement node was slightly off.  This was
revealed in the new test case that is being added, so it is also fixed.

Differential Revision: D14876266

fbshipit-source-id: fe5b6bffd196d3bd74e7582e29484969495eac8e
2019-04-11 07:49:20 -07:00
Mark Thomas
0b42418c85 visibility: improve documentation
Summary: Add doc comments describing what the visibility functions do.

Reviewed By: DurhamG

Differential Revision: D14871230

fbshipit-source-id: e0117ed1357a3a14b9f42034bf51a6cbb38ba67b
2019-04-11 02:45:16 -07:00
Mark Thomas
d562032896 mutation: improve performance of obsolete check
Summary:
The computation of whether a commit is obsolete or not can be improved.

We can cache which commits are known to not be obsolete.

We can also have a cache for each filter type so that we only need to compute
obsolete nodes that match the filter.

Finally, when we need to compute all obsolete commits, we can start by looking
for commits which are made obsolete by only their closest successors, and then
filling back obsolescence to the predecessors of these obsolete commits.

Reviewed By: DurhamG

Differential Revision: D14858655

fbshipit-source-id: 1d03e214ad878ecb6ae548f80373702e2a184146
2019-04-11 02:45:16 -07:00
Mark Thomas
a5207547aa mutation: add absorb support
Summary: The `absorb` command should also record mutation information when it modifies commits.

Reviewed By: DurhamG

Differential Revision: D14871232

fbshipit-source-id: 46bc95b7f5781f0b5f5e057a34c755fcfe653f7e
2019-04-11 02:45:16 -07:00
Mark Thomas
07f5225572 visibility: don't let hiddenoverride pin commits visible
Summary:
With explicit visibility tracking, the hiddenoverride feature of the amend
extension is no long necessary.  When upgrading to explicit visibility,
include the pinned visible commits, however after that point, hiddenoverride
should have no effect.

Users can permanently reveal obsoleted commits using `hg unhide`.

Reviewed By: DurhamG

Differential Revision: D14851269

fbshipit-source-id: b516fa97ed1545d39b51baaf9c574cb73a571645
2019-04-11 02:45:15 -07:00
Mark Thomas
d803ebb3c7 visibility: make enabling or disabling of tracking a command
Summary:
Rather than implicitly upgrading or downgrading a repo based on the
`visibility.tracking` config option, add a new `hg debugvisibility` command to
do this explicitly.

Reviewed By: DurhamG

Differential Revision: D14871231

fbshipit-source-id: 73f4648408b3eca9ac12bd77e54d2d37ee342069
2019-04-11 02:45:15 -07:00
Mark Thomas
fb42aba542 infinitepushbackup: exclude hidden commits from backup heads
Summary:
When run with `--hidden`, the calculation for `backupheads()` may include extra
commits (ones that are hidden but not obsolete).  This can cause some of the old
nodes to apper with "Not backed up" annotations.  They should be excluded, too.

Reviewed By: DurhamG

Differential Revision: D14851035

fbshipit-source-id: f176b50a7ac62dc493a5c4df1e0c72532c43b680
2019-04-11 02:45:15 -07:00
Mark Thomas
38930fd664 pullcreatemarkers: also create synthentic mutation entries and update visibility
Summary:
The pullcreatemarkers extension creates fake markers for landed commits by comparing
the differential revision of draft commits with those of landed commits.

In the future, mutation records will handle lands correctly, however until that stage,
replicate the pullcreatemarkers behaviour.

Reviewed By: DurhamG

Differential Revision: D14834746

fbshipit-source-id: e196ee28645270ccab1775ea896f0e453740c03e
2019-04-11 02:45:15 -07:00
Mark Thomas
2f0922256b mutation: add debugmutationfromobsolete to backfill mutation records
Summary:
Add `hg debugmutationfromobsolete` which backfills mutation information from
obsmarkers.

Reviewed By: DurhamG

Differential Revision: D14603199

fbshipit-source-id: 64458c52ba0e9f7bc9b38abeb94660cd1423fca7
2019-04-11 02:45:14 -07:00
Jun Wu
59231d903d indexedlog: implement read-only fast paths for sync
Summary:
In case there are nothing to write, `Log` and `LogRotate` can take
a fast path that does not take directory locks.

Differential Revision: D14885450

fbshipit-source-id: 4d72d5a3e33b7371880ad31f8bc43ed31c03797f
2019-04-10 20:59:56 -07:00
Jun Wu
29fa45c973 indexedlog: rename some flush() to sync()
Summary:
The `flush()` function does two things: read and write. It's not just writing
data. Rename it to `sync` to clarify.

`Index::flush` is unchanged because although it might read new data, the new
data is not visible. Calling `Index::flush` without dirty changes does not
cause visible (queriable) changes to the index.

`FlushFilter` is unchanged because it is coupled with the write path. It is
not to filter reading.

The old name is kept temporarily until all pending code gets committed and
we can do a codemod.

Differential Revision: D14885451

fbshipit-source-id: 3aed3b741e5e8f09b611ddcc25930a6fdf71706c
2019-04-10 20:59:56 -07:00
Jun Wu
a4322ca904 logrotate: make writable_log private
Summary:
The `writable_log` API can be misused to "flush" a Log, bypassing the check
about whether it should be rotated or not.

The real need of `writable_log` is to get accesses to indexes on the "writable"
(or "latest") log. Therefore let's just expose that instead.

Practically, the only use case of querying the index on the "latest" log is to
make sure dependent content are written to a same Log. That also requires a
"flush_filter" to be provided. Therefore add an assertion about it.

Differential Revision: D14866022

fbshipit-source-id: f6c07a498597b6f0f07d7cc3130e9033ba8b9be4
2019-04-10 19:50:01 -07:00
Jun Wu
f364cd1420 logrotate: add flush_filter
Summary:
Introduce the "flush filter" that can replace content to be written.
This would be useful to make sure delta chains are self-contained.

For LogRotate, flush_filter is trigger not only when the log file
was modified, but also when rotation happens,

Differential Revision: D14866024

fbshipit-source-id: f417200d3ae573e9ac82985ad6afd082412b358d
2019-04-10 19:50:01 -07:00
Jun Wu
2e300dba51 indexedlog: add a flush_filter function to Log
Summary:
The flush filter allows mutating entries being flushed. It can be used to avoid
inserting duplicated data.

Differential Revision: D14866023

fbshipit-source-id: ecf6cf60a0a97cf8110ef9c957e7e3bbab5855fc
2019-04-10 19:50:00 -07:00
Jun Wu
0cd1d8ce9d indexedlog: error out if the primary log does not match metadata
Summary:
Previously the code allows the "log" file to be longer than the metadata,
intended to allow advanced usecases that replaces the "meta" file to
get a read-only view in the past.

That implies we trust the length of "log" file. But it's in theory easy to mess
up - when appending to the "log" file, the process might be killed.

Data integrity is first priority. Therefore let's just error out if the file
length does not match the metadata. To support read-only views in the past,
we can use potentially use file names other than "meta" or support in-memory
metadata instead.

Differential Revision: D14866025

fbshipit-source-id: bbf0061a6448375a2de06fbf31f2b9838c749be0
2019-04-10 19:50:00 -07:00
Kostia Balytskyi
8e92391e67 mononoke: preserve more output from hg side in the sync job
Summary: This will help us debugging of what's going on on the server side.

Reviewed By: StanislavGlebik

Differential Revision: D14876167

fbshipit-source-id: 17aaa6dca9d5b5d7bbf69be46b58e454fe9f3fc3
2019-04-10 18:05:37 -07:00
Mark Thomas
87d3ef1330 mutation: record predecessors and operation in commit loginfo
Summary:
Record the commit predecessors and the mutation operation in the commit loginfo
so that it can be logged to telemetry.

Reviewed By: quark-zju

Differential Revision: D14798032

fbshipit-source-id: 9c4ac1a4df3c91087c776d1f8e5fca94713b0390
2019-04-10 15:16:17 -07:00
Xavier Deguillard
a38ac46869 revisionstore: add an indexedlog backed content store
Summary:
Packfiles are proving complex in several situation in order to perform well.
For instance, repack are required to keep common operation from spending most
of their time in scanning and iterating over the filesystem. In fact, most of
the pain point with packfiles is caused by their immutability: once written,
they can no longer be updated.

IndexedLog on the other hand can be updated in place, and therefore do no
require repacks and thus do not exhibit some of the pathological behavior that
packfile are showing.

As a first step, let's add a simple content store backed by indexedlog.

Reviewed By: quark-zju

Differential Revision: D14790070

fbshipit-source-id: 44f766db6a08169971f87a38246873c6e53c3233
2019-04-10 10:34:34 -07:00
Xavier Deguillard
543c250138 pyrevisionstore: convert to rust 2018
Summary:
Most of the extern crate are now removed. The cpython one is kept around as it
heavily depends on internal macros that would need to be manually imported.

Reviewed By: quark-zju

Differential Revision: D14864995

fbshipit-source-id: 05405ac7310e4dca65daf230cc8f574da32ed4c9
2019-04-10 10:24:55 -07:00
Stanislau Hlebik
0c019f20fd remove accidentally added lines
fbshipit-source-id: 70f4621d5adb859d39bf3bb8adb2ff84aa75ac5e
2019-04-10 00:45:56 -07:00
Stanislau Hlebik
dfdfbf232e experimental stash test
fbshipit-source-id: 5ff859300513dbb13889f3fc3bb781f7d56b85b6
2019-04-10 00:36:40 -07:00
Arun Kulshreshtha
de2605bf4d edenapi: make data and history batch sizes separately configurable
Summary: Make the batch size of data and history requests independently configurable, since data responses are typically much larger than history responses (since the former contains actual file data whereas the latter is only metadata).

Differential Revision: D14859686

fbshipit-source-id: c87c31f3e6611a55ae712e7f0ed9bb392d31a579
2019-04-09 17:00:01 -07:00
Arun Kulshreshtha
1bb8d63b74 edenapi: split MultiDriver into its own module
Summary: Move the code for managing a curl::Multi session into its own submodule to avoid cluttering the main client file.

Reviewed By: quark-zju

Differential Revision: D14855344

fbshipit-source-id: 8c93959774c3bc03d2620012d1665228fbcb6681
2019-04-09 14:59:44 -07:00
Arun Kulshreshtha
9fdd71e4df edenapi: use curl multi interface
Summary: Use the curl multi interface to fetch multiple batches of files or history entries concurrently.

Differential Revision: D14718547

fbshipit-source-id: c5a740c7e9106b719e825540f8182be31a72bae7
2019-04-09 14:59:44 -07:00
Mark Thomas
0cc0028d21 run-tests: don't disable linewrapping if there is nothing to output
Summary:
The tests for run-tests expect there to be no linewrapping control characters
output when there are no progress lines to print.  Make sure they only get
printed if there are lines to print.

Reviewed By: DurhamG

Differential Revision: D14851271

fbshipit-source-id: 4004f848e2e205d36bd0dd107ced2fe9d69e31d8
2019-04-09 13:31:56 -07:00
Aida Getoeva
0af9f95998 add backup command
Summary:
The command is supposed to check if the given commits are backed up and if not to back them up.

This is needed for `jf submit` to make sure that all the commits submitted are backed up by hg.

Reviewed By: markbt

Differential Revision: D14685222

fbshipit-source-id: 224a438ec1c5c17af6988c511be4af4a3a988a79
2019-04-09 12:14:08 -07:00
Aida Getoeva
6f4459dd42 don't skip metadata while creating data wirepacks
Summary:
Currently we skip metadata when constructing data wirepacks.
We need copy metadata in the data packflies, because the client expects the base text to contain copy metadata since the delta base on the server also contains copy metadata.

It is also needed for future file nodes validation.

Differential Revision: D14851678

fbshipit-source-id: 1a3f79dc2565cdb864bee2400d331ae3a7c3751b
2019-04-09 10:37:01 -07:00
Aida Getoeva
b8454aac03 test missing copy-from info in datapacks fetched from the server
Summary: Added new test to show that applying changes on the renamed file fails because of missing copy-from data in the datapacks.

Reviewed By: StanislavGlebik

Differential Revision: D14851679

fbshipit-source-id: 41fa2008bdfe0a74c97a0a24af58bf6abf4ebd80
2019-04-09 10:37:01 -07:00
Mateusz Kwapich
d5bae8360a phrevset: avoid crashing on null graphql reply
Summary:
The Dxxxx revset does two things in parallel:
 * walks the changelog in the search of commit associated with Dxxx.
 * makes graphql query to resolve Dxxxx to the hash associated with the last
   submitted version.

This behaviour is clowny and confusing and should be changed long-term. This is
just a short term fix to prevent it from crashing in cases there's no local
commit associated with Dxxx (or it's very old) and the graphql query comes back
with empty result (because there are no versions for the diff).

Reviewed By: markbt

Differential Revision: D14851313

fbshipit-source-id: 14f7531aa4691007266291a38a016242de563de4
2019-04-09 07:53:43 -07:00
Mark Thomas
d0edbd5b64 run-tests: don't disable linewrap all the time
Summary:
The progress indicator for run-tests.py disables terminal line wrapping at the
start of run-tests, and re-enables it at the end.  This causes two problems:

* Diff output is not wrapped, so only the start of changed lines are visible.
* Sometimes run-tests.py exits without restoring line wrapping.  In this case
  the shell session is adversely affected.

Disabled line wrapping is only necessary when outputting the progress, so
restrict it to there.

Reviewed By: quark-zju

Differential Revision: D14834719

fbshipit-source-id: 2c0380e7e1a1d5be195b025c252c80208e83a545
2019-04-09 03:37:44 -07:00
Stefan Filip
a61980ab9b asyncpacks: update asyncmutablehistorypack to testutil
Summary: testutil everywhere

Differential Revision: D14716080

fbshipit-source-id: 197cce4f64443a7a065010dd9ff8da32f548d496
2019-04-08 16:21:08 -07:00
Stefan Filip
becc32004a asyncpacks: update asynchistorypacks.rs to testutil
Summary: testutil everywhere

Differential Revision: D14716079

fbshipit-source-id: c83388f5248bf6afd9c2b6af87dcd8f6b0b850e1
2019-04-08 16:21:08 -07:00
Stefan Filip
f958833800 asyncpacks: update asyncdatapack.rs to testutil
Summary: testutil everywhere

Differential Revision: D14713053

fbshipit-source-id: 26fcdea580dd45280bf2f1725dcdb6ab8948465f
2019-04-08 16:21:08 -07:00
Stefan Filip
d6ad49db5b manifest: migrate to types::testutil node
Summary: migration

Differential Revision: D14660306

fbshipit-source-id: 71df6814d93f8b9f814aedaa4ceb558a8b69cdf6
2019-04-08 16:21:08 -07:00
Stefan Filip
1e2816f7c6 types: add testutil module to help writing tests
Summary:
Building test objects can be tedious using various of our bottom bytes.
This diff addresses that issue by adding helper functions in a new module
in the types crate.

Handling this case could be improved in rust.

Differential Revision: D14660307

fbshipit-source-id: a866c1f3ede60ba1b87eb17d35817b8a8d7674a4
2019-04-08 16:21:07 -07:00