Commit Graph

45657 Commits

Author SHA1 Message Date
Arun Kulshreshtha
af1b898311 edenapi: add debug config option
Summary: Add a debug option for HTTP data fetching. The intended usage is for it to gate verbose debug messages; the option can be set by Chef for users in the hg_dev tier.

Differential Revision: D15040988

fbshipit-source-id: b7eaa3bab4200e083cffc5822fb9873611725e6b
2019-04-22 18:46:34 -07:00
Xavier Deguillard
0bb5d9ad67 tests: set CACHEDIR to $TESTTMP/hgcache instead of $PWD/hgcache
Summary:
On Windows, all the tests that are expecting to find some files in $CACHEDIR
would fail due to the directory not existing. Interestingly enough, printing
$CACHEDIR would print a reasonable path, which is the same as $TESTTMP.
Trying to understand this better, I passed --keep-tmpdir to run-tests and
realized that the "real" $TESTTMP was somewhere in my home directory, while
the real $CACHEDIR was in fact C:\tmp.

I haven't fully understood why, but it looks like $PWD is expanded in C:\tmp,
while $TESTTMP is expanded into something else.

Reviewed By: quark-zju

Differential Revision: D15041274

fbshipit-source-id: 0d167183d74df5f6ab84360c5699e96808fceb9b
2019-04-22 18:39:40 -07:00
Xavier Deguillard
10d64adb01 sampling: silence BaseException.message deprecation warning
Summary: Almost all tests are failing on Windows due to a warning about BaseException.message being deprecated. Replace it with str(e).

Reviewed By: kulshrax

Differential Revision: D15039020

fbshipit-source-id: d984af91ec447b2f721eab2e3c6d39a0b350fb57
2019-04-22 17:58:07 -07:00
Durham Goode
bf9fd13411 pushrebase: throw if prechangegroup fails
Summary:
The prechangegroup hook didn't have throw=True set, so if the hooks
failed we ignored it. This seems to have been the case for a long time, but we
only recently hit it.

Reviewed By: kulshrax

Differential Revision: D15038494

fbshipit-source-id: 4fa9ed4924c02732e3e4070e747a80fbe63564c9
2019-04-22 17:10:15 -07:00
Arun Kulshreshtha
6745729cbd edenapi: make file validation configurable
Summary: Add a new config option to toggle file validation.

Differential Revision: D15034687

fbshipit-source-id: 3783ea1dacad9d1e494a5de1388f703db0ed1129
2019-04-22 14:46:29 -07:00
Arun Kulshreshtha
e5bbec4a60 edenapi: use argument unpacking in client constructor
Summary: We have to pass a lot of config options across the FFI boundary; these are currently passed as arguments to the Eden API client constructor. Let's use argument unpacking to avoid repeating a bunch of argument names in the call to the constructor.

Differential Revision: D15034480

fbshipit-source-id: 74d0830c686c8863fcede6e57404aec3f0a58ea1
2019-04-22 14:46:28 -07:00
Xavier Deguillard
324186a60c remotefilelog: avoid double close of mutable packs
Summary:
When eden request a tree, it manually commit the pending mutable pack files. In
the unlikely case where the temporary files are removed from the disk, the
pack.close() operation will fail, since the pending packs aren't reset, the
next commit that happens while the repo object is closed will try again. This
time, it may try to close an already closed packfile, leading to P62634761.

Reviewed By: quark-zju

Differential Revision: D15015632

fbshipit-source-id: 016617334498c0161feed9dcec5ce24df931ad9c
2019-04-22 10:15:42 -07:00
Marla Azriel
9e6d77b35a commands: update help text for amend
Summary: Updated help text for hg amend and moved some options to verbose

Reviewed By: kulshrax

Differential Revision: D15004588

fbshipit-source-id: 4c9e0bffb522184ac8750ed8aa4eb5a53b309bd0
2019-04-19 11:16:56 -07:00
Stefan Filip
a802e610d1 revisionstore: rename Store to LocalStore
Summary:
I want to give Store a more specific name so that it doesn't get
confused with other Store abstractions that we will add in the
future.

Reviewed By: singhsrb

Differential Revision: D15007383

fbshipit-source-id: 499bcda4aecd5389e3bc1eba5206ba72a69c4c3d
2019-04-19 09:51:29 -07:00
Jun Wu
ec5f4f4f6a smartset: fix a possible StopIteration exception
Summary:
Python's `next()` can raise the `StopIteration` exception, unlike Rust's `next`
which just returns `None` instead.

Fix it by providing a default value `None`.

Reviewed By: singhsrb

Differential Revision: D15008773

fbshipit-source-id: df885c63b8130ceac38f86c89f2547dde2d519ba
2019-04-18 19:32:54 -07:00
Xavier Deguillard
ef4844624e remotefilelog: remove fetchwarning
Summary:
The warning isn't that useful, and can actually cause more harm than good, as running `hg prefetch -r .`
can download gigabytes of unnecessary data to the hgcache.

Reviewed By: quark-zju

Differential Revision: D14999458

fbshipit-source-id: b0ff2c2ad0e441622066fac10a5efafe8de588db
2019-04-18 14:09:09 -07:00
Jun Wu
4d9c118ad4 slides: recompile with newer tex toolchain
Summary:
The pdf generated by D14940136 used an older version of texlive. It has issues
with text colors after a footnotemark.

Correct it by recompiling with a newer version of texlive. Besides, I made some
minor edits to make the style more consistent (ex. capitalized some words,
removed some periods).

Reviewed By: sfilipco

Differential Revision: D15001655

fbshipit-source-id: 31bb7741ab18bba1594c553650e4710f537c2399
2019-04-18 13:50:03 -07:00
Jun Wu
bbafce2167 indexedlog: expose range API on Log
Summary:
`Log::lookup_range` exposes the range query feature provided by `Index`.
The iterator is made double-ended by the way.

Reviewed By: sfilipco

Differential Revision: D14895477

fbshipit-source-id: 6aef0973e009bf8fc6f3b5e5a8f6c54e57c81360
2019-04-18 13:35:46 -07:00
Jun Wu
8c9dc8cf82 indexedlog: use RangeIter for prefix lookup
Summary:
The RangeIter is actually faster. The main reason is that it avoids recursion.
RangeIter does require double Vec, which seems like extra overhead. Practically
it does not seem to matter much.

The RangeIter code is also better written than PrefixIter. So let's delete
PrefixIter, and switch prefix lookups to use RangeIter.

Before:

  index prefix scan (2B)         89.788 ms
  index prefix scan (1B)         72.337 ms
  index prefix scan (2B, disk)  102.098 ms
  index prefix scan (1B, disk)   90.445 ms

After:

  index prefix scan (2B)         76.335 ms
  index prefix scan (1B)         54.517 ms
  index prefix scan (2B, disk)   91.798 ms
  index prefix scan (1B, disk)   67.143 ms

Reviewed By: sfilipco

Differential Revision: D14895478

fbshipit-source-id: 79a01774fb640c78fc5733db82f86f0f9403c960
2019-04-18 13:35:45 -07:00
Jun Wu
ef89e13207 indexedlog: add benchmark about scan_prefix
Summary:
This would provide data about scan_prefix performance.

The benchmark code is slightly changed to share the index across test cases.
That reduces test setup cost.

Reviewed By: sfilipco

Differential Revision: D14895481

fbshipit-source-id: e70098bd202e102822a0829c0ae28de8d49fbe85
2019-04-18 13:35:45 -07:00
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