Commit Graph

45692 Commits

Author SHA1 Message Date
Jun Wu
7b6ae70f2d indexedlog: implement range scan on Index
Summary:
This API allows range query, similar to `BTreeMap::range`.

It's going to be used by segmented changelog. There are spans (start, end)
stored in the index, and we need to find spans by rev (start <= rev <= end).

Initially I was changing PrefixIter incrementally towards the new RangeIter.
There are too many small commits and I got some useful feedback early. Now
it seems cleaner to just introduce the desired state of RangeIter first.
We can later migrate prefix lookup to RangeIter, if perf regression is
negligible.

The added code is long. But some of them are modified from existing code:
- `RangeIter::next_internal` is modified from `PrefixIter::next`.
- `Index::get_stack_by_bound` is modified from `Index::scan_prefix_base16`.

The tests helped find some issues of the code. I hope they're not too weak.

Reviewed By: sfilipco

Differential Revision: D14895479

fbshipit-source-id: fb8f1bd35c61187fe5f7764fa485206bbb13c8e0
2019-04-18 13:35:45 -07:00
Saurabh Singh
0449fa1af0 test-debugcheckcasecollisions-treemanifest.t: fix the test
Summary:
This test was broken by D14971701 on OSX because it has a case
insensitive filesystem.

Reviewed By: kulshrax

Differential Revision: D14986692

fbshipit-source-id: a2a924d7aae4f3b96e7691e824a82087c1ff8513
2019-04-17 14:51:20 -07:00
Jun Wu
ae6bf97297 remotenames: make push with tracking bookmark work with infinitepush
Summary:
The `if dest` test fails with infinitepush changing `dest` to non-None.
Fix it by also checking if `dest` matches `default-push` (or `default`).

Reported by: fryfrog

Reviewed By: markbt

Differential Revision: D14965995

fbshipit-source-id: 91e68368eda4457d06059387307a9572bc6d2906
2019-04-17 08:41:12 -07:00
Kostia Balytskyi
029666aa4b debugcasecheckcollisions: fix case collision detection corner case
Summary:
The way this command was implemented before this change would collapse
existing case collisions into a single value of the `lowerdirlist` dict.
The value that was chosen would be dependent on the traversal ordering.

If this value would be equivalent to the newly-introduced file, we would
miss the collision.

Reviewed By: markbt

Differential Revision: D14971701

fbshipit-source-id: d352e96e512154d92fe6bc49dd76aec63b954fef
2019-04-17 07:48:31 -07:00
Jun Wu
177b4ef156 fastlog: patch follow revset instead
Summary:
Change the fastlog approach to patch the "follow" revset function instead of
"getlogrevs". This makes it more general purposed so it can speed up commands
like `hg log -r 'reverse(follow("dir"))'`.

Note: This will regress `log dir` performance, which will be fixed in the next
diff.

Reviewed By: sfilipco

Differential Revision: D14764074

fbshipit-source-id: c2a4c8e91359d971e6ea668e5ff1f0ab6eb0534c
2019-04-16 22:19:19 -07:00
Jun Wu
861bf3595a revset: move "log dir" special path to "follow()" revset
Summary:
The "hg log" implementation chooses to not use the "follow" revset when logging
a directory, but use "_matchfiles" instead. In an upcoming change, we'd like
"follow" to handle directories so fastlog only needs to patch the "follow"
revset.

The "follow" revset can take a directory pattern just fine. The problem is
"follow" will follow *every* file inside the specified directory, which is
quite expensive.

For now, I just moved the "_matchfiles" fallback path to "follow" so when it
detects there are too many files to follow, it will switch to "_matchfiles"
directly.

In theory, tree manfiest repos would have "tree manifest" infomation that speed
up "follow" on a directory. But that's a bigger change, and it's probably very
slow in our setup because our trees are lazy.

This changes some behaviors subtly, as reflected in tests:

- `-f path` can use DAG range instead of rev range, which is a good thing as
  rev range does not make much sense to end-users. This removes a "BUG" in
  test-commit-amend.t
- `-f dir` can follow renames if the directory contains just a few files.
  This looks like a good thing, and is reflected in `test-log.t`.

Reviewed By: sfilipco

Differential Revision: D14863134

fbshipit-source-id: 99ddff46d43f63ce03dc7bf005e3ac1cb9b39d03
2019-04-16 22:19:19 -07:00
Jun Wu
59cafd4595 smartset: add a fast path for spanset
Summary:
With upcoming changes, I noticed `limit(reverse(:.) & follow("path:fbcode/scm/hg"), 10)`
is much slower than `limit(reverse(::.) & follow("path:fbcode/scm/hg"), 10)`. I tracked
it down to the fact that spanset introduces a lot of unnecessary checks. Optimize it
by avoid using spanset in this case.

The revset pattern is used by `hg log`, the `reverse(:.)` part is to "define" the
order. Perhaps we sould replace it with `reverse(::.)`. But that's a BC change that
might have some unwanted side effects.

Reviewed By: sfilipco

Differential Revision: D14863135

fbshipit-source-id: 6ba8a02b58e1109bdf8370f03965a3b302cba6c0
2019-04-16 22:19:18 -07:00
Arun Kulshreshtha
e80dd37d5f edenapi: use DataEntry
Summary: Update the Eden API client and server to use the new DataEntry type for file content downloads.

Reviewed By: quark-zju

Differential Revision: D14907958

fbshipit-source-id: 8a7b1cbb54bdc119dda11179ff94d3efdb7e85c9
2019-04-16 22:13:41 -07:00
Stefan Filip
dd6dd0f998 types: remove deprecated Key.name() and Key.set_name()
Summary: Removing this function in favor of using Key.path

Reviewed By: quark-zju

Differential Revision: D14945331

fbshipit-source-id: 6b6bb70375629edf37b2b04a86545f18e15b33b4
2019-04-16 15:34:31 -07:00
Stefan Filip
4cdbb6b703 types: remove Key::from_name_slice
Summary: No longer used

Differential Revision: D14945333

fbshipit-source-id: 7038501e8a78061ac6e83d89b8e4f16d1c4c95de
2019-04-16 15:34:31 -07:00
Stefan Filip
9c04803a33 pyrevisionstore: use Key::new instead of Key::from_name_slice
Summary: migration

Differential Revision: D14945334

fbshipit-source-id: 1244f0d4fb6df59ebd3b72c55dbd1e1013531464
2019-04-16 15:34:31 -07:00
Stefan Filip
09aa2f900f bindings: use RepoPath in edenapi
Summary: migration

Differential Revision: D14945335

fbshipit-source-id: 0aa90bee100fdae8755e7abfa6ac614f5bcaf266
2019-04-16 15:34:31 -07:00
Stefan Filip
3b46c887e8 asyncpacks: migrate to Key::new from Key::from_name_slice
Summary: migration

Differential Revision: D14945332

fbshipit-source-id: 0906eb54f205a865d4fc5f3599469a6851b5c6ca
2019-04-16 15:34:30 -07:00
Stefan Filip
4b0e94305f revisionstore: use RepoPath in DataEntry
Summary: migration

Differential Revision: D14945337

fbshipit-source-id: 96247d27bc9e829a1ebb73c5617a399e149ac69b
2019-04-16 15:34:30 -07:00
Saurabh Singh
8479d48934 infinitepush: fix the help text for scratch bookmark commands
Reviewed By: quark-zju

Differential Revision: D14955186

fbshipit-source-id: 1ea79762621f54adc3d8f282472fc21d596593ba
2019-04-16 13:47:36 -07:00
Xavier Deguillard
67a4b6af52 revisionstore: partial chains can be returned from get_delta_chain
Summary:
In the case where a delta chain is split between several logs, it's possible
that part of it may be removed due to some logs being removed. Instead of
treating this as an error, we can simply return the partial chain, the union
content store will simply continue the delta chain on the next store.

Reviewed By: quark-zju

Differential Revision: D14899943

fbshipit-source-id: 7369ee191dc4b35873344cd13c295c72472e0712
2019-04-16 10:47:09 -07:00
Xavier Deguillard
c358df34a8 revisionstore: a not found key should fail with KeyError
Summary:
The Python code interprets a KeyError as a lookup failure, and will retry the
lookup on the next store. Any other Rust errors will be translated into a
RuntimeError exception that Python will re-raise and stop the lookup.

Reviewed By: quark-zju

Differential Revision: D14895905

fbshipit-source-id: d22733c0a68ff3f28d502eb2cd4c3a0467ee35d1
2019-04-16 10:47:09 -07:00
Xavier Deguillard
8e078ed66b memcache: add an option to use the indexedlog instead of packfile
Summary:
When the option is set, the gets will be stored in the indexed log instead of
in a packfile. With the Python code now able to read from it, this will allow
us to get more real world testing.

Reviewed By: quark-zju

Differential Revision: D14895509

fbshipit-source-id: d73d49a028f7af199b7a0873551d7b18b047e50c
2019-04-16 10:47:09 -07:00
Saurabh Singh
0b0f262d0f infinitepush: introduce server side command for moving a scratch bookmark
Reviewed By: markbt

Differential Revision: D14919847

fbshipit-source-id: 5ae1750e78b24ac6126b621ca34942d7fb46d4fe
2019-04-16 09:54:27 -07:00
Saurabh Singh
c6aab56946 infinitepush: introduce server side command for creating scratch bookmark
Reviewed By: markbt

Differential Revision: D14919850

fbshipit-source-id: 2eef682fa528b82d0b9bdac1bad66ec47d552d3c
2019-04-16 09:54:27 -07:00
Mateusz Kwapich
802213bcbb phabricator: query the draft changes too
Summary: The super-smartlog shows "local changes" even when you have some unattached draft changes associated with the diff. This diff changes that.

Reviewed By: quark-zju

Differential Revision: D14936057

fbshipit-source-id: 32204ef9c5fa862923a165624913ecb344ed4a73
2019-04-16 06:33:30 -07:00
Stanislau Hlebik
e1e5d4bb0d pushrebase use hookargs correctly if transaction was taken
Summary:
Context: for Mononoke sync job we are considering applying a few pushrebase
bundles under the same transaction to make sync job faster. More details -
https://fburl.com/y4we86hc

Doing two pushrebases under the same transaction seems to fail for  just one
reason - `hookargs` is None on the second bundle. The reason is this line -
https://fburl.com/y4we86hc, after gettransaction() is called
bundleoperation.hookargs is set to None, but transaction.hookargs is set to
current hookargs value.

In this diff pushrebase is changed to check both bundleoperation.hookargs and
transaction.hookargs

Reviewed By: quark-zju

Differential Revision: D14930970

fbshipit-source-id: e4a4dd1c85b1fdca2699dd431040d65f2642ec8a
2019-04-16 03:10:02 -07:00
Mark Thomas
f337e0d5e4 sampling: fail gracefully when ui.log arguments are not a valid format
Summary:
`ui.log` expects to be called with valid format arguments.  If the arguments
are not a valid format string, or the number of arguments doesn't match the
number of format placeholders, formatting will fail.

In this case, catch the exception and fail gracefully.  Don't even bother
formatting if there is exactly one argument.

The `blackbox` extension already does this, so extend to the `sampling`
extension.

Also fix the place where `perftrace` calls `ui.log` with a string that might
contain formatting placeholders.

Reviewed By: quark-zju

Differential Revision: D14938952

fbshipit-source-id: 1d9802308dba925109c018124d51273c348526b4
2019-04-16 01:21:55 -07:00
Jun Wu
c39081d1b9 slides: fix check-code
Summary: Not sure why buck tests didn't capture this one.

Reviewed By: sfilipco

Differential Revision: D14946576

fbshipit-source-id: acbac0b071722970442344ba0ba6f4af1ff1392c
2019-04-15 20:34:44 -07:00
Arun Kulshreshtha
68e1c44335 types: add DataEntry type
Summary: Add a new type representing a file content entry on the wire. This type is serializable and includes file content itself as well as the filenode's parents, which collectively allow for filenode hash verification.

Differential Revision: D14907957

fbshipit-source-id: ed0f85270c98bd5675da8553ffbfa0549b574b7f
2019-04-15 17:32:44 -07:00
Chad Austin
179e2d2db4 fix crash in sampling
Summary: `log` itself does the interpolation, so don't do it in advance.

Reviewed By: quark-zju

Differential Revision: D14941862

fbshipit-source-id: 6885202cfbff4ce0310d68bb1676369c3ef64c53
2019-04-15 17:27:53 -07:00
Saurabh Singh
25970ea3a5 slides: fix typo in segmented changelog slides
Reviewed By: quark-zju

Differential Revision: D14940136

fbshipit-source-id: 97b9cff83ffbdfe9b5b12b87e5f784f33473aaf6
2019-04-15 15:16:24 -07:00
Jun Wu
0cb5d52158 slides: add the segmented changelog slide
Summary:
The segmented changelog idea is somehow interesting. It went through several
iterations. The current form seems good to be checked in.

This time the source is not Markdown, but a Python script to generate tex code.
The generated PDF is small so I checked it in for convenience. It's not too
trivial to get all the build dependencies setup correctly.

The script has some interesting functions like `dag`. It can be reused in
future slides.

Reviewed By: singhsrb

Differential Revision: D14937221

fbshipit-source-id: 539e5b11b6fc67c0f7b393673513580456671fad
2019-04-15 13:17:13 -07:00
Arun Kulshreshtha
382a42d958 edenapi: switch to CBOR for data serialization
Summary:
Previously, the Eden API endpoints on the API server used JSON for encoding requests/responses for debugging purposes. Given that these APIs are mostly used to transfer large amounts of binary data, we should use a binary encoding scheme in production. CBOR fits the bill since it is essentially binary JSON, allowing for more efficient coding of large byte strings.

Although this is a breaking API change, given that nothing depends on these endpoints yet, it should be OK to simply change the format.

Differential Revision: D14907978

fbshipit-source-id: e0aea30d7304f4b727e2ad7fe23379457b6c3e26
2019-04-15 12:32:25 -07:00
Arun Kulshreshtha
852626bbdb types: move quickcheck macro imports into tests module
Summary: Previously, this import would trigger dead code warnings because it would be conditionally included with either `cfg(test)` or the `for-tests` feature, whereas the tests module (which was the only user of the import) would only be conditionally included with `cfg(test)`. Fix the warning by moving the import into the tests module itself.

Reviewed By: quark-zju

Differential Revision: D14936954

fbshipit-source-id: ef7a84e8d36645624077283a0fb7798a1746f579
2019-04-15 12:14:25 -07:00
Xavier Deguillard
312286d5d0 remotefilelog: do not attempt repack on not existing directory
Summary:
Looking at the Hgerrors scuba table, I noticed that a lot of the sandcastle
machines had repack failures due to "No such file or directory". I'm suspecting
that's due to not having a local store to repack, and therefore listing of
files to repack would fail. Let's verify that the directory is present before
repacking to avoid this issue.

Reviewed By: quark-zju

Differential Revision: D14906503

fbshipit-source-id: 98fbe57310511df4fc9856bf71f836adefb3d855
2019-04-15 11:06:05 -07:00
Xavier Deguillard
0ad557a531 test: add a test showing rust repack failure on non present directories
Summary:
Looking at the Hgerror scuba table, I see a lot of failures due to ENOENT on
Sandcastle. I'm suspecting this has to do with Sandcastle not having a local
manifest.

Reviewed By: quark-zju

Differential Revision: D14906506

fbshipit-source-id: a5d3eec824168e78ce3146dbde2d2bbbed1702f9
2019-04-15 11:06:04 -07:00
Stefan Filip
d45e21573a revisionstore: use RepoPath in HistoryPackIterator
Summary: migration

Reviewed By: quark-zju

Differential Revision: D14908310

fbshipit-source-id: 76623300c04bd8643796a99f66d9d3144787f072
2019-04-15 10:01:52 -07:00
Stefan Filip
be522e8dc5 revisionstore: remove uses Key::from_name_slice
Summary: migration

Reviewed By: quark-zju

Differential Revision: D14908315

fbshipit-source-id: 5d7d11982b70d10b49bb7fcd12cc6bf9c98146d6
2019-04-15 10:01:52 -07:00
Stefan Filip
77cdaca742 types: remove uses of Key::from_name_slice
Summary: migrating

Reviewed By: quark-zju

Differential Revision: D14908314

fbshipit-source-id: 92d9092bd879858349ab3b8cb98a484451c0442b
2019-04-15 10:01:52 -07:00
Stefan Filip
ee7703e821 revisionstore: use RepoPath in HistoryEntry
Summary: migrating

Reviewed By: quark-zju

Differential Revision: D14884957

fbshipit-source-id: 865f970627c08a26d1336fa57235f8ebbdb1d4a9
2019-04-15 10:01:51 -07:00
Stefan Filip
dd4a010aac revisionstore: use RepoPath in HistoryPack
Summary: Migrating

Reviewed By: quark-zju

Differential Revision: D14884958

fbshipit-source-id: 34bf2ea726b19f9929652d9836a224baac8b328b
2019-04-15 10:01:51 -07:00
Stefan Filip
a40d9db09d types: update history entry to use RepoPath
Summary: Refactoring

Reviewed By: quark-zju

Differential Revision: D14877540

fbshipit-source-id: c275c335ffe89ebf2fa1229925b1db2015374659
2019-04-15 10:01:51 -07:00
Saurabh Singh
0f155ea3f7 infinitepush: move scratch bookmark matcher to common module
Summary:
This functionality is generic enough to be inside the common module so
that it can be shared easily. Upcoming commits will make use of this
functionality by importing from the common module.

Reviewed By: markbt

Differential Revision: D14919848

fbshipit-source-id: b3b7eef9eb0929334cba7ce869e7c9377c265da2
2019-04-15 09:29:31 -07:00
Saurabh Singh
839a5ffa93 infinitepush: move infinitepush server check to common module
Summary:
This functionality is generic enough to be inside the common module so
that it can be shared easily. Upcoming commits will make use of this
functionality by importing from the common module.

Reviewed By: markbt

Differential Revision: D14919849

fbshipit-source-id: 74c6ad5158bd196bb062e2ec7b04ca121b5d2c3a
2019-04-15 09:29:30 -07:00
Max Kareta
27abd9e79d dispatch: fixed arguments escaping before invoking hooks
Summary:
This diff adds args escaping using single quote symbol before sending them to hooks.
Before all arguments where joined by space symbol " " which was producing incorrect result when argument itself contains space symbol.

Reviewed By: markbt

Differential Revision: D14799188

fbshipit-source-id: df5a4324d138515a4b881df96f2991de03df7a5b
2019-04-15 06:56:50 -07:00
Mark Thomas
f4245770a3 shelve: add shelvename template keyword
Summary:
Add `shelvename` template keyword, which expands to the name of the shelve for
commits that contain shelves.

Reviewed By: farnz

Differential Revision: D14932985

fbshipit-source-id: cddebd2dbc6454f7c61ed296f37822179da8a2de
2019-04-15 05:44:49 -07:00
Stefan Filip
7e2b3c256f types: rename Key::new to Key::from_name_slice
Summary:
We should update the builder for Key to take a repo path. We could build
the key directly using the default struct constructor but representing
the two constructors as functions is more clear.

Reviewed By: quark-zju

Differential Revision: D14877543

fbshipit-source-id: 328906521cdbad535e28df22fea82f21e8b5410a
2019-04-14 19:56:50 -07:00
Stefan Filip
e4fc87ac37 types: deprecate Key::name
Summary:
Marking the uses of byte arrays for repository paths as deprecated
to make it easier to remove uses in the code.

Reviewed By: quark-zju

Differential Revision: D14877541

fbshipit-source-id: 4c06e0f7012a33cc92752530618396c3c529f986
2019-04-14 19:56:50 -07:00
Stefan Filip
4d59694b10 types: change the underlying type for Key::path to RepoPath
Summary:
It is fairly difficult to avoid an intermediary state where we don't have some
panics. Since we don't really deal with invalid paths this intermediary state
is not a real concern.

Reviewed By: quark-zju

Differential Revision: D14877553

fbshipit-source-id: 6f60f20af8d8f1e3ff23c5d8ab5353bc8d919ebf
2019-04-14 19:56:49 -07:00
Stefan Filip
b291cdb244 types: optimize PathComponentBuf::arbitrary
Summary:
The overhead of generating all the different strings is noticeable when
we start to generate a lot of values.

Reviewed By: quark-zju

Differential Revision: D14877547

fbshipit-source-id: 8a91241ff3e86b6ac9b68197c449ed2be445f941
2019-04-14 19:56:49 -07:00
Stefan Filip
967cd9c01b revisionstore: use testutil in indexdlogdatastore
Summary: testutil everywhere

Reviewed By: quark-zju

Differential Revision: D14884959

fbshipit-source-id: 7f999179866e4d71f0e89bd00df168e5932818f2
2019-04-14 19:56:49 -07:00
Stefan Filip
885c477d3b revisionstore: update mutabledatapack to use testutil
Summary: testutil everywhere

Reviewed By: quark-zju

Differential Revision: D14877550

fbshipit-source-id: 3aa7a345adaac3444ce73ae6c20326bbcef9e873
2019-04-14 19:56:48 -07:00
Stefan Filip
91245a8749 revisionstore: use testutil in datapack
Summary: testutil everywhere

Reviewed By: quark-zju

Differential Revision: D14877542

fbshipit-source-id: f4bd4bf97206d2a2f5deb4d28d22f9dd7bec5a72
2019-04-14 19:56:48 -07:00
Stefan Filip
792a366a91 types: add RepoPathBuf::from_utf8(Vec<u8>)
Summary: This builder is the mirror of `String::from_utf8` in the RepoPathBuf type.

Reviewed By: quark-zju

Differential Revision: D14877551

fbshipit-source-id: de79c36b0f5d638aad12428f7e5ee1bbe19c4bc6
2019-04-14 19:56:48 -07:00