Commit Graph

1255 Commits

Author SHA1 Message Date
Xavier Deguillard
01e921aa19 crecord: fix windows arrow keys
Summary:
For whatever reason, ncurses doesn't interpret the arrow keys properly... Use
whatever is returned from it instead.

Reviewed By: kulshrax

Differential Revision: D20821432

fbshipit-source-id: 019426a1333538a479fb3dd8d147fb9cb4ba6559
2020-04-03 08:26:26 -07:00
Jun Wu
4ae44e316a remotenames: move repo._accessedbookmarks to core repo._remotenames._accessedbookmarks
Summary:
Move the attribute so it won't cause an AttributeError when remotenames is not
enabled.

As we're here, also move it to repo._remotenames from repo. This makes the repo
object a bit clearner and avoids loading the accessed bookmarks if remotenames
are not accessed at all.

Reviewed By: singhsrb

Differential Revision: D20821070

fbshipit-source-id: b5a01016451ee202f778cadb2dd418400406fa6b
2020-04-02 19:25:33 -07:00
David Tolnay
1a86366f0e third-party/rust: Turn off async-trait/support_old_nightly
Summary:
This diff turns off the support_old_nightly feature of async-trait (https://github.com/dtolnay/async-trait/blob/0.1.24/Cargo.toml#L28-L32) everywhere in fbcode. I am getting ready to remove the feature upstream. It was an alternative implementation of async-trait that produces worse error messages but supports some older toolchains dating back to before stabilization of async/await that the default implementation does not support.

This diff includes updating async-trait from 0.1.24 to 0.1.29 to pull in fixes for some patterns that used to work in the support_old_nightly implementation but not the default implementation.

Differential Revision: D20805832

fbshipit-source-id: cd34ce55b419b5408f4f7efb4377c777209e4a6d
2020-04-02 17:01:24 -07:00
Thomas Orozco
56251513bf git-sl: remove Mercurial import
Summary:
This isn't actually a Mercurial extension, so we can't be importing Mercurial
imports here. I'm not sure this is actually being used because we apparently
have 2 copies of this (see D20793452, which is also how I came upon this), but
it's probably worth not breaking it.

Reviewed By: farnz

Differential Revision: D20794695

fbshipit-source-id: daaf0f5822567b55a787669073421fd1ce604e08
2020-04-02 12:32:34 -07:00
Durham Goode
9976df9010 watchman: keep using watchman even if there are state-enter/leave errors
Summary:
We've seen a number of recent cases where hg stops using watchman for
status because state-enter or state-leave fail because multiple enters or leaves
are called out of order. The root cause needs to be found, but in the mean time
we should not allow such errors to block of from using watchman entirely.

Let's eat these gracefully and just log that the issue happened.

Reviewed By: quark-zju

Differential Revision: D20807004

fbshipit-source-id: 517d9562febc226ce7db836435ca2ca9db1c68fb
2020-04-02 11:42:59 -07:00
Xavier Deguillard
a7e5557baa test: properly set ui.ssh
Summary:
On Windows, we have to do a bit of dance for Windows to stop complaining
about ui.ssh.

Reviewed By: DurhamG

Differential Revision: D20817712

fbshipit-source-id: acbda636fe114fd616dee89b2c4d1c9ff26470bf
2020-04-02 11:26:54 -07:00
Xavier Deguillard
e7c31f21a4 remotefilelog: set umask when creating the rust stores
Summary:
On shared devservers, all users in svnusers should be able to read/write onto
the stores, set the umask to properly reflect this.

Reviewed By: ikostia

Differential Revision: D20817266

fbshipit-source-id: 8a865f499a35313afd3cbeb5f989175862a3549f
2020-04-02 10:42:40 -07:00
Jun Wu
6e7cffbda4 chg: disable chg when file paths like /proc/self/... are used
Summary: This will allow bash users to use things like `hg commit -l <(echo foo)`.

Reviewed By: krallin

Differential Revision: D20810653

fbshipit-source-id: 42e420e608d41704387a9011cf14a28f92192e5d
2020-04-02 10:09:50 -07:00
Thomas Orozco
d225cb2910 remotenames: don't throw on hidden nodes
Summary:
This updates fastheaddiscovery to use an unfiltered repository when it attempts
to check if the nodes the server sent are present locally.

Reviewed By: quark-zju

Differential Revision: D20792006

fbshipit-source-id: 14ba9605d79ba54f3f4143d6d8ec65357e3d8c07
2020-04-02 08:53:48 -07:00
Jun Wu
2aec2dbcb6 commitcloud: migrate to tech-debt-free repo.pull for pulling
Summary:
The new API does nothing that cloud sync does not want: bookmarks, obsmarkers,
prefetch, etc. Wrappers to disable features are removed.

This solves a "lagged master" issue where selectivepull adds `-B master` to
pull extra commits but cloud sync cannot hide them without narrow-heads. Now
cloud sync just does not pull the extra commits.

Reviewed By: sfilipco

Differential Revision: D20808884

fbshipit-source-id: 0e60d96f6bbb9d4ce02c04e8851fc6bda442c764
2020-04-01 19:40:57 -07:00
Jun Wu
22295e45bb tests: add another test demostrating the lagged master issue
Summary:
With selective pull (now in core) enabled and narrow-heads disabled,
there is another way to cause lagged master.

Reviewed By: sfilipco

Differential Revision: D20808885

fbshipit-source-id: ebaed0e203f2f9f981bf141ce6c82af33710ba53
2020-04-01 19:40:57 -07:00
Jun Wu
07fc8adad9 commitcloud: sort hashes being pulled
Summary: This makes the upcoming change easier to verify.

Reviewed By: sfilipco

Differential Revision: D20808883

fbshipit-source-id: 5563601125ef5c961785f7275fd82fc3fefe53ff
2020-04-01 19:40:56 -07:00
Jun Wu
e2af876a45 remotenames: fix pull race conditions
Summary:
We have seen one report that the race condition caused lagged remote/master.

The race condition is:
- pull everything: get all commits, but not remotenames.
- expull: get all remotenames. Some point to new commits received by the
  server that are unknown to the client. The client ignores them.

This diff adds a double check to pull again if it sees remotenames pointing
to unknown nodes.

This won't be necessary if we migrate everyone to selectivepull, and clean up
the pull command to use the race-free repo.pull API. Because the new code path
will first query the bookmarks, then pull the heads explicitly.

Reviewed By: DurhamG

Differential Revision: D20703268

fbshipit-source-id: 42bd0201c3c4f709f25ad0fea3a191db9991e4fc
2020-04-01 19:40:56 -07:00
Jun Wu
5730719bd9 revset: automatically pull remote bookmarks prefixed remote/ or default/
Summary:
This makes it possible to do things like `hg up remote/foo` without having to
`hg pull -B foo` first.

Reviewed By: DurhamG

Differential Revision: D20531122

fbshipit-source-id: e95b2f0a49e4b815c136450d1f352a7973cb72ed
2020-04-01 19:40:55 -07:00
Jun Wu
707b7dea42 localrepo: add a tech-debt-free repo.pull API
Summary:
The new `repo.pull` API aims to be tech-debt free. It does:
- Pull nothing instead of everything if nothing is specified.
- Update remote names that are explicitly specified, not everything the server
  has.
- Do not update local bookmarks.

The direct motivation is to implement autopull `remote/foo` behavior while not relying on the pull command.

Reviewed By: DurhamG

Differential Revision: D20531119

fbshipit-source-id: 80c3bdd5556126d81af099a74f1345ecc94904b7
2020-04-01 19:40:55 -07:00
Jun Wu
bd4ac25e5f infinitepush: move listkeyspatterns to core
Summary: This will be used by the next diff.

Reviewed By: DurhamG

Differential Revision: D20661056

fbshipit-source-id: 3b4793bc0737bd64196da5b99c2d4da6f5e48efb
2020-04-01 16:58:33 -07:00
Stefan Filip
325fed7e50 tests: add histedit test with simple reorder
Summary: Debugging an issue where watchman returns a state error during histedit.

Reviewed By: quark-zju

Differential Revision: D20785858

fbshipit-source-id: 5baf762d1a5588573df9d01c63a24e751e04a811
2020-04-01 14:02:34 -07:00
Mark Thomas
04a400b5eb commitcloud: handle missing remotebookmarks in commitcloud lastsyncstate
Summary:
During the roll-out of commitcloud remotebookmarks sync, some clients may have it enabled, and others may have it disabled.

This can result in some clients having an empty set of remotebookmarks in their sync state for a version which actually
does have remotenames in the cloud workspace.

This becomes a problem when those clients start syncing remotebookmarks, for two reasons:

* They are unable to correctly apply the new cloud remotebookmarks, as they do not have the previous state with which to break ties, and the tie-breaking code doesn't work correctly if the old cloud remotebookmark is `None`.

* When they try to send the remotebookmarks delta to the server, they don't have the old state, and so compute the delta incorrectly.  This results in `Duplicate entry for key` errors in the service.

We can handle this as follows:

* When syncing remote bookmarks from the cloud, ensure we correctly apply the remote bookmark updates, even if the old cloud remotebookmark is `None`.

* If the local repo is up-to-date with respect to the workspace, but the last sync state had no remote bookmarks recorded, sync the remote bookmarks again.  This may involve pulling some more commits if the cloud remote bookmarks are ahead of the local remote bookmarks. If there truly were no remote bookmarks then this will be a no-op.

Reviewed By: quark-zju

Differential Revision: D20792360

fbshipit-source-id: cd1ed371d8d5b1be2767c8a8d4836ea870a4467b
2020-04-01 13:26:27 -07:00
Mark Thomas
245678565c commitcloud: add test demonstrating remotebookmarkssync problems
Reviewed By: krallin

Differential Revision: D20796685

fbshipit-source-id: 0bb0efac14d56b715fb81824956752bef874d2b5
2020-04-01 13:26:26 -07:00
Alden Hu
64b98944d1 git-sl supports worktrees
Summary:
git started printing a "+" sign in front of a branch checked out in another worktree:
ab3138146f

and it breaks "git sl"

removing "+" the same way as "*" when parsing "git branch" result to resolve.

Reviewed By: krallin

Differential Revision: D20793452

fbshipit-source-id: 5c0b6be5afbed607b144c652f68a3ab93052f76a
2020-04-01 09:25:27 -07:00
Mark Thomas
0d4db87a26 cmdutil: add a hint for the new graph renderer
Summary: Add a hint that points to customization and troubleshooting guides for the new graph renderer.

Reviewed By: xavierd

Differential Revision: D20763338

fbshipit-source-id: ee6d2464ae5955f0f0bf52d1994adfa2b74b3367
2020-03-31 09:57:44 -07:00
Xavier Deguillard
2ce3c6784b revisionstore: make ContentStore::sha256 infallible
Summary:
Instead of using Sha256::from_slice, just use Sha256::from with a correctly
sized array.

Reviewed By: quark-zju

Differential Revision: D20756181

fbshipit-source-id: 17c869325025078e4c91a564fc57ac1d9345dd15
2020-03-31 08:12:45 -07:00
Adam Simpkins
b31c991c00 update the hg status fast-path to print errors reported by EdenFS
Summary:
Update `hg status` to print errors that were returned by EdenFS's
getScmStatusV2() call, and to exit unsuccessfully if there were any errors.

Previously errors were silently ignored.

Reviewed By: quark-zju

Differential Revision: D19958503

fbshipit-source-id: cb3109df40eb86a5bf7e3818ddfb8da74d670405
2020-03-30 19:24:22 -07:00
Adam Simpkins
ba42390257 fix hg status path relativization in tests on Windows
Summary:
Fix the `test_status()` function to properly canonicalize the input paths, so
that it works successfully on Windows.  Previously this function would fail on
Windows as some paths would end up as UNC-style paths and some would be plain
paths, causing the equality comparison to fail even though the paths were
equivalent.  This canonicalizes the repo path so that they both use the same
format.

Reviewed By: quark-zju

Differential Revision: D20662921

fbshipit-source-id: fdd36bac755f9694b4a482615d3dca43ff21e05e
2020-03-30 19:24:22 -07:00
Xavier Deguillard
22f524664e revisionstore: use Arc<Self> as receiver for remote store traits
Summary:
All of the callers are already using an Arc, so instead of forcing the remote
store to be cloneable, and thus wrap an inner self with an Arc, let's just pass
self as an Arc.

Reviewed By: DurhamG

Differential Revision: D20715580

fbshipit-source-id: 1bef23ae7da7b314d99cb3436a94d04134f1c0e4
2020-03-30 14:45:49 -07:00
Xavier Deguillard
6b1940f294 revisionstore: add fallback if LFS server is down
Summary:
When LFS will be enabled on fbsource, the enablement will rolled out server,
with the server serving pointers (or not). In the catastrophic scenario where
Mononoke has to be rolled out, the Mononoke LFS server will be unable to serve
blobs, but some clients may still have LFS pointers locally but not the
corresponding blob. For this, we need to be able to fallback to fetching the
blob via the getpackv2 protocol.

Reviewed By: DurhamG

Differential Revision: D20662667

fbshipit-source-id: 4ac45558f6d205cbd1db33c21c6fb137a81bdbd5
2020-03-30 14:45:48 -07:00
Xavier Deguillard
e7b5eb81d9 remotefilelog: add lfs fetching retry logic
Summary:
The LFS server might be temporarily having issues, let's retry a bit before
giving up.

Reviewed By: DurhamG

Differential Revision: D20686659

fbshipit-source-id: 90dabd19e45a681d6eae5cd50c72b635d44c0517
2020-03-30 14:45:48 -07:00
Xavier Deguillard
f06132def2 configparser: add FromConfigValue for floats
Summary:
Since we have all the integer types, let's also allow float types in the
config.

Reviewed By: kulshrax

Differential Revision: D20697007

fbshipit-source-id: 21fa264d24c0f63c233f47c3bcfb2448b4c05c70
2020-03-30 14:45:48 -07:00
Xavier Deguillard
0f3c04abfe remotefilelog: add a remotefilelog LFS test
Summary:
This demonstrates that both the legacy extension and the new implementation can
co-exist, and we can enable/disable the new extension.

Reviewed By: DurhamG

Differential Revision: D20677443

fbshipit-source-id: 10896023f536984645371d557c3ad20daa8526dd
2020-03-30 14:45:47 -07:00
Xavier Deguillard
15c81cd54f revisionstore: repack even when having one packfile
Summary:
When repacking for the purpose of file format changes, a single packfile may
contain data that needs to be moved out of it, and thus, we need to do a repack
then.

Reviewed By: DurhamG

Differential Revision: D20677442

fbshipit-source-id: c621dd2e657f5a4565b37d4b029731415b899117
2020-03-30 14:45:47 -07:00
Xavier Deguillard
e0cfd08e7f revisionstore: properly implement get_missing for remote stores
Summary:
Remotestores can implement get_missing properly by simply querying the
underlying store that they will be writing to. This may prevent double fetching
some blobs in `hg prefetch` that we already have.

Reviewed By: DurhamG

Differential Revision: D20662668

fbshipit-source-id: 22140b5b7200c687e0ec723dd8879dc8fbea6fb9
2020-03-30 14:45:47 -07:00
Xavier Deguillard
e1ccc29eec revisionstore: add an is_local method to the IndexedLog abstraction
Summary:
There are cases where the user of the abstraction needs to know if this is a
local store, this will simplify the caller code.

Reviewed By: DurhamG

Differential Revision: D20662666

fbshipit-source-id: e0bde7eb0dc3484979732a7c4cdf888fedc70e13
2020-03-30 14:45:46 -07:00
Xavier Deguillard
8ed454845a revisionstore: auto-sync the LFS blobs store
Summary:
By regularly flushing the blob store, we avoid keeping too many LFS blobs in
memory, which could cause OOM issues.

The default size is chosen to be 1GB, but is configurable for more control.

Reviewed By: DurhamG

Differential Revision: D20646213

fbshipit-source-id: 12c06fd0212ef3974bea10c82026b6e74fb5bf21
2020-03-30 14:45:46 -07:00
Xavier Deguillard
5ea2e581c6 revisionstore: store LFS blobs in an IndexedLog
Summary:
In the legacy lfs extension, LFS blobs were stored as loosefiles on disk, and
as we saw with loosefiles for remotefilelog, they can incur a significant
overhead to maintain. Due to LFS blobs being large by definition, the number of
loose LFS blobs should be reasonable for repack to walk over all of them to
chose which one to throw away.

A different approach would be to simply store the blobs in an on-disk format
that allows automatic size management, and simple indexing. That format is an
IndexedLog. This of course doesn't come without drawbacks, the main one being
that the IndexedLog API mandate that the full blob is present on insertion,
preventing streaming writes to it, the solution is to simply chunk the blobs
before writing them to it. While proper streaming is not done just yet, the
storage format no longer prevent it from being implemented.

Reviewed By: DurhamG

Differential Revision: D20633783

fbshipit-source-id: 37a88331e747cf22511aa348da2d30edfa481a60
2020-03-30 14:45:46 -07:00
Arun Kulshreshtha
91e76774fe edenapi: fix typo in logging
Reviewed By: sfilipco

Differential Revision: D20744831

fbshipit-source-id: 194e550d88c33ed9601d2f24fea281996696087b
2020-03-30 14:39:42 -07:00
Jun Wu
6bddc1df08 rotatelog: avoid loading broken Logs multiple times
Summary:
RotateLog loads older logs lazily. If an older log is broken, remember that and avoid
loading the broken log again.

Reviewed By: DurhamG

Differential Revision: D20663899

fbshipit-source-id: 7a4b5279cc6387c19329a51048bfe1be2e0bc1f8
2020-03-30 11:34:49 -07:00
Thomas Orozco
250695ba9b rage: disable colors
Summary:
This updates hg rage to disable colors while producing the hg rage. This makes
the pastes a little more readable since they won't contain escape codes.

Reviewed By: farnz

Differential Revision: D20738945

fbshipit-source-id: e323834beb6458083642e34a40afa3d896288b42
2020-03-30 11:31:33 -07:00
Xavier Deguillard
2c052d055d eden: commitpending doesn't exist in ContentStore
Summary:
Instead, it's present in the fileslog. Use that instead.

This is the error I just got while doing a `hg top`:
error updating fbcode/eden/scm/lib/revisionstore/src/contentstore.rs: facebook::eden::HgImportPyError: AttributeError: 'bindings.revisionstore.contentstore' object has no attribute 'commitpending'

Reviewed By: quark-zju

Differential Revision: D20715560

fbshipit-source-id: 59c4b62ae8d0f182824e126e68b174c0ef3cdba0
2020-03-30 09:05:36 -07:00
Xavier Deguillard
fd72344578 revisionstore: feature gate the Mononoke LFS tests
Summary:
Due to the Mononoke LFS server only being available on FB's network, the tests
using them cannot run outside of FB, including in the github workflows.

Reviewed By: quark-zju

Differential Revision: D20698062

fbshipit-source-id: f780c35665cf8dc314d1f20a637ed615705fd6cf
2020-03-30 08:40:43 -07:00
Stefan Filip
ea89b541e1 segmented_changelog: add Dag struct and location_to_name functionality
Summary:
The IdDag provides graph algorithms using Segments.
The IdMap allows converting from the SegmentedChangelogId domain to the
ChangesetId domain.
The Dag struct wraps IdDag and IdMap in order to provide graph algorithms using
the common application level identifiers for commits (ChangesetId).

The construction of the Dag is currently mocked with something that can only be
used in a test environment (unit tests but also integration tests).

This diff also implements a location_to_name function. This is the most
important new functionality that segmented changelog clients require. It
recovers the hash of a commit for which the client only has a segmented
changelog Id. The current assumption is that clients have identifiers for all
merge commit parents so the path to a known commit always follow a set
of first parents.

The IdMap queries will have to be changed to async in the future, but IdDag
queries we expect to stay sync.

Reviewed By: quark-zju

Differential Revision: D20635577

fbshipit-source-id: 4f9bd8dd4a5bd9b0de55f51086f3434ff507963c
2020-03-27 13:48:52 -07:00
Stefan Filip
7502ce31ca dag: add in process stored IdMap constructor
Summary: The interesting observation is that InProcessStore is not public.

Reviewed By: quark-zju

Differential Revision: D20635578

fbshipit-source-id: a0149929c8059ff77f047fd385bf3b26dc738dfd
2020-03-27 13:48:51 -07:00
Jun Wu
9fe0bfd7c8 narrowheads: fix directaccess compatibility
Summary:
Similar to the previous diff.  Sometimes the narrow-heads config is on but the
dependencies are off (ex. remotenames, visibility). In that case narrow-heads
should be considered off. The repo init function takes care of that but code
paths before repo init needs special care.

Reviewed By: simpkins

Differential Revision: D20699684

fbshipit-source-id: befac335bde0be6b8a42a5a9f7cee1edbbef3c55
2020-03-27 12:55:07 -07:00
Jun Wu
ebdc3836b9 narrowheads: fix repo requirements at "hg init" time
Summary:
Some tests fail because `hg init` sets the wrong initial store requirements and
then perform a narrow-head migration down, which prints extra messages. Fix them
by making sure the initial store requirements are the same as what the migration
code path expects.

Reviewed By: simpkins

Differential Revision: D20698637

fbshipit-source-id: 1422a4ea78222617d0e3f9631ad883d5a3fe6bb7
2020-03-27 12:55:06 -07:00
Lukas Piatkowski
bace9bc0ae mononoke: make filenode and mercurial_types OSS buildable
Reviewed By: farnz

Differential Revision: D20281345

fbshipit-source-id: bc4910d3040d74c7ceb4cb825bea6960952f6310
2020-03-27 11:40:13 -07:00
Xavier Deguillard
179caf60dd revisionstore: pass the config when building the LFS stores
Summary: Instead of hardcoding some values, use configured ones.

Reviewed By: DurhamG

Differential Revision: D20633784

fbshipit-source-id: d17657b1fca29280f2d07e8cf824e553ad3704f7
2020-03-26 19:02:49 -07:00
Xavier Deguillard
d404b0a228 revisionstore: revamp repack to ease file format migration
Summary:
One of the main drawback of the current version of repack is that it writes
back the data to a packfile, making it hard to change file format. Currently, 2
file format changes are ongoing: moving away from packfiles entirely, and
moving from having LFS pointers stored in the packfiles, to a separate storage.

While an ad-hoc solution could be designed for this purpose, repack can
fullfill this goal easily by simply writing to the ContentStore, the
configuration of the ContentStore will then decide where this data will
be written into.

The main drawback of this code is the unfortunate added duplication of code.
I'm sure there is a way to avoid it by having new traits, I decided against it
for now from a code readability point of view.

Reviewed By: DurhamG

Differential Revision: D20567118

fbshipit-source-id: d67282dae31db93739e50f8cc64f9ecce92d2d30
2020-03-26 19:02:48 -07:00
Xavier Deguillard
cf650d232a remotefilelog: remove unnecessary argument to the Rust repacks
Summary: There is no need to pass the path twice, once is enough.

Reviewed By: DurhamG

Differential Revision: D20567117

fbshipit-source-id: 169a088aa7558b4c25f8fbdecfe59bdd0d7575ef
2020-03-26 19:02:48 -07:00
Xavier Deguillard
d4780ee322 revisionstore: store a HashMap of ContentHash in LFS pointer
Summary:
While the primary (for now) way of addressing an LFS blob is via its sha256,
being able to address them via different hash schemes (sha1 for Eden/Buck,
blake2, etc) will be helpful down the line. Thus, let's store a HashMap of
ContentHash in the pointer store.

Reviewed By: DurhamG

Differential Revision: D20560197

fbshipit-source-id: 8bdc4fc4cd7fc19c7eed6a27d11953c4eedf9195
2020-03-26 19:02:47 -07:00
Xavier Deguillard
04a09ec571 remotefilelog: adapt tests for remotefilelog to support LFS
Summary:
The hgcache will soon contain an LFS subdirectory, this is uninteresting for
most of the tests, let's change them a bit so they only look at the packs
subdirectory.

With this, enabling remotefilelog.useruststore only has 2 failures. One due a
difference in handling corrupt data, with the ruststore being more explicit
that some data is missing instead of a generic "stream ended unexpectedly". And
the other due to some ordering difference when dealing with LFS data. The
latter will go away with the new LFS implementation.

Reviewed By: DurhamG

Differential Revision: D20543146

fbshipit-source-id: 09c76cacfb4687fd699b82cdf5057665ac6bd521
2020-03-26 19:02:47 -07:00
Xavier Deguillard
2f314fc43c revisionstore: remove unnecessary lock around the LfsBlobsStore
Summary: No locking is required for this one due to being loose files on disk.

Reviewed By: DurhamG

Differential Revision: D20522890

fbshipit-source-id: 72b7ebc063060a89f54976a1128977a3b7501053
2020-03-26 19:02:47 -07:00