Commit Graph

1633 Commits

Author SHA1 Message Date
Jun Wu
40fbbff9af pyrevlogindex: move non-Python logic to a pure Rust crate
Summary:
The idea is that the pure Rust revlogindex crate can implement the DagAlgorithm
interface so we will have a consistent interface in the code base that works
for both the existing storage (revlog) and the new segmented changelog.

The other way to do this is to implement the `bindings.dag.namedag` interface
in pure Python for the revlog-based DAG, or supporting quite different
interfaces (ex. revlog DAG and the Rust segmented changelog DAG) in the code
base. At present, I think implementing the Rust DAG traits for revlog is the
most appealing, partially because we already have some key algorithms
implemented (ex. prefix lookup, common ancestors, etc).

Reviewed By: sfilipco

Differential Revision: D21626197

fbshipit-source-id: 733b1af1bcd5fc0784764fc7103412988894d43b
2020-06-01 10:56:54 -07:00
Durham Goode
995a2852c1 configs: return bytes for config parsers validation results
Summary:
Previously the return type was String which, in Python 2, could turn into bytes or
unicode depending on the contents of the string. We always want bytes in Python
2, so let's use the Str type instead.

Reviewed By: quark-zju

Differential Revision: D21794189

fbshipit-source-id: 6493fbacab354a78476f522fc3c41b7336dbbdb1
2020-06-01 09:45:19 -07:00
Mark Thomas
b2285e0425 progress: add progress bars for edenfs checkout operations
Summary:
The checkout step for EdenFS can take a few seconds if the distance is large or
if EdenFS has to fetch data.  Reassure the user that something is happening
with a progress spinner.

Reviewed By: chadaustin

Differential Revision: D21684077

fbshipit-source-id: 43b8793f1a55ef6fb3bf78cabe3afcf2faed1d6c
2020-06-01 06:26:02 -07:00
Thomas Orozco
006864a6ce lfs v2: don't send empty batch requests
Summary:
We can skip the round trip to the server if we have nothing to ask or tell the
server.

Reviewed By: xavierd

Differential Revision: D21763025

fbshipit-source-id: 7f199c12ccaa0f66ce765dd976723e4002c5dd4e
2020-06-01 03:45:30 -07:00
Arun Kulshreshtha
0b4dc0f103 edenapi: add usage examples to make_req
Summary: Added comments showing the expected JSON input format for each kind of EdenAPI request.

Reviewed By: xavierd

Differential Revision: D21782765

fbshipit-source-id: bf08dd4b36a33aca506eb0fa0341e40d0150d7cb
2020-05-29 15:45:10 -07:00
Arun Kulshreshtha
10fa44290e edenapi: use array to specify keys in history requests
Summary: Update the JSON format for history requests to use an array rather than an object to represent keys, for the same reason as D21412989. (Namely, that it's possible for two keys to share the same path, making the path unsuitable for use as a field name in a JSON object.)

Reviewed By: xavierd

Differential Revision: D21782763

fbshipit-source-id: eb04013795d1279ecbf00a8a0be106318695bd05
2020-05-29 15:45:10 -07:00
Durham Goode
a9f8bbf176 treemanifest: always send draft commit trees
Summary:
We encountered an issue where an infinitepush bundle did not contain
trees for some of the commits it contained. This happened when multiple users
were working on the same branch.  Our previous heuristic decided to not send
trees if they weren't in the local store, but with us transitioning to Mononoke
(which enables draft commit data to be fetched ondemand) this invariant doesn't
always hold true.

Let's always upload trees for draft commits. Hopefully Mononoke can take over on
the server completely soon and we can get rid of all this special casing and do
normal discovery.

This is a revert of D7992502, but that was added because it was possible to pull
directly from svn which would result in public commits that didn't exist on the
server yet and therefore needed to send their trees.  Since svn is gone, this is
probably safe to change back.

Reviewed By: quark-zju

Differential Revision: D21697921

fbshipit-source-id: c1abaa061207222490b146ee52f7949be6fe4b2a
2020-05-29 13:21:05 -07:00
Jake Bailey (Hacklang)
9090d7bdf1 Use types from the oxidized_by_ref crate instead of the oxidized crate for to_oxidized
Summary: This diff replaces the use of the oxidized typechecker types in `to_oxidized`, replacing them with oxidized_by_ref definitions. This unblocks deleting typechecker types and decls from the oxidized crate, since they are used only in this debugging-only path. It also reduces the amount of conversion necessary for `to_oxidized` (since we need not convert the oxidized_by_ref structures the typechecker already uses, like `Ty`).

Differential Revision: D21587518

fbshipit-source-id: 5e7ec2237d0059070653b45d15eb7c1259588ccb
2020-05-28 22:19:13 -07:00
Xavier Deguillard
472ec19699 clienttelemetry: add wantslfspointers
Summary:
Rolling out LFSv2 on fbsource is a bit complex. Initially, the intent was to
roll it out via a server-only config and send pointers to say 5% of the
clients. The big snag in this is that LFS pointers are stored in Memcache, and
thus, a client who wasn't supposed to use LFS may end up reading a pointer from
Memcache, and issuing a request to the LFS server. Thanks to the way Memcache
works, this may lead to an avalance effect where everyone is fetching LFS
blobs, even if the server rollout is at a small percentage.

There are several solutions to this, the first obvious one would be to simply
not use Memcache for pointers, but that also means a forced connection to the
server, and a higher latency, ie: not a very desireable situation. An
alternative would be to have a proper capability exchange at connection time,
but that's unfortunately not feasible today due to the need to support the old
Mercurial server. Long term this is definitively the approach we want to go to,
and depending on the exchanged capabilities, we can even imagine using
different memcache keys automatically.

For now, we can hack this up by re-using the only free-form channel that the
client has to the server: clienttelemetry. Mononoke can then use the passed in
information to decide on whether to send LFS pointers (or not). This
unfortunately means that the rollout will be entirely client-side driven. To alleviate
the issue of Memcache keys being shared between clients wanting LFS pointers
and the ones not wanting them, a different Memcache key space will be used.

Reviewed By: StanislavGlebik

Differential Revision: D21765065

fbshipit-source-id: aebda3c567a827342b2fa96d374a06a23ea0ca34
2020-05-28 14:16:35 -07:00
Durham Goode
90c1f357ff configs: whitelist some configs from validation
Summary:
We're going to be changing the configs.* configs via chef as this rolls
out. Let's prevent them from being logged as mismatches.

Also updates the tree bfs config to match the current production value.

Reviewed By: quark-zju

Differential Revision: D21748693

fbshipit-source-id: b1d96f911d7ba7391546515179ac517fc62abe8b
2020-05-28 12:14:09 -07:00
Durham Goode
91a564560f configs: move hgrc list to fb internal module
Summary:
This list is going to grow to list all our rc files, which we don't
need in our public facing repo. Let's move this to a fb internal module.

Reviewed By: quark-zju

Differential Revision: D21747604

fbshipit-source-id: 8d72d8bf981c49b1e10260f5b0858729c1895da1
2020-05-28 12:14:08 -07:00
Durham Goode
0c5a19eaab configs: move Repo enum to fb/ module
Summary:
Let's hide the repo list in the fb/ module since we don't really want
to expose the whole repo list in our public repo.

Reviewed By: sfilipco

Differential Revision: D21731419

fbshipit-source-id: 22ca20a3a80637c852e313f1390849aac1fecbf4
2020-05-28 12:14:08 -07:00
Durham Goode
211ab6f99b configs: add remaining tier-specific rc's to dynamicconfig
Summary:
Adds support for posix, windows, and windows_sandcastle rc files.

This should be low risk, as the dynamic config validator will remove any
incorrect configs before they are used.

Reviewed By: sfilipco

Differential Revision: D21731056

fbshipit-source-id: 0ab8c60906abc2e8d552509462a70a499a52cf86
2020-05-28 12:14:08 -07:00
Durham Goode
1e802fdfd6 configs: add most tier-specific rc's to dynamicconfig
Summary:
Adds support for most files from fb/staticfiles/etc/mercurial/tier-specific
It's missing the windows, posix, and tupperwar files, which I'll do in a later
diff.

This should be low risk, as the dynamic config validator will remove any
incorrect configs before they are used.

Reviewed By: quark-zju

Differential Revision: D21692664

fbshipit-source-id: 9b056640edc880bc683eb331921d08ac24212d59
2020-05-28 12:14:07 -07:00
Tao Zhao
b54708627b scm-prompt.sh: optionally show dirty state of working directory
Summary:
Added an optional feature to scm-prompt.sh to show the dirty state of the working directory.

Users need to opt in by set the environmental variable `SHOW_DIRTY_STATE` to yes (or whatever nonempty string) in their shell rc file. The idea is that users who do not need/want this feature should see minimal performance hit of their prompt.

Unfortunately, in some (large) repos, calling `hg status` or `git diff` to figure out the dirty state can slow down showing the prompt quite a bit. So, in this case, user can opt out individual repo by setting `shell.showDirtyState` in .hg/hgrc or .git/config.

Reviewed By: ahornby

Differential Revision: D21493543

fbshipit-source-id: 13f7cf2dd2f8d00b58cf2a63dc2cbbf770028411
2020-05-28 10:24:52 -07:00
Jun Wu
14b3c2e0f0 dag: move from_ascii to traits
Summary:
This adds flexibility. Now every type that implements DagAddHeads, including
NameDag, can import ASCII graphs.

Reviewed By: sfilipco

Differential Revision: D21626213

fbshipit-source-id: e258d88f97cbcc9aaf98d353a929803325185df7
2020-05-27 12:16:48 -07:00
Jun Wu
bd6c6fe18b dag: implement IdConvert on Dag structs
Reviewed By: sfilipco

Differential Revision: D21626214

fbshipit-source-id: 90d5a587e42340ac2b0f0b3f35f3bc084e969d40
2020-05-27 12:16:48 -07:00
Jun Wu
be5e3a20b4 dag: IdMapLike -> IdConvert
Summary: The trait was about converting between Id and VertexName. Rename to clarify.

Reviewed By: sfilipco

Differential Revision: D21626195

fbshipit-source-id: 874ca4ca3a1467084a08c6d9aa321201974e1978
2020-05-27 12:16:47 -07:00
Jun Wu
64dc05ab9d dag: move add_heads, flush, add_heads_and_flush to traits
Summary: This allows other kinds of DAG to implement the operations.

Reviewed By: sfilipco

Differential Revision: D21626220

fbshipit-source-id: 896c5ccebb1672324d346dfca6bcac9b4d3b4929
2020-05-27 12:16:47 -07:00
Jun Wu
4934987796 dag: implement PrefixLookup for Dag, MemDag and MemIdMap
Summary: This makes things a bit more flexible.

Reviewed By: sfilipco

Differential Revision: D21626194

fbshipit-source-id: f3ad486bcd5a6478d9e00f674d48f99504cded8c
2020-05-27 12:16:46 -07:00
Jun Wu
26217dcdb5 dag: move hex prefix lookup to a trait
Summary: This makes it possible for other types to implement the hex prefix lookup.

Reviewed By: sfilipco

Differential Revision: D21626218

fbshipit-source-id: 96e8b8c37e5aae2bd60658a238333b61902936d1
2020-05-27 12:16:46 -07:00
Jun Wu
577c9442bb dag: add VertexName::from_hex
Summary: It will be used in the next change.

Reviewed By: sfilipco

Differential Revision: D21626207

fbshipit-source-id: bbef70ef9d4f9aaa2039a6bc15d296e88db7f8dc
2020-05-27 12:16:46 -07:00
Jun Wu
38cc83e1bf dag: add short aliases for main public types
Summary:
Types like IdDag are not really used. The use of the word "name" is sometimes
confusing in other context. Therefore export shorter names like Dag, MemDag,
Vertex, avoid "name" in NameDag, MemNameDag and NameSet. This makes external
code shorter and less ambiguous.

Reviewed By: sfilipco

Differential Revision: D21626212

fbshipit-source-id: 5bcf3cecfd38277149b41bf3ba9e6d4ef2a07b2b
2020-05-27 12:16:45 -07:00
Jun Wu
e0d11803f2 dag: move DagAlgorithm to an independent trait
Summary:
This decouples DagAlgorithm from the IdMap + IdDag backend, making it possible
to support other kinds of backends of DagAlgorithm (ex. a revlog backend).

Reviewed By: sfilipco

Differential Revision: D21626200

fbshipit-source-id: f53cc271a200062e9c02f739b6453e1d7de84e6d
2020-05-27 12:16:45 -07:00
Durham Goode
8ed66bc3fc pyrevisionstore: fix unused code warnings
Summary:
When we got rid of the delta logic, we also needed to get rid of some
unused functions.

Reviewed By: singhsrb

Differential Revision: D21725043

fbshipit-source-id: ac069e6b0468e2275f353a9970b8971b5a2cfa23
2020-05-26 18:09:22 -07:00
generatedunixname89002005307016
f9358e566a suppress errors in eden - batch 1
Summary:
This diff is auto-generated to upgrade the Pyre version and suppress errors in eden. The upgrade will affect Pyre local configurations in the following directories:
```
eden
```

Differential Revision: D21687853

fbshipit-source-id: baf0d9bc33f86da63ea289690faca6cf4d566588
2020-05-21 19:32:35 -07:00
Zeyi (Rice) Fan
8b49918ce1 add a fake remotestore to enable memcache
Summary:
xavierd and I realized that memcache is not actually enabled in EdenFS as `ContentStoreBuilder` only sets it when there is are remote store. We believe turning on memcache store can help us improve some performance for importing blobs (80% hit rate).

This diff adds a noop remote store that does nothing to trick `ContentStoreBuilder` to include the memcache store. We decided to go this way instead of modifying `ContentStoreBuilder` is because EdenFS is going to have a real remotestore very soon, and changes to `ContentStoreBuilder` may have some impact on how Mercurial uses it.

Reviewed By: xavierd

Differential Revision: D21621234

fbshipit-source-id: 5502e001ab498134b6a927d83be823261e70e9e1
2020-05-21 16:32:42 -07:00
Durham Goode
1d770d8e17 config: fix dynamic config overriding non-subset final value
Summary:
There was a bug where if the dynamicconfig chose a value that matched
one of the ported rc files, but it did not match the final value of that config
(from a not-yet-ported rc file), it would chose the dynamicconfig value instead
of the original final value. Let's drop the dynamicconfig value in this case as
well.

Reviewed By: quark-zju

Differential Revision: D21674469

fbshipit-source-id: efcd36e9602e16210999ec8c88e86b1d7ee355e4
2020-05-21 10:41:11 -07:00
Mateusz Kwapich
d5e4d169f3 tests: fix tweakdefault tests
Summary: I didn't update it on my last diff.

Reviewed By: xavierd

Differential Revision: D21687344

fbshipit-source-id: 01c9662b9fd8c4670c2af34a999c69e6b93ed7f7
2020-05-21 08:44:39 -07:00
Mateusz Kwapich
611edcf4d7 histedit: improve compatibility with mutation&visibility
Summary:
When markbt converted histedit to be compatible with new style mutation
he missed a few spots.

This diffs adds a large test checking the that all the scenarios that were
supported with obsmarkers are supported with mutation now.

Reviewed By: markbt

Differential Revision: D21665484

fbshipit-source-id: a8a289910adb068a382e32f9d106dedc1573d413
2020-05-21 04:25:06 -07:00
Mateusz Kwapich
6a1760ea32 amend: on --to provide the correct argument to histedit
Summary:
The histedit goes down to the latest branching point by default which is not
always the right choice for `amend --to`

Reviewed By: markbt

Differential Revision: D21665485

fbshipit-source-id: d981d2216b5384f61c0082684eafa1e84eaeada8
2020-05-21 04:25:05 -07:00
Mateusz Kwapich
ba176f6937 amend: show the bug in amend --to
Summary:
This test addtion showcases a bug in `amend --to` when
a side branch is present

Reviewed By: markbt

Differential Revision: D21665486

fbshipit-source-id: 8c21e7a8cccfc6c313d3b7aa09be8309a662b9cc
2020-05-21 04:25:05 -07:00
Durham Goode
0ef51f2f5c config: fix test-debugdynamicconfig.t on Windows
Summary: I had hardcoded the path separator, which is wrong on Windows.

Reviewed By: singhsrb

Differential Revision: D21679423

fbshipit-source-id: 309c84b0698355654baee1dae7f201310e695c49
2020-05-20 18:48:58 -07:00
Xavier Deguillard
ee81495b3d revisionstore: handle empty proxy
Summary:
If either the config, or the environment variable is empty, the URL parsing
would raise an error, while the intent is to not have proxy. Let's handle it
properly.

Reviewed By: DurhamG

Differential Revision: D21669922

fbshipit-source-id: 84c8d09242ac8d5571f7592d874f4954692110f5
2020-05-20 14:03:50 -07:00
Durham Goode
3c8eb75a26 tests: fix test-debugdynamicconfig.t on Windows
Summary:
Looks like echo prints a \r\n which messes up the output. Let's use
printf to force it to use \n

Reviewed By: xavierd

Differential Revision: D21670125

fbshipit-source-id: f991c9c9fb55720bb68a3f71e8ddd3b4f16b5375
2020-05-20 14:00:54 -07:00
Durham Goode
98d428929b config: fix config validation at clone time
Summary:
At clone time we apply dynamic configs in memory, instead of loading
them from disk. The validation logic operated on the config value's location
field, which isn't set for data that comes from in memory. So we need to update
the validation logic to also consider the value source if location is not set.

Reviewed By: quark-zju

Differential Revision: D21664205

fbshipit-source-id: 8460c58c6d654780048de51ada8178c70ff0a9e6
2020-05-20 13:35:28 -07:00
Durham Goode
75c96be5ff configs: don't write dynamic config if it hasn't changed
Summary:
We kick off a background process every 15 minutes or so to compute the
new dynamicconfig. If the config hasn't changed, we should just touch the file
instead of rewriting the whole thing.

Reviewed By: quark-zju

Differential Revision: D21653098

fbshipit-source-id: 9d53d2a636cff082cd048994255cc809ce1b0221
2020-05-20 13:35:28 -07:00
Durham Goode
9f6f200a08 configs: version dynamic configs
Summary:
If we release a new version of Mercurial, we want to ensure that it's
builtin configs are used immediately. To do so, let's write a version number
into the generated config file, and if the version number doesn't match, we
force a synchronous regeneration of the config file.

For now, if regeneration fails, we just log it. In the future we'll probably
throw an exception and block the user since we want to ensure people are running
with modern configuration.

Reviewed By: quark-zju

Differential Revision: D21651317

fbshipit-source-id: 3edbaf6777f4ca2363d8617fad03c21204b468a2
2020-05-20 13:35:28 -07:00
Mark Thomas
c1e91b47fc cmdutil: remove graph-renderer hint
Summary: This hint has served its purpose.  Remove it.

Reviewed By: farnz

Differential Revision: D21658927

fbshipit-source-id: 0395fa2cb898732b2c64154104c703a428f62864
2020-05-20 08:06:21 -07:00
Durham Goode
f0d7044aff configs: apply dynamicconfig during clone
Summary:
During clone the hgrc.dynamic file doesn't exist and doesn't even have
a place for us to generate it to. Let's instead generate and apply the config in
memory.

In the future, if generate fetches data from the network, this will mean clone
would depend on the network, since if generate fails the clone would fail. In
some situations this is desirable, since users shouldn't be cloning without our
approved configs, but if it causes problems we could probably tweak generate to
support an offline mode.

Reviewed By: quark-zju

Differential Revision: D21643086

fbshipit-source-id: d9a758207738d5983213d95725061517e0aa17db
2020-05-19 19:51:27 -07:00
Jun Wu
428cfc7b6b tests: update test-extensions.t
Summary:
The Rust version command does not support `-T` and does not read
`__version__.py`. Remove tests about them. As we're here, also remove tests
about 3rd-party extension version checking as we bundle all extensions.

Reviewed By: xavierd

Differential Revision: D21648591

fbshipit-source-id: 97c9e2ff3d224ff12b34801a1af07532d9e9bff5
2020-05-19 19:09:56 -07:00
Meyer Jacobs
341fbdc1aa debugging: Implement "debugdetectissues" command for detecting signs of repository issues
Summary:
Implements a "debugdetectissues" command, which runs a series of checks on the repository meant to detect potential issues, logging the data to Scuba so that we can determine how common certain issues are, and under what conditions they appear.

Future extensions of this change may involve merging the functionality into hg doctor, and setting the command to run automatically in the background on some interval.

Reviewed By: DurhamG

Differential Revision: D21558170

fbshipit-source-id: a878ae1804d5f11c83a574e0dc3c802b564d2ced
2020-05-19 18:11:29 -07:00
Stefan Filip
60966c93e7 autocargo: regenerate
Summary: maintenance

Reviewed By: StanislavGlebik

Differential Revision: D21640322

fbshipit-source-id: d0b2ce604735c05d540d06835c8e4c8a940fbf5c
2020-05-19 16:08:40 -07:00
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
Mark Thomas
9e3a321235 windows: fix test-pager.t
Summary:
Setting the fake pager in the pager test doesn't work on Windows.

For some reason, the `pager.pager=C:/path/to/python.exe C:/path/to/test/fakepager.py` triggers
some kind of PATH translation code that results in `setconfig.py` receiving
`pager.pager=C;C:\\path\\to\\python.exe C;C:\\path\\to\\test\\fakepager.py` as its
argument.  This is clearly invalid, so the test fails with messages like
`'C' is not recognized as an internal or external command`.

Workaround this for now by setting the pager by appending directly to HGRCPATH.

Reviewed By: ikostia

Differential Revision: D21638507

fbshipit-source-id: e8a6b0c281030b23302116a79ef3ba754d37f601
2020-05-19 06:13:53 -07:00
Jun Wu
88a9982eb6 hgcommands: make version a native command
Reviewed By: DurhamG

Differential Revision: D19803761

fbshipit-source-id: 32f77cc667375e537e1ff70316329251359ae6ed
2020-05-18 18:50:42 -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
Xavier Deguillard
97a90e7de9 revisionstore: add doc comment
Summary:
We didn't have a high level overview of the types and traits and their
purposes, add that.

Reviewed By: DurhamG

Differential Revision: D21599759

fbshipit-source-id: 18e8d23ed00134f9d662778eddaee4a9451f7c2c
2020-05-18 12:11:52 -07:00