Commit Graph

851 Commits

Author SHA1 Message Date
Durham Goode
861f813f25 configs: convert facebook_overrides.rc
Summary: Converts facebook_overrides.rs to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21625721

fbshipit-source-id: 2a374939d90f1fb7f9173268e2a7fa636d672393
2020-05-19 13:23:19 -07:00
Jun Wu
e685e64758 remotefilelog: skip uploadblobs for public revs
Summary:
There is no need to upload content referred by a public commit.

This affects cases like `debugstrip` (ex. for testing `pull` performance with a
lagged commit graph). Without this change, the uploadrevs code path scans
stripped public commits without efficient tree prefetching, which results in
1-by-1 tree fetches and is unusably slow.

Reviewed By: xavierd

Differential Revision: D21630096

fbshipit-source-id: 385edf76cb4eb913b2d64422910cdb46b603e6c0
2020-05-19 10:25:57 -07:00
Mark Thomas
513a4f8426 color: don't disable colors if HGPLAINEXCEPT=color
Summary:
With `HGPLAINEXCEPT=color`, colors should still be enabled if the terminal is
capable of supporting them and output is to the terminal.

Currently this doesn't work if `--color=auto` (the default), as
`color._modesetup` uses `ui.formatted` to check if the output is a terminal,
and thus has colors available, but this is `False` for all `HGPLAIN` modes.

Instead, add a new method to `ui` that checks whether  `fout` is a terminal, and
use that for color autodetection.

This function also allows us to add `HGPLAINEXCEPT=pager` as we can use
that in the same way.

Reviewed By: farnz

Differential Revision: D21617170

fbshipit-source-id: 7ee4eaa8963f3d6eb7ed8044a678a4804b9a98f0
2020-05-19 06:13:54 -07:00
Jun Wu
c2869d6ca9 remotefilelog: call setuprepo unconditionally in clone_shallow -> pull_shallow
Summary:
Before this change, pull_shallow only calls setuprepo if the remotefilelog
requirement is not in repo. With D21011401, the remotefilelog requirement
will be added by clone.py and pull_shallow can skip calling setuprepo, causing
the pull code paths to write file logs (and fail).

Change the pull_shallow to always call `setuprepo` to solve the issue.

The final fix is probably moving more remotefilelog related clone logic to core.
Right now I just did the minimal change to fix things.

Reviewed By: sfilipco

Differential Revision: D21632429

fbshipit-source-id: 17775ac0df18cda10247419b40f9c27436b22606
2020-05-18 17:52:34 -07:00
Durham Goode
49ac0401b7 discovery: go back to random sampling but include master
Summary:
An earlier change (D21394302) made discovery sampling use the most
recent commits. This ended up not being correct since if the requested sample
did not find any hits then the unknown set would not be reduced and the next
requested set would not change, resulting in an infinite loop.

The goal of the original diff was to ensure master was in the initial sample set
so we didn't have to inspect a bunch of really old commits. Let's go back to
random sampling, but manually insert master into the initial set.

In the long-term we should throw away all this code and use something similar to
discovery.fastdiscovery instead which just relies on the public heads.

Reviewed By: quark-zju

Differential Revision: D21577331

fbshipit-source-id: d738de255e292fc569eb27f250dcd3eaafaaae43
2020-05-15 19:03:29 -07:00
Thomas Orozco
6676a7a476 logginghelper: use repo basename as repo name
Summary:
When we don't provide a repo name, scm_telem_log will run `hg config` to try
and get the path, and fall back to using the basename of the repo directory.

However, this is a bit undesirable, because if we ran this code we already
checked the path, so the repo URL isn't going to magically materialize once `hg
config` asks for it, which means we make a completely redundant call to hg from
scm_telem_log.

By just doing this in logginghelper, we avoid this extra roundtrip.

Reviewed By: StanislavGlebik

Differential Revision: D21572027

fbshipit-source-id: 58e5ab2e3e525edef1ecde039cd968eab8d89172
2020-05-15 03:02:00 -07:00
Thomas Orozco
ec60105698 rage: collect debuglocks
Summary:
This feels like it might have been helpful here:
https://fb.workplace.com/groups/scm/permalink/2854695251246743/

Reviewed By: markbt

Differential Revision: D21575908

fbshipit-source-id: 0fcc74793ecfbd57d11e9d393a4bb63fe5d013ce
2020-05-15 02:57:50 -07:00
Jun Wu
d75ac1d575 sigtrace: also write tracing data
Summary: This might provide some useful insights for debugging hanging processes.

Reviewed By: kulshrax

Differential Revision: D21580307

fbshipit-source-id: 424992cdd9851bfd782a3333ed22ac1193c33fe3
2020-05-14 21:28:30 -07:00
Arun Kulshreshtha
57e92bb28d movement: allow prev/next with pending changes
Summary:
Make `prev` and `next` match the behavior of `update` and allow movement with pending changes. A new `--check` flag has been added to enforce a clean working copy (similar to `update`).

Note that these commands literally just call `update` under the hood, so this was just a matter of removing the existing dirtiness check. (The check was originally put there because `update` originally required a clean working copy by default.)

Reviewed By: quark-zju

Differential Revision: D21581805

fbshipit-source-id: 33d0ac4d36a795713054af7e8776d077fd353048
2020-05-14 21:23:27 -07:00
Arun Kulshreshtha
3f8518bf9b treemanifest: allow BFS prefetch without HTTP
Summary: Previously, we would only allow BFS prefetching when HTTP was enabled (since prior to the `designatednodes` server capability, SSH had no way of supporting BFS). That has now changed, so we should allow BFS even if HTTP is disabled.

Reviewed By: quark-zju

Differential Revision: D21581215

fbshipit-source-id: b9d5945730e2c718681004f7d5e5f319449fcf6a
2020-05-14 21:11:43 -07:00
Jun Wu
06f03628aa infinitepush: remove legacy auto pull logic
Summary: The revset autopull now covers the infintiepush autopull logic.

Reviewed By: DurhamG

Differential Revision: D21526664

fbshipit-source-id: 90cfdebc99bb69b3e45eadcbf4b0d764e0cd68c6
2020-05-14 12:47:35 -07:00
Jun Wu
b2c1d90f22 commitcloud: use dag operations to simplify 'hide' logic
Summary:
Now we have a virtual DAG that can be queried. Use that to figure out what
heads to hide and add instead of manually traversal through the graph.

Also did some tweaks to fix Python 3 compatibility and make the parent graph
style a bit more correct.

Reviewed By: markbt

Differential Revision: D21554672

fbshipit-source-id: 749d7938a8612e21c5975d9b80a275a059de022d
2020-05-14 12:03:46 -07:00
Jun Wu
4ff20f93e0 commitcloud: decouple graphlog rendering logic from getsmartlog APIs
Summary:
The `getsmartlog` APIs return a generator suitable for passing to the graphlog
rendering layer, but not suitable for doing other things such as querying the
DAG. Split that API into two APIs:

- getsmartlog -> SmartlogInfo
- makedagwalker(SmartlogInfo, Repo) -> generator suitable for graph rendering

Reviewed By: markbt

Differential Revision: D21554673

fbshipit-source-id: c709b7a41572eb3e9c9f91b74fc2bc8226bc481f
2020-05-14 12:03:45 -07:00
Jun Wu
791ec223ba commitcloud: use Rust dag abstractions for smartlog rendering
Summary:
This simplifies a lot of the code, and makes it possible to do DAG queries like
ancestors, descendants on the commit cloud graph.

Reviewed By: markbt

Differential Revision: D21554674

fbshipit-source-id: ee08cddfc162a7546d63d4bf385f2948fc799fd3
2020-05-14 12:03:45 -07:00
Jun Wu
285e883c0a commitcloud: only use the Rust graph renderer
Summary:
The only reason that we keep the legacy renderer is that `hg-sl-up` parses
`hg sl` output and breaks with the new Rust renderer. `cloud sl` does not
have such issues so we can switch to the new renderer unconditionally.

Together with the previous change, this allows the upcoming change to render
the graph without using revision numbers.

Reviewed By: markbt

Differential Revision: D21554670

fbshipit-source-id: eee5fbd641096b38e206298f9e716df358a7ab7e
2020-05-14 12:03:44 -07:00
Durham Goode
dc2498c710 configs: convert common_overrides.rc
Summary: Converts common_overrides.rs to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21536496

fbshipit-source-id: 83d1968f678d03bad0e878d8b64fe22ae71df13f
2020-05-14 10:27:43 -07:00
Durham Goode
b922952589 configs: convert fbsource_overrides.rc
Summary: Converts fbsource_overrides.rs to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21536497

fbshipit-source-id: 26d4cc656114bc7bd85c2bf09b149d78cc8eb08a
2020-05-14 10:27:43 -07:00
Durham Goode
f181eef520 configs: convert ovrsource_overrides.rc
Summary: Converts ovrsource_overrides.rs to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21536498

fbshipit-source-id: 3f0021b7be90a82e5a517fa81fb3dad04b2837ed
2020-05-14 10:27:42 -07:00
Jun Wu
32298c1056 remotenames: remove legacy auto pull logic
Summary: The revset autopull now covers the remote bookmark autopull logic.

Reviewed By: DurhamG

Differential Revision: D21526665

fbshipit-source-id: f57e844021ef74f2f99a2124c821a2b190d45760
2020-05-13 19:27:42 -07:00
Jun Wu
8213cfd464 autopull: support different sources
Summary:
Make it so that remote bookmarks like `foo/name` or `bar/name` would pull from
different sources `paths.foo` or `paths.bar`.

Reviewed By: DurhamG

Differential Revision: D21526666

fbshipit-source-id: 6791ab047840c6c49df0c96ff1f56ae7bd1aeeba
2020-05-13 19:27:41 -07:00
Jun Wu
39bd5d8634 context: remove "is a remote bookmark or commit, try to 'hg pull' it first" message
Summary:
We now have auto pull logic that covers most unknown rev use-cases. The hint
message is no longer necessary. It's also unclear how to use `hg pull`
correctly. For example, should it be `-r`, `-B remote/foo` or `-B foo`?

Reviewed By: DurhamG

Differential Revision: D21526667

fbshipit-source-id: 40583bfb094e52939130250dd71b96db4d725ad5
2020-05-13 19:27:41 -07:00
Kostia Balytskyi
b1d4f6d2a5 debugsendunbundle: add cmd to send unbunble from stdin
Summary:
This is helpful, when we have raw unbundle bytes and a server path and just
want to send these bytes server's way.

Very similar to `sendunbundlereplay`, but does not do anything additional,
and reads from stdin.

Reviewed By: markbt

Differential Revision: D21527243

fbshipit-source-id: 97726cb40a32c7e44f47e0f56d8c8eabc4faf209
2020-05-13 15:34:39 -07:00
Jun Wu
ff7a6b43d3 pyre2: use Rust regex backend
Summary: Switch from re2 to the Rust regex engine.

Reviewed By: DurhamG

Differential Revision: D20973178

fbshipit-source-id: 2707bfb2120ceb3758a81c01a5a6f4f8c61758bc
2020-05-12 16:32:51 -07:00
Jun Wu
fe3bd0e090 tracing: replace blackbox.logblocked with tracing events
Summary: Migrate those "blocked" events from blackbox to tracing data.

Reviewed By: DurhamG

Differential Revision: D19797704

fbshipit-source-id: 401c1434e1d148956bb572d236d8998d59dfbf39
2020-05-12 10:48:43 -07:00
Jun Wu
dd1ee71afc tracing: write a few more events to tracing data
Summary:
Write commit cloud sync and clienttelemetry blackbox logs to tracing data.
Note: since metalog can answer head changes, I didn't add head changes of
commit cloud sync to the tracing data.

Reviewed By: DurhamG

Differential Revision: D19797700

fbshipit-source-id: b89924a7aa5e6027cad5c8138e8988f6b0ea4b2a
2020-05-12 10:48:43 -07:00
Jun Wu
cb9d8cde50 watchmanclient: write watchman commands to tracing data
Summary: This allows us to query tracing data for watchman commands.

Reviewed By: DurhamG

Differential Revision: D19797711

fbshipit-source-id: 4dfd50fff820da70888faa0fe8f53af25f205137
2020-05-12 10:48:42 -07:00
Jun Wu
1e64eb89b9 pull: skip listkeys bookmarks using the modern pull API
Summary:
The repo.pull API updates remote bookmarks on its own. Therefore do not even
ask the server to listkey (all) bookmarks.

This also removes the need of listkeys(bookmarks) for the new clone API.

Reviewed By: DurhamG

Differential Revision: D21011393

fbshipit-source-id: b10bdbc82563c32626bdcb2632170fd56819e904
2020-05-12 10:23:24 -07:00
Jun Wu
1863edef57 remotenames: disable exclone if core clone.streamclone is used
Summary:
The core `clone.streamclone` is the new clean way to do a streaming clone with
selectivepull. Detect the use of it and skip remotenames' own exclone logic.

Reviewed By: DurhamG

Differential Revision: D21011396

fbshipit-source-id: 50fdbf4c2761a96c50e23f21a87ef636fac74afb
2020-05-12 10:23:24 -07:00
Jun Wu
219554305e clone: add a new clone function with less tech-debt
Summary:
The current `clone --shallow` command has some issues:
- It fetches *all* remote bookmarks, since selectivepull does not work with
  streamclone, then remove most remote bookmarks in a second transaction.
- It goes through remotenames, which is racy, and D20703268 does not fix the
  clone case. Possible cause of T65349853.
- Too many wrappers (ex. in remotefilelog, remotenames, fastdiscovery) wtih
  many configurations (ex. narrow-heads on/off) makes it hard to reason about.

Instead of bandaidding the clone function, this diff adds a new clone implementation
that aims to solve the issues:
- Use streamclone, but do not pull all remote names.
- Pull selectivepull names explicitly with a working "discovery" strategy
  (repo heads should be non-empty with narrow-heads on or off).
- Do clone in one transaction. Outside world won't see an incomplete state.
- Use `repo.pull` API, which is not subject to race conditions.
- Eventually, this might be the only supported "clone" after Mononoke becoming
  the single source of truth.

Note: the code path still goes through bookmarks.py and remotenames.py.
They will be cleaned up in upcoming diffs.

Reviewed By: DurhamG

Differential Revision: D21011401

fbshipit-source-id: d8751ac9bd643e9661e58c87b683be285f0dc925
2020-05-12 10:23:23 -07:00
Jun Wu
1535e0774e changelog: expose rawheadrevs() API
Summary:
In the past we hide the revlog headrevs API with the idea that calculating
heads in the DAG is not going to scale, and heads should be based on references
(remotenames, visible heads). Practically calculating heads in the DAG based
on segmented changelog is not going to be painfully slow so we probably can
afford it.

Therefore let's just re-expose the DAG-based heads API as rawheads. The only
user of it is in dagutil.py.

This will be used in the next diff where streamclone first gets the revlog
changelog copied without remote bookmarks. Then it needs to do a pull
which requires the heads information.

Reviewed By: DurhamG

Differential Revision: D21296530

fbshipit-source-id: a81a61e3b58c921a3390fda8f716bd7ae0e55ed1
2020-05-12 10:23:23 -07:00
Jun Wu
b8f65b13ab clone: write repo hgrc early
Summary:
Move the logic to write repo hgrc ([paths]) and set [paths] config options
earlier, so other logic can use the [paths] config.

Some tests are changed because remotenames can now write bookmarks in more
cases.

Reviewed By: DurhamG

Differential Revision: D21011397

fbshipit-source-id: 4b921a02c20daeef31d44a03264a89b975303aa5
2020-05-12 10:23:22 -07:00
Jun Wu
d175b5c489 hggit: use transaction name to test initial clone
Summary:
"[paths] being empty" will no longer be a way to test initial clone, use
transaction name instead.

Reviewed By: DurhamG

Differential Revision: D21011395

fbshipit-source-id: e257fe8eb2efd45ac52fad7c74363151b0a8c417
2020-05-12 10:23:22 -07:00
Jun Wu
63872cfbae transaction: make transaction name available on transaction object
Summary: This will be used by hg-git to test initial clone.

Reviewed By: DurhamG

Differential Revision: D21011400

fbshipit-source-id: 11a1a41631830273a6407e419ebe5ff21964e7de
2020-05-12 10:23:22 -07:00
Jun Wu
192467dd38 clone: remove share.pool support
Summary: It is not used and makes the already complicated clone logic more complicated.

Reviewed By: DurhamG

Differential Revision: D21011394

fbshipit-source-id: 3620f7372a9f3cefc60618052c768c6c2cbe04f9
2020-05-12 10:23:21 -07:00
Jun Wu
96ebdf59ce remotefilelog: move stream_out wireprotocol to core
Reviewed By: DurhamG

Differential Revision: D21011398

fbshipit-source-id: c47307d06517e145837854db8e6bbec97b17e6bd
2020-05-12 10:23:21 -07:00
Jun Wu
a515f86575 remotefilelog: remove includepattern and excludepattern in wireproto
Summary:
They are not used. Remove it to make it a bit easier to move stream_out_shallow
to core.

Note: this does not remove all include/excludepatterns yet.

Reviewed By: DurhamG

Differential Revision: D21011403

fbshipit-source-id: f6d27a3e2472f6c69f95a958ac99f75a8b8f8b74
2020-05-12 10:23:21 -07:00
Jun Wu
76643816b3 remotefilelog: move "--shallow" command-line flag to core
Summary: It will be used in the next change.

Reviewed By: DurhamG

Differential Revision: D21011399

fbshipit-source-id: 6bdffc79af0474e42562686109417882a8cb2cd6
2020-05-12 10:23:20 -07:00
Mark Thomas
428ba0b5f8 commitcloud: add hg cloud hide command to remove things from cloud workspaces
Summary:
Add the `hg cloud hide` command.  This allows removal of commits, bookmarks and
remote bookmarks from a cloud workspace, even when the items are omitted
locally.

Reviewed By: DurhamG, quark-zju

Differential Revision: D21409384

fbshipit-source-id: 24b64c207c78f9b0258e9cf6a578db7b14c84901
2020-05-12 07:56:50 -07:00
Durham Goode
20c3f8b34d scuba: round bytes to the nearest useful value
Summary: This will reduce the amount of space they take in scuba.

Reviewed By: xavierd

Differential Revision: D21483472

fbshipit-source-id: 9de49dedef480932f8583dd17fe6625d222a3285
2020-05-11 21:31:05 -07:00
Jun Wu
99d288c1bd fsmonitor: write fsmonitor walk events to tracing data
Summary: This allows us to query tracing data for fsmonitor walk events.

Reviewed By: DurhamG

Differential Revision: D19797709

fbshipit-source-id: 1ff76dd6122cf56787e7928711f604f9c3d571cc
2020-05-11 16:56:18 -07:00
Ellis Hoag
1d0d626a36 Pass config object down to repack
Summary:
Pass `configparser::config::ConfigSet` to `repack` in
`revisionstore/src/repack.rs` so that we can use various config values in `filter_incrementalpacks`.

* `repack.maxdatapacksize`, `repack.maxhistpacksize`
  * The overall max pack size
* `repack.sizelimit`
  * The size limit for any individual pack
* `repack.maxpacks`
  * The maximum number of packs we want to have after repack (overrides sizelimit)

Reviewed By: xavierd

Differential Revision: D21484836

fbshipit-source-id: 0407d50dfd69f23694fb736e729819b7285f480f
2020-05-11 16:41:30 -07:00
Stanislau Hlebik
20017e96fe hgsql: check sqlrepolock in memcommit
Summary:
Let's not allow proceeding with memcommit if repo is locked. This what normal
push flow does, so we should allow it here as well.

Reviewed By: markbt

Differential Revision: D21502435

fbshipit-source-id: 80e665f065fb0cd882bc99482769a3de01d3de30
2020-05-11 12:47:10 -07:00
Mark Thomas
02e35c7039 commitcloud: remove indent from json.dumps args
Summary:
Commit cloud now uses `mercurial.json` rather than `json`.  This doesn't
support the `indent` arg, so remove this from the debug output when
`debugrequests` is enabled.

Reviewed By: farnz

Differential Revision: D21500306

fbshipit-source-id: ae436e9c32d1d2da432eeb93d114115ea80b825b
2020-05-11 09:12:08 -07:00
Xavier Deguillard
eb939cff57 remotefilelog: force hg bundle to use bundle version 3 with LFS
Summary:
When LFS is enabled, only bundle3 is supported, so we have to hack the exchange
code a bit in this case to always chose bundle3.

This is copied verbatim from the lfs extension.

Reviewed By: DurhamG

Differential Revision: D21459734

fbshipit-source-id: 41c867cec09e2485ec1e9d91545b61da568f4766
2020-05-07 21:50:00 -07:00
Andrey Tserkus
4334760f27 replaced hg sparse show with hg sparse in hg rage
Summary: This is according to the suggestion in the discussion referenced in the task. Per quark-zju we do need to change `rage` to use `hg sparse` rather than `hg sparse show`.

Reviewed By: quark-zju

Differential Revision: D21422005

fbshipit-source-id: 6dd0e20125635c7fb9b6ea6c9e2b35c8fb517d5d
2020-05-07 14:51:23 -07:00
Andrey Tserkus
ddc889b30a add status field to sparse show output json format
Summary: Added the `status` field to json in order to provide that information to the automated client, as well as match similar output of `hg status`.

Reviewed By: quark-zju

Differential Revision: D21421494

fbshipit-source-id: 2a8b80068f2068b09930b90c43252003421b324e
2020-05-07 14:51:23 -07:00
Andrey Tserkus
2baf56cf50 hg sparse show should not abort on missing profiles
Summary: Fixed that `hg sparse show` failed on missing profiles. Added them to be shown in the output with "!" symbol and in cyan color - which matches output of deleted files in `hg status`.

Reviewed By: quark-zju

Differential Revision: D21419278

fbshipit-source-id: 5581e67774686a5240dceb9aac428fac3b1b73c2
2020-05-07 14:51:22 -07:00
Mark Thomas
052e7c3877 check-code: convert to Python 3
Summary:
Update `contrib/check-code.py` to Python 3.

Mostly it was already compatible, however stricter regular expression parsing
revealed a case where one of our tests wasn't working, and as a result lots of
instances of `open(file).read()` existed that this test should have caught.

I have fixed up most of the instances in the code, although there are many
in the test suite that I have ignored for now.

Reviewed By: quark-zju

Differential Revision: D21427212

fbshipit-source-id: 7461a7c391e0ade947f779a2b476ca937fd24a8d
2020-05-07 09:07:50 -07:00
Mark Thomas
49166dbdfd format: apply latest Black formatting
Summary: Reformat using a newer version of Black.

Reviewed By: quark-zju

Differential Revision: D21426337

fbshipit-source-id: 1ac7f6e85a06feec0d41e9509eca09194f421a1d
2020-05-07 09:07:49 -07:00
Mark Thomas
8788654efd i18n: use _x to signal untranslated strings
Summary:
The latest version of Black removes unneccessary parenthesis.  Mercurial's
test-check-code currently uses extra parentheses to signal untranslated strings, so
Black's reformatting breaks this test.

Capitulate to Black by adding a new `_x` translation marker that means "untranslated".

Reviewed By: quark-zju

Differential Revision: D21426335

fbshipit-source-id: a6c26d7c6365c49530a7dee3a5f9ed71ff166835
2020-05-07 09:07:49 -07:00