Commit Graph

228 Commits

Author SHA1 Message Date
Jun Wu
241fc4086c doctor: avoid constructing the repo object
Summary:
Constructing the repo object might read some broken storages (ex. reading
"allheads"). Avoid constructing the repo object for fixing mutationstore,
metalog and allheads.

Reviewed By: markbt

Differential Revision: D19169209

fbshipit-source-id: d792c09db20e25cce406bc8c1adb66a28410bd4d
2019-12-22 11:27:28 -08:00
Jun Wu
be20ec511c scmutil: prompt hg doctor for indexedlog errors
Summary:
Since we now have the indexedlog error type. Match it and print helpful
messages.

Reviewed By: markbt

Differential Revision: D19169207

fbshipit-source-id: cd874f651b681d2dbbb5aea613c56721c4ab6181
2019-12-22 11:27:28 -08:00
Jun Wu
4dd04bf02f hgpython: replace hgpython interpreter with native Rust implementation
Summary:
The hgpython interpreter was used to run Python scripts in tests that might
rely on Mercurial modules.

The previous hgpython implementation is Python PAR based, which does not have
access to native Rust modules like bindings. Change it to use the native
"hg debugpython" implementation that is more compatible.

Reviewed By: markbt

Differential Revision: D19190496

fbshipit-source-id: 9791dbf9ba0ed92de702291faa9145f01b05ec40
2019-12-22 11:27:27 -08:00
Jun Wu
4a4aeff284 bindings: expose IndexedLogError to Python
Summary:
Expose the indexedlog error type to Python so it can be used in `except`
clause.

Reviewed By: markbt

Differential Revision: D19169208

fbshipit-source-id: c41f08ec11f78f7714b435dbfc6a28c36b34617d
2019-12-22 11:27:27 -08:00
Jun Wu
d6b2eb80a7 cpython-ext: convert known error types to dedicated errors directly
Summary:
Convert indexedlog error and IOError to dedicated Python types so the Python
world can match them meaningfully by type and handle them accordingly.

Reviewed By: markbt

Differential Revision: D19169210

fbshipit-source-id: 1e7bfdf7cbaf917098efdcd63d600483a9427d33
2019-12-22 11:27:27 -08:00
Jun Wu
0c41aa6235 extensions: change error message to look non-fatal
Summary:
The current error message looks like fatal while it is not. Make it clear that
extension failures are not fatal.

Reviewed By: markbt

Differential Revision: D19166545

fbshipit-source-id: 7ce0231c90b0c5f50add15a12cb69b60b76dfcb1
2019-12-22 11:27:26 -08:00
Jun Wu
e5de1683e4 gitnode: try using commit extra first
Summary:
There are 3 extensions that can provide the `{gitnode}` template: "gitrevset",
"fbscmquery", "hggit". The last can read from commit extras. Fix the first two
to also read commit extras. At some point we need to unify the implementations.

Reviewed By: farnz

Differential Revision: D19198979

fbshipit-source-id: 24a0df0df4ceb7a9af9236a7f70babfd54e9802b
2019-12-20 16:14:25 -08:00
Jun Wu
e21a23cc17 blackbox: write less frequently to disk
Summary:
When there are many processes (ex. import helpers). Writing to blackbox can be
slow due to flock contention.

Change blackbox "flush" decision from timestamp based to buffer-size based to
mitigate the issue.

Reviewed By: DurhamG

Differential Revision: D19198470

fbshipit-source-id: 71f87e5e3b45ef4db8efda22ca89fd8ce1fae7fa
2019-12-20 16:14:25 -08:00
Durham Goode
e2bac56f2f dirstate: filter ignored files before looping over non-normal
Summary:
D17099990 changed the way status is computed and added a loop over the
nonnormal files to find any added, removed, or merged files. Unfortunately the
nonnormal file list can contain untracked ignored files in some cases, and if
that list is large (like if someone disabled a sparse profile) this loop can
take many seconds.

Let's updated the loop to filter out ignored files. This matches a similar loop
in fsmonitor, and we may want to think about removing nonnormal handling from
the fsmonitor code entirely now that it's handled in dirstate.py.

Reviewed By: quark-zju

Differential Revision: D19190259

fbshipit-source-id: 4ba4150507fdd72439bc4e5eb731a951c6100f5f
2019-12-20 16:14:24 -08:00
Jun Wu
e41e214a01 remotenames: avoid updating "selectivepullaccessedbookmarks" if unnecessary
Summary:
I encountered a 19s `hg sl` run where 13s were spent on
`remotenames.updateaccessedbookmarks` (8 times).

{F225347899}

The filesystem is unusually slow since the it's nearly full. However, the
updates are not really necessary since I'm not accessing more remote names.
Accessing one bookmark via smartlog rewrites the entire accessed file, which is
O(N^2) and undesirable.

Improve it by skipping writing if nothing has changed. In the future we might
want to optimize it further by:
- Only update (and do ui.log) "accessedbookmarks" at most once per command.
- Potentially drop the "accessedbookmarks" tracking by using "remotenames"
  directly - everything in "remotenames" is accessed.

Reviewed By: markbt

Differential Revision: D19191528

fbshipit-source-id: 46635d4e5c9d0034ace9cdafc1f42a4512aa8774
2019-12-20 16:14:24 -08:00
Thomas Orozco
82df66ffe9 lfs: avoid accidentally quadratic performance in download path
Summary:
Currently, hg's lfs extension used bytes concatenation to download a response
from the server-side. However, concatenating bytes in Python can be
inefficient, since it'll re-allocate the whole thing and copy it every time you
concatenate.

This makes repeated concatenation O(N^2) on the number of things you
concatenate, which is undesirable. This diff updates hg's lfs extension to not
do that.

Reviewed By: farnz

Differential Revision: D19194388

fbshipit-source-id: f4a38afd8ba41bc1c2e64e9127035675ecda6651
2019-12-20 16:14:24 -08:00
Thomas Orozco
2a4a6fab4e lfs: check content length after downloading content
Summary:
HTTP makes no provision to tell your client that you failed halfway through
producing your response and won't have the answer they're looking for. So, if a
LFS server fails while producing a response, then we'll report an OID mismatch.

We can do a little better and disambiguate between "the server sent us the
wrong blob" (very scary) and "the server crashed" (merely annoying) by looking
at the content length of the response we got back. If it's not what was
advertised, we can reasonably safely assume the server crashed.

Reviewed By: farnz

Differential Revision: D19194389

fbshipit-source-id: 569bd20cffe2901e2801261ce783e99bcf8358e2
2019-12-20 16:14:24 -08:00
Jun Wu
2038472340 test-fb-hgext-sshaskpass: require linux to run
Summary:
The test is flaky in recent OSX builds.

The test is about a chg feature. Right now we only use chg on Linux. So limit
the test to Linux only.

Reviewed By: singhsrb

Differential Revision: D19191582

fbshipit-source-id: ce506f3f50c4368253caea0d73a647539c649735
2019-12-20 16:14:24 -08:00
Jun Wu
df5dce4138 test-convert-hg-source: require execbit to fix it on Windows
Summary:
After D19043330, the test is failing on Windows (no execbit).

When converting a repo, we almost always want to preserve the execbit. So let's
just skip the test if execbit is not available.

Reviewed By: singhsrb

Differential Revision: D19191556

fbshipit-source-id: 8e65d0b4b03833216ac8f28e2ae25f87de72304f
2019-12-20 16:14:23 -08:00
Durham Goode
b4f44d39a5 convert: delete support for gnuarchs, darcs, and bzr
Summary:
We don't support any of these VCS's, and we're not running any of the
tests. The code is just bit rotting. Let's delete them.

Reviewed By: quark-zju

Differential Revision: D19043710

fbshipit-source-id: 6e0d625c755cbc875755dc09b394bc730186db1d
2019-12-20 16:14:22 -08:00
Jia Chen
a731c7518d Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Differential Revision: D19143864

fbshipit-source-id: 0d2d4ed32423b740a67aae670b7f10691e4f4800
2019-12-20 16:14:21 -08:00
Jun Wu
05ba5a56d4 dag: rewrite Debug for Dag
Summary:
The current implementation iterates through all entries, which will include
deleted entries. Rewrite it to use index lookups so it does not print
deleted entries.

Reviewed By: sfilipco

Differential Revision: D18838993

fbshipit-source-id: 58d3f2da27cd3e91bc10cbb04bcdca3b7ff07dbb
2019-12-20 16:14:21 -08:00
Jun Wu
859b79de3b dag: replace Group::MAX with Group::COUNT
Summary:
Address review comment in D18640899. I went a bit further that makes COUNT,
ALL, and BITS consistent.

Reviewed By: sfilipco

Differential Revision: D18820721

fbshipit-source-id: e354a3aecf0d8cbe66c43d56198933cdc6420241
2019-12-20 16:14:21 -08:00
Jun Wu
710e2c9ae8 dag: replace Id(0) and Id::max_value() with Id::{MIN,MAX}
Summary:
Address review comment in D18640898.

Id::min_value and Id::max_value become unused and are removed.

Reviewed By: sfilipco

Differential Revision: D18820722

fbshipit-source-id: d9682bf5918307166571fa35aa15cc9eee1a7140
2019-12-20 16:14:21 -08:00
Jun Wu
a1d710fa58 dag: rename GroupId to Group
Summary:
Address review comment in D18640899. This makes the word `id` universally
refer to a same concept within the crate.

Reviewed By: sfilipco

Differential Revision: D18820723

fbshipit-source-id: 6803192db7e1304a72100568f8f29b90f25c7779
2019-12-20 16:14:21 -08:00
Jun Wu
d3543665eb dag: de-dup IdMap at insertion time
Summary: There is no need to insert duplicated entries to IdMap.

Reviewed By: sfilipco

Differential Revision: D18670158

fbshipit-source-id: 812ea421c9f36cd12b4aa2be5b2560abec627a52
2019-12-20 16:14:20 -08:00
Jun Wu
d60355d1ba dag: add a way to generate sparse IdMap
Summary: This emulates what IdMap the server will send to the client at initial clone.

Reviewed By: sfilipco

Differential Revision: D18670160

fbshipit-source-id: 496142c1e149df9accf816e3d0a1b8316ff64c67
2019-12-20 16:14:20 -08:00
Jun Wu
3125f6bbd5 dag: implement Debug for IdMap
Summary: This makes it easier to check what's stored in IdMap.

Reviewed By: sfilipco

Differential Revision: D18670159

fbshipit-source-id: 91387d01da7d52a0d349e87ffa0aa8983bbe2213
2019-12-20 16:14:20 -08:00
Jun Wu
0d8ae15299 dag: implement more protocols
Summary:
This diff implements the following part in a local-only environment:

  Id -> Slice: Id -> Request --> Response -> Slice
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  Slice -> Id: Slice -> Request --> Response -> Id
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^

Reviewed By: sfilipco

Differential Revision: D18664210

fbshipit-source-id: 740b9cdfe533e7bcc9bbbf2a53c8bcc5bc3648bf
2019-12-20 16:14:20 -08:00
Jun Wu
7a35f20e72 dag: implement some protocols
Summary:
This diff implements the following part in a local-only environment:

  Id -> Slice: Id -> Request --> Response -> Slice
               ^^^^^^^^^^^^^
  Slice -> Id: Slice -> Request --> Response -> Id
               ^^^^^^^^^^^^^^^^

Reviewed By: sfilipco

Differential Revision: D18664205

fbshipit-source-id: 47a35c6f95a58ab29c014ac3c6799f16e6114da3
2019-12-20 16:14:20 -08:00
Jun Wu
2467448518 dag: abstractions around remote protocols
Summary:
In the future the client will have a sparse IdMap, and needs the server (who
has a complete IdMap)'s help to convert between Id and Slice (commit hash)
for commits in the MASTER group.

This diff defines basic abstractions for communications between a sparse IdMap
and a complete IdMap. The basic flows are:

  To convert Id to Slice: Id -> Request --> Response -> Slice
  To convert Slice to Id: Slice -> Request --> Response -> Id

(`->`: client-side; `-->`: server-side)

Reviewed By: sfilipco

Differential Revision: D18664206

fbshipit-source-id: 93a6b671be30ab1247c71d814817a2ea06b6bc66
2019-12-20 16:14:20 -08:00
Durham Goode
6caa257684 commitcloud: use our background spawning utility
Summary:
On Windows, subprocess.Popen caused the current process to wait until
the background process was complete, which meant commit, amend, rebase, etc had extra long waits on the end. We have utility functions that correctly set up the background process, so let's use that instead.

Unfortunately we can't redirect stdin, stdout, stderr when using close_fds on
Windows, so we lose the ability to do logging.

Reviewed By: quark-zju

Differential Revision: D19149682

fbshipit-source-id: 6880ec7833e286b79b34c49c339aff3318f07295
2019-12-20 16:14:19 -08:00
Jun Wu
5d5c575139 exchange: add a config to stop writing local bookmarks
Summary:
This is part of the logic of remotenames. Unfortunately our production setup
has some really annoying legacy code in multiple places that disables
remotenames and do `rm .hg/bookmarks` manually. They should really enable
remotenames and get rid of `rm .hg/bookmarks`. However that has complications.

With recent changes, `.hg/bookmarks` is moved to `.hg/store/bookmarks` and
later moved to `metalog`. That caused 10k+ bookmarks left in local bookmarks
after clone (or pull).

Writing remote bookmarks as local bookmarks makes no sense in modern setup.
Therefore this diff adds a config option to disable such feature.

The ideal state is the bookmark logic in exchange writes remotenames directly,
instead of silently ignoring it. But that's a risky and larger change. My
expectation is, the remotenames extension will be enabled and take care of the
rest.

The idea of not writing local bookmarks come from markbt.

Reviewed By: DurhamG

Differential Revision: D19148278

fbshipit-source-id: a03eac68378908586d6e6848ed43532c0aab06c3
2019-12-20 16:14:19 -08:00
Durham Goode
ff41e331e0 convert: remove tags from convert
Summary:
A future diff will remove the tags feature. Convert uses tags heavily
and it breaks a number of tests, so let's remove tags from the convert extension
before we remove tags entirely.

Reviewed By: quark-zju

Differential Revision: D19043330

fbshipit-source-id: 628d27fea1601931da45d1280eff981c5d12f93c
2019-12-20 16:14:19 -08:00
Jun Wu
245f179697 scratch: drop dependency on telemetry
Summary:
The buck generated binary is 1.2GB in size. Drop dependency to reduce the size.
Dependent functions are re-invented.

New size is 31MB under `mode/opt` build, and 28MB under `mode/dev` build.

Reviewed By: wez

Differential Revision: D18900827

fbshipit-source-id: 536fa969d69f6261d812c2320795780d839b6ced
2019-12-20 16:14:19 -08:00
Durham Goode
218c83d574 tags: remove tip tag
Summary:
In a future diff we'll be removing tags. The most prevalent tag is
'tip', which shows up in a ton of test output. Let's drop that tag first, so we
can safely update the tests before we drop tags entirely.

Reviewed By: xavierd

Differential Revision: D18995058

fbshipit-source-id: 8c63710cd4ed567ea24e32724b8660f9006a61f1
2019-12-20 16:14:19 -08:00
Durham Goode
e1c73204f6 drawdag: use bookmarks instead of tags
Summary:
A future diff will remove tags entirely, so let's move drawdag to be
bookmark based.

Reviewed By: quark-zju

Differential Revision: D18995059

fbshipit-source-id: 70ef67259b37ef9821009d0145aa1e03c09b1309
2019-12-20 16:14:18 -08:00
Durham Goode
5feb7fd641 split: add more granular transactions
Summary:
Rolling back the entire transaction can causes Eden to get out of sync
with Mercurial and cause hangs. It can also causes users to lose the work
they've done splitting the commit.

Let's change split to commit the transaction after every commit. If a user exits
mid-split they will now be left in a state where the splits they've done so far
are still present, and we print a message telling them how to roll all the way
back if they want to.

Reviewed By: quark-zju

Differential Revision: D19114546

fbshipit-source-id: b67d5543f9c23a6299f4164c73662759661f59a9
2019-12-20 16:14:18 -08:00
Jun Wu
fd5cb6e225 bindings: allow Python threads during indexedlog repair
Summary: This should allow us to show a spinning progress bar when repair() is working.

Reviewed By: xavierd

Differential Revision: D19056949

fbshipit-source-id: 8e058bad002bb2de29dbf8457bead0ebd1e99372
2019-12-20 16:14:18 -08:00
Jun Wu
79670ae429 phases: make listkey not crash with narrow-heads=true
Summary:
The current code crashes with `phaseroots` being an unknown attribute.

Reported By: DurhamG

Reviewed By: DurhamG

Differential Revision: D19048762

fbshipit-source-id: f59764ec04284cd643fbb5a3c319868df06c4912
2019-12-20 16:14:17 -08:00
Igor Sugak
e3af371ba6 move cram from xplat/third-party to third-party
Reviewed By: pixelb

Differential Revision: D16871214

fbshipit-source-id: 3c7a4d1bf936a55c926e0507ae52a41ebc547032
2019-12-20 16:14:17 -08:00
Jun Wu
5227c3c9a4 dispatch: preimport more modules for chg server
Summary: There are some modules missed in the preimport list. Add them.

Reviewed By: xavierd

Differential Revision: D18957117

fbshipit-source-id: 254384f0bcafd52421fb22dc696b3a6a1fb98537
2019-12-20 16:14:17 -08:00
Jun Wu
780faa2c10 tests: replace print in debugshell with ui.write
Summary:
Similar to D18926784.

Mercurial makes sure content written by `ui.write` is flushed, while there is
no such guarantee for `print`. When running using chg, it's more likely that
`print` content gets disappeared. Therefore let's use `ui.write` instead.

Reviewed By: ikostia

Differential Revision: D18926983

fbshipit-source-id: 960c189cc48bc3c89bb4f7993d2033dd45c52a67
2019-12-13 10:30:39 -08:00
Mateusz Kwapich
7e0e170db9 rename fbconduit extension to fbscmquery
Summary:
This is mostly result of:
```
  find . -type f -exec sed -i "s/fbconduit/fbscmquery/g" {} \;

```
`fbconduit` extension doesn't use conduit anymore so the name is just misleading.

Reviewed By: ikostia

Differential Revision: D18748843

fbshipit-source-id: 0d59e61ba7a96d86d9d1333d81255108cc3141bc
2019-12-13 03:23:25 -08:00
Xavier Deguillard
828f5b487d tests-flagprocessor.t: fix it
Summary: This looks like a fallout of D18666054

Reviewed By: quark-zju

Differential Revision: D18992910

fbshipit-source-id: c2392553a0489097f82b4073bbbca37b43f53bba
2019-12-12 20:36:43 -08:00
Xavier Deguillard
e7a3859828 convert: disable "getting files" progress bar
Summary:
This is showing in profile for about 10% of the time, let's just disable it as
getting files should be fairly quick.

Reviewed By: quark-zju

Differential Revision: D17841315

fbshipit-source-id: 08a61e19351fb5217431a3ca8993b8074f6d6c74
2019-12-12 14:15:05 -08:00
Xavier Deguillard
81365e9e9f localrepo: use repo.commitpending in repo.commitnotransaction
Summary:
There is no need to duplicate the code.

The test change are due to commitpending being called 3 times, vs 1 before. The
total amount of times {fileslog,manifestlog}.commitpending is called is unchanged.

Reviewed By: quark-zju

Differential Revision: D17841316

fbshipit-source-id: be33a126f913af8824a6d5ade17351707d39ed2f
2019-12-12 14:15:05 -08:00
Jun Wu
cf8efdb0d2 ui: use smarttraceback
Summary: The smart traceback is generally more useful.

Reviewed By: markbt

Differential Revision: D18666054

fbshipit-source-id: a96bb3e2919ed6692c4a7b965ad74cd2c8a66241
2019-12-12 13:47:49 -08:00
Adam Simpkins
1ec027f5bc add type annotations to mercurial/commands/eden.py
Summary: Add type annotations to all functions in this file.

Reviewed By: xavierd

Differential Revision: D18949804

fbshipit-source-id: 4ac1789aa086e9e5f2397bc005a33cfb2f6c0b56
2019-12-12 12:48:50 -08:00
Xavier Deguillard
f0bf034842 test-check-code: use glob for st_*time error
Summary: This keep failing due to single line changes. Let's make it more robust.

Reviewed By: kulshrax

Differential Revision: D18963816

fbshipit-source-id: c56748560b619c4c682e8cc9e5710c607aa363fb
2019-12-12 11:41:22 -08:00
Adam Simpkins
264f6565f6 make the EdenFS tree prefetch depth configurable
Summary:
D18263067 updated the `CMD_FETCH_TREE` handler to fetch tree with a depth
of 1, rather than using fetching the entire recursive tree structure.
I think this has contributed to some of the recent user-reported slowness for
fetch operations, as fetching a large directory structure now triggers many
more individual requests for each separate tree.

This diff adds a configuration parameter to control the tree fetch depth.  I
have set the default value at 3, which should hopefully provide a reasonable
level of tree prefetching without completely fetching all contents of deep
trees.

Reviewed By: wez

Differential Revision: D18942585

fbshipit-source-id: 6a8d749434520baee25a4277712c44b916adcb3f
2019-12-11 20:54:55 -08:00
Jun Wu
c745d644d9 doctor: fix incorrect repair on indexedloghistorystore
Summary:
I made a mistake when editing the last version of the code. It uses
indexedlogdatastore to repair indexedloghistorystore, which is incorrect.
Fix it.

Reviewed By: xavierd

Differential Revision: D18945952

fbshipit-source-id: addec020c761e6c11d2fe485eb408f5b200afb08
2019-12-11 17:34:44 -08:00
Jun Wu
ab69de6a14 util: improve smarttraceback
Summary:
Make util.smarttraceback:
- Support `traceback` object.
- Look more similar to normal traceback (headers, and indentation).
- Hide boring content.
- Show binary hashes in hex form.

Reviewed By: markbt

Differential Revision: D18666055

fbshipit-source-id: d61446604c673ec5e1a96912fa29935d4238ecc9
2019-12-11 16:34:33 -08:00
Jun Wu
efa601b19e snapshot: make import side-effect free for chg compatibility
Summary:
See also D5271419. Decorators in `bundle2` and `exchange` are not side-effect
free. Move them to `uisetup` for better chg compatibility.

Reviewed By: StanislavGlebik

Differential Revision: D18926786

fbshipit-source-id: 2a3fa6ed4cef42c9bad4666ff75496d483991f88
2019-12-11 15:45:23 -08:00
Jun Wu
b72f3479fd infinitepush: make import side-effect free for chg compatibility
Summary:
See also D5271419. Decorators in `bundle2` and `exchange` are not side-effect
free. Move them to `uisetup` for better chg compatibility.

Reviewed By: StanislavGlebik

Differential Revision: D18926782

fbshipit-source-id: b99e2882cb6530a648a065c6d739ee9a7aebb851
2019-12-11 15:45:23 -08:00