Commit Graph

45562 Commits

Author SHA1 Message Date
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
Mateusz Kwapich
12ad4df265 phabricator: fix the getrevisioninfo for Diffs in reserved state
Summary:
Diffs in reserved state have latest_active_diff=null (but it's present). That's why our current logic failed for it.

=== Query

{P62246960}

=== Query Parameters

```
{
  "params": [
    {
      "numbers": 14814207
    }
  ]
}
```

=== Response

```
lang=json
{
  "data": {
    "query": [
      {
        "results": {
          "nodes": [
            {
              "number": 14814207,
              "diff_status_name": "Reserved",
              "latest_active_diff": null,
              "created_time": 1554501017,
              "updated_time": 1554501017,
              "is_landing": false,
              "differential_diffs": {
                "count": 0
              }
            }
          ]
        }
      }
    ]
  }
}
```

=== Run in GraphiQL

[[https://www.intern.facebook.com/intern/graphiql/intern/?query_paste_id=62246962 | Intern]]

Reviewed By: katherinez

Differential Revision: D14836776

fbshipit-source-id: 213afac5d51bf100973753ef8078ab0dcd18d52f
2019-04-08 13:32:17 -07:00
Saurabh Singh
b1d033afa3 test-adding-invalid-utf8: skip the test for OSX
Summary:
Files with invalid `UTF-8` names are not allowed on OSX anyway and
therefore, this test can be skipped on OSX.

Reviewed By: sfilipco

Differential Revision: D14835026

fbshipit-source-id: 5ad80a4e98ab5088951b1e8209981a3e7fdb03a1
2019-04-08 10:52:57 -07:00
Mark Thomas
15242183ef treemanifest: consider all parents of outgoing nodes for tree comparison
Summary:
When determining the contexts to compare trees against, consider all parents
of the missing nodes that aren't themselves missing.

In the case of:
```
  C
 / \
D   B
    |
    A
```
Where A and D are common and B and C are missing, the parents of the roots
are only A, which means D's tree will not be compared against and all of its
trees will be included.

Reviewed By: StanislavGlebik

Differential Revision: D14798681

fbshipit-source-id: c80add907338a3011daf54a2304ea19415b7f9fb
2019-04-08 03:32:00 -07:00
Mark Thomas
86118d3150 treemanifest: add test demonstrating infinitepush backing up too many trees
Summary:
When infinitepush is backing up merge commits that have a public commit as one
of their parents, and draft commits as the other, treemanifest doesn't look at
the public parents' trees when building the bundle.  This means the bundle may
contain the public parent's trees.  If this is a merge of two distinct
histories, it will contain a full tree for the public parent.

Add a test that shows the generated bundle contains too many trees.

Reviewed By: StanislavGlebik

Differential Revision: D14798683

fbshipit-source-id: 1bc1324cef2c2ade74ff4aa59a391cc0fcccf12f
2019-04-08 03:32:00 -07:00
Mark Thomas
6dc8896bd1 infinitepush: fix debugbundle for mutation parts
Summary:
The debugbundle implementation for mutation parts was not updated with
the recent changes made to mutation entries.  Update it.

Reviewed By: quark-zju

Differential Revision: D14798682

fbshipit-source-id: eb1defa33e8a0eed807360af2c130a225af15030
2019-04-08 02:54:39 -07:00
Arun Kulshreshtha
6705e2d120 bindings: allow choice between edenapi backends
Summary: Allow users to configure which HTTP client backend to use for the Eden API via the `edenapi.backend` config option. Valid options are `curl` and `hyper`, with `curl` being the default.

Reviewed By: quark-zju

Differential Revision: D14657871

fbshipit-source-id: 7a9972d2380fbbd5ed62d1accae764dc03ca4c29
2019-04-05 17:34:14 -07:00
Arun Kulshreshtha
6c8c87dea1 edenapi: add curl-based client
Summary:
Add a new Eden API client based on libcurl (via the rust-curl crate). This should help us work around issues with Hyper.

This implementation is based on curl's "easy" API, and is intentionally naive. I intend to update it to use curl's "multi" API to send several concurrent HTTP requests per operation in a later diff.

Differential Revision: D14656756

fbshipit-source-id: 1f71074506844104f0f3237023b38317a7f41979
2019-04-05 17:34:14 -07:00
Stefan Filip
9751716173 commitctx: refuse to commit files names that can't be interpreted as UTF-8
Summary: This is a stop gap measure while we move internal path encodings to UTF-8.

Reviewed By: quark-zju

Differential Revision: D14791761

fbshipit-source-id: e4d5a845aa4f28ed0744cf80021fd1446f3d6129
2019-04-05 16:30:00 -07:00
Stefan Filip
60e885a890 localrepo: import error module as errormod
Summary: `commitctx` takes error as a named parameter shadowing the module import.

Reviewed By: quark-zju

Differential Revision: D14805901

fbshipit-source-id: 359a6d19d6a08b3c65ebf1af8a5e5baaec6711a2
2019-04-05 16:30:00 -07:00
Marla Azriel
36a67da6f7 commands: help text for commit
Summary: Updated help text for hg commit

Reviewed By: kulshrax

Differential Revision: D14811336

fbshipit-source-id: dbc26b3409094b1f70aca01b0f9ff89693ce7861
2019-04-05 16:23:14 -07:00
Xavier Deguillard
99edfae94a remotefilelog: reduce packfile iteration cost
Summary:
In most cases, we won't have more packfiles than what is held in the LRU cache,
and therefore, building a set is unecessary. Testing for the length is a O(1)
operation and is therefore a quick test to verify if more packs needs to be
iterated on.

Reviewed By: quark-zju

Differential Revision: D14802940

fbshipit-source-id: 8b39befb27368d474ab71f3eeac2340d8183e70e
2019-04-05 15:50:06 -07:00
Xavier Deguillard
dbb35a26fa remotefilelog: Don't iterate on packs after a null refresh
Summary:
When many packfiles are present, and searching for missing data, we will
iterate on the packs twice. We can avoid the second iteration by testing if new
packfiles were detected.

Reviewed By: quark-zju

Differential Revision: D14802942

fbshipit-source-id: 624d9a86e65395af3141ea10d42bcfb8ee18db83
2019-04-05 15:50:05 -07:00
Xavier Deguillard
f8299c5d7c remotefilelog: cache pack path
Summary:
Building a set is a O(n) operation, and in the cases where refresh is called
often, it starts showing up in profiles. Instead of rebuilding it everytime, we
can simply update it when adding/removing packs.

Reviewed By: quark-zju

Differential Revision: D14802945

fbshipit-source-id: f8967d09d2d7d0cc0d7400b047a587d536315002
2019-04-05 15:50:05 -07:00
Xavier Deguillard
6e6a7e3e8b remotefilelog: cache remotefilelog.descendantrevfastpath
Summary:
The repo.ui.configbool was showing in profiles when running `hg log -p`. Since
its value won't change for the duration of the operation, let's cache it.

Reviewed By: quark-zju

Differential Revision: D14802941

fbshipit-source-id: c1a2a764cb4d4a1c0d45d5118bb1e892c10798a6
2019-04-05 15:50:05 -07:00
Jun Wu
12b98e1e96 indexedlog: use failure for error handling
Summary:
Failure makes it easier to chain errors, and backtraces. Use it.

There is probably still room for improvement, by chainning errors and avoiding
exposing low-level errors for APIs, and/or provide more context in error
messages. But it should be already much better than before.

Differential Revision: D14759305

fbshipit-source-id: b1d3a8ec959dde575f06533ea9e4cd0757057051
2019-04-05 12:17:28 -07:00
Mark Thomas
31312b0e34 checkoutidentifier: make dirstateinfo test deterministic
Summary:
Ordering of execution of the racing commands in the dirstate info test can vary
in a way that affects output ordering.  Capture the log output and print it
after the commands have completed to ensure the ordering is consistent.

Reviewed By: quark-zju

Differential Revision: D14798950

fbshipit-source-id: e7c7dc63302be4764970b012a50f55bc631ebfc5
2019-04-05 09:58:39 -07:00
Mark Thomas
2c7721b44a remotefilelog: datapack version mismatch can also return MemoryError
Reviewed By: ikostia

Differential Revision: D14800819

fbshipit-source-id: ad759fa64f725bf448aa5ed36f73ac2b9928c6bc
2019-04-05 09:31:08 -07:00
Jun Wu
31c8ecbdf4 dispatch: print shorter crash header
Summary:
Change the crash header to just a single line without blaming extensions or
Python. This makes the crash log shorter, and easier to read when there are
crashes in run-tests.py diffs.

Remove `ui.supportcontact` since it's no longer used.

Reviewed By: sfilipco

Differential Revision: D14393982

fbshipit-source-id: 3ede8d3d3d8fd5d125944a9a750350d3ce356b14
2019-04-04 23:38:34 -07:00
Xavier Deguillard
d6704f25f0 tests: fix test-gendoc.t
Summary: The german test was removed, which caused this test to fail.

Reviewed By: sfilipco

Differential Revision: D14778895

fbshipit-source-id: 35579fb6ec80fe3a435da8e6b93ccd14f1ac276d
2019-04-04 11:36:31 -07:00
Mark Thomas
9867fdb893 cmdutil: add checkout identifier to commit loginfo
Summary:
Add the checkout identifier to the loginfo for commit contexts that take data
from the working copy.

Reviewed By: quark-zju

Differential Revision: D14751601

fbshipit-source-id: 6ddcbf17b970ee24237edf501ae3d7fc8d320193
2019-04-04 11:29:50 -07:00
Mark Thomas
5274006a31 context: add loginfo for committable contexts
Summary:
Add `loginfo`, a new field to committable contexts, the contents of which will
be logged when the commit is committed to the repository.

Initially the logging only includes the commit node and author, but more things
will be added later.

Reviewed By: quark-zju

Differential Revision: D14751602

fbshipit-source-id: 2432dfb92dd2489cb8ad3464316a42ebaa79657c
2019-04-04 11:29:50 -07:00
Mark Thomas
fc9106e076 dirstate: add checkoutidentifier to identify and correlate checkouts
Summary:
When the user checks out a new commit (either by updating to it, by
creating a new commit, or by amending or rebasing the current commit), create a
unique identifier for that checkout.

Log this identifier at the start and end of command processing, and allow other
tools to also query and log the identifier.

This allows both Mercurial commands and other commands that log the identifier
to be correlated with a particular checkout.

Reviewed By: quark-zju

Differential Revision: D14648523

fbshipit-source-id: 2fad79c3010f5fad1a0e180e3d3d6d9c0a7f8e85
2019-04-04 11:29:49 -07:00
Mark Thomas
528a5b064e util: extract makerandomidentifier from clienttelemetry
Summary: Extract the `makerandomidentifier` function from the `clienttelemetry` extension so that we can use it elsewhere.

Reviewed By: quark-zju

Differential Revision: D14725866

fbshipit-source-id: 0b3ed2e8c9698e892ad0f524f6dde7bf7337f85c
2019-04-04 11:29:49 -07:00