Commit Graph

2701 Commits

Author SHA1 Message Date
Jun Wu
305b95895a edenapi/types: mark some commit related types to use hgid::bytes serialization
Summary:
This makes it so commit hashes are serialized to bytes instead of tuples in Python:

  In [1]: s,f=api.commitdata(repo.name, list(repo.nodes('master')))
  In [2]: list(s)
  Out[3]: [{'hgid': '...', ...}]

Some `Vec<HgId>`s cannot be changed using this way. It'd be nice if we can change
the default `HgId` serialization to bytes.

Reviewed By: kulshrax

Differential Revision: D23966989

fbshipit-source-id: 4d013525419741d3c5c23621be16e70441bab3c4
2020-09-28 21:32:21 -07:00
Jun Wu
2a2971a4c7 types: add serde(with) functions for HgId
Summary:
`HgId` currently serializes into a tuple of 20 items. This is suboptimal in
CBOR, because the items are untyped. A byte might be serialized into one or two
bytes:

  In [2]: cbor.dumps([1,1,1,1])
  Out[2]: b'\x84\x01\x01\x01\x01'

  In [3]: cbor.dumps([255,255,255,255])
  Out[3]: b'\x84\x18\xff\x18\xff\x18\xff\x18\xff'

CBOR supports "bytes" type to efficiently encode a `[u8]`:

  In [5]: cbor.dumps(b"\x01\x01\x01\x01")
  Out[5]: b'D\x01\x01\x01\x01'

  In [6]: cbor.dumps(b"\xff\xff\xff\xff")
  Out[6]: b'D\xff\xff\xff\xff'

Add `serde_with` with 3 flavors: `bytes`, `tuple`, `hex` to satisfy different
needs. Check the added docstring for details.

Reviewed By: kulshrax

Differential Revision: D23966992

fbshipit-source-id: 704132648f9e50b952ffde0e96ee2106f2f2fbcf
2020-09-28 21:32:21 -07:00
generatedunixname89002005307016
aa6146bfa8 suppress errors in eden - batch 1
Differential Revision: D23968620

fbshipit-source-id: dd9b816be7304511ae69b265d9b650313c799c1f
2020-09-28 16:03:43 -07:00
Kostia Balytskyi
d829595d86 sparse: be explicit about the role of -r
Summary: This just adds some explanation of `-r` to the `hg sparse list` docstring.

Reviewed By: markbt

Differential Revision: D23961027

fbshipit-source-id: 64ab406b07fe5d66fd53d4e520935aad3b0b351b
2020-09-28 10:03:55 -07:00
Durham Goode
37f47b452a dynamicconfig: fix reponame detection during synchronous config generation
Summary:
Dynamicconfig can generate configs two ways, 1) via `hg
debugdynamicconfig` and 2) synchronously in-process in an hg command when it
detects that the dynamicconfig is completely missing or has the wrong version
number.

In the first case, dynamicconfig gets the repo name from the standard config
object loaded by the hg dispatch.  In the second case, the standard config
object isn't even loaded yet, so dynamicconfig does a mini-load of the user and
repo hgrcs so it can get the repo name and user name (needed for dynamic
conditions).

Unfortunately the second code path computed the wrong path (it had two .hg/'s)
which meant the reponame and user name were always none. This meant that the
dynamicconfig on disk could randomly be either computed with or without a
reponame.

Let's fix the path computation, and add a test.  We may want to make
dynamicconfig fail if no repo name is passed, but I'm not sure if we'll want to
support no-repo configuration at some point.

This didn't cause a problem for most people, since it would only happen during a
hg version number change, and 15 minutes later the background 'hg
debugdynamiconfig' process would fix it up. It did affect sandcastle though,
since it often creates new repositories and acts on them immediately.

Reviewed By: quark-zju

Differential Revision: D23955628

fbshipit-source-id: c922f4b523d19df9223aa28c97700b7011fc03eb
2020-09-28 09:14:05 -07:00
Durham Goode
040ee1b744 revisionstore: fix default pending data pack limit
Summary:
The old code tried to express 4GB by using ^ to do an exponent. That
operator is actually the bitwise xor, so this was producing a limit closer to 4
bytes. It doesn't seem to have mattered much since a later diff overrode the
default via dynamicconfig. But let's fix this anyway.

Reviewed By: krallin

Differential Revision: D23955629

fbshipit-source-id: 6abebcb7e84b7a47f70ac501fa11b0dc60dfda7b
2020-09-28 09:14:04 -07:00
Arun Kulshreshtha
d3b39542f0 revisionstore: use async_runtime in EdenAPI stores
Summary: Now that the `async_runtime` crate exists, use Mercurial's global `tokio::Runtime` instead of creating one for each EdenAPI store.

Reviewed By: quark-zju

Differential Revision: D23945569

fbshipit-source-id: 7d7ef6efbb554ca80131daeeb2467e57bbda6e72
2020-09-26 16:50:06 -07:00
Mark Edson
86c6025e20 change comment to jf authenticate
Summary:
`arc install-certificate` is going away, so let's reference the replacement

Created from Diffusion's 'Open in Editor' feature.

Differential Revision: D23948479

fbshipit-source-id: e629458ed2be1e1c09d9674935e3bcc890b05ad9
2020-09-25 22:31:17 -07:00
Durham Goode
5d6dfacb7a phases: make public calculation lazy
Summary:
Now that public phases are separated from draft, hidden behind the
ispublic() api, and no consumers require the entire set anymore, let's make them
lazy by testing commits against a lazy ancestor collection.

Reviewed By: quark-zju

Differential Revision: D23921326

fbshipit-source-id: 7c53345f41ff89d2d0ec11b1c09bbb2f89529c21
2020-09-25 09:28:30 -07:00
Durham Goode
5c755e5130 dagop: move cutfunc to walkrevtree
Summary:
Previously, _genrevancestor applied it's cutfunc function (which is
usually used to bound an ancestor traversal from processing public nodes) when
producing the parents of the current rev. In the walkrevtree function this means
we have to invoke cutfunc before we enqueue new parents onto the heap. This can
mean we have to process very old commits, even though walkrevtree might never
get to them.

Let's move the cutfunc to be at the deque stage instead of enque. When we make
public phases lazy, this will let us avoid looking up really old commits and
speed things up a lot.

Reviewed By: quark-zju

Differential Revision: D23921324

fbshipit-source-id: 8b520e9184441b9bd7581cdb71414f406cf9b544
2020-09-25 09:28:30 -07:00
Durham Goode
f8543d78b0 phases: switch revset to not require entire public set
Summary:
Unfortunately the current add operator implementation for nameset sorts
the result, which causes lazy namesets to be evaluated. Let's change the phase
revset to avoid that operator for now.

In a future diff we'll make publicrevs lazy, which will require this change to
be performant.

Reviewed By: quark-zju

Differential Revision: D23921325

fbshipit-source-id: c3477c30c1c5061b641c14b8aa73d07da6f7f398
2020-09-25 09:28:30 -07:00
Durham Goode
0131d47746 phases: make draftrevs use only()
Summary:
In a future diff we'll be changing the way public phase computation
works. Let's start by moving the draft phase computation out to belong to
draftrevs(), so then we can change publicrevs() without worrying about draft. In
the process, let's simplify draftrevs to just be an only() query.

Reviewed By: quark-zju

Differential Revision: D23921327

fbshipit-source-id: 255eab4b796bf7bc4467544cf8231b3ed98c08c8
2020-09-25 09:28:29 -07:00
Durham Goode
c05bd0a51c phases: move headbased phase calculation to it's own function
Summary:
In an upcoming diff we'll be splitting draft and public calculations
apart when in headbased repositories. To make this cleaner, let's stop using
loadphaserevs and start using draftrevs and publicrevs accessors.

Reviewed By: quark-zju

Differential Revision: D23921328

fbshipit-source-id: 26a2a6fdc1201416bf61c7d32e3ede62d9579546
2020-09-25 09:28:29 -07:00
Durham Goode
eb5acf9222 tests: disable flakey tests
Summary:
These tests rely on sleep to simulate race conditions. They are the
largest source of hgbuild breakages. Let's just disable them. Most of this code
is going away in a couple months anyway when Mononoke takes over and revlogs go
away.

Also fixes a failure in test-bookmarks-strip.t that showed up.

Reviewed By: singhsrb

Differential Revision: D23922660

fbshipit-source-id: 35cacc19de03c031c84c1ebf2124884f4b4248e6
2020-09-24 21:32:23 -07:00
Arun Kulshreshtha
825ebe35a8 edenapi: print response headers in debug output
Summary: Print relevant HTTP response headers in the debug output for debugging client-server issues.

Reviewed By: quark-zju

Differential Revision: D23923168

fbshipit-source-id: c9fda57c53fb25b15c450f0afd14e539de43cfcb
2020-09-24 21:05:21 -07:00
Arun Kulshreshtha
29b855b256 edenapi: add server load to ResponseMeta
Summary: Now that the EdenAPI server is using the `LoadMiddleware` from `gotham_ext`, each response will contain an `X-Load` header that contains the number of active requests that the server is currently handling.

Reviewed By: quark-zju

Differential Revision: D23922809

fbshipit-source-id: 973143de5ddccf074d28aa3ef38d73f9fc1501b6
2020-09-24 21:05:21 -07:00
Arun Kulshreshtha
318f5683a5 http-client: report download speed as Mbit/s and MiB/s
Summary:
Network speeds are usually reported in megabits per second (Mb/s), whereas file sizes are usually reported in [mebibytes](https://en.wikipedia.org/wiki/Binary_prefix) per second (MiB/s). Previously, the HTTP client reported neither of those and instead reported megabytes per second (MB/s).

This diff changes the latter to the former so that the numbers are more immediately useful. As a bonus, the speeds are now directly comparable to those reported by `hg debugnetwork`.

Reviewed By: quark-zju

Differential Revision: D23920367

fbshipit-source-id: 46500a42681ab83fc7c4ead82980e8ed620a4d5a
2020-09-24 21:05:20 -07:00
Arun Kulshreshtha
f1aeffd67a hg-http: remove stats logging
Summary: Now that stats are logged to `tracing` by the `HttpClient` directly, we no longer need to log them here. This commit backs out D23858077 (613fbc858f) which added the logging.

Reviewed By: quark-zju

Differential Revision: D23919308

fbshipit-source-id: 23d3a12c5307bc4b84dd9ffd25bd376718e3cc91
2020-09-24 21:05:20 -07:00
Arun Kulshreshtha
45e8c3377c http-client: improve log messages
Summary:
Improve the log output of the HTTP client to avoid spewing redundant debug messages.

As part of this change, logging now uses the `tracing` crate instead of the `log` crate for better integration with the rest of Mercurial's logging infrastructure. Right now, `tracing` is just being used as a drop-in replacement for `log`, but now that it's in use we can start using its full capabilities (such as defining tracing spans) in later diffs.

Reviewed By: quark-zju

Differential Revision: D23919310

fbshipit-source-id: 95555ad083ead805ceece39c6e30aaf879bdf2bc
2020-09-24 21:05:20 -07:00
Adam Simpkins
475318252f fix hg mv and hg cp to wait for the lock if the repo is locked
Summary:
Fix the `hg mv` and `hg cp` commands to wait for the lock if the repository is
locked, instead of immediately failing.

The current behavior is quite annoying as `hg mv` can easily fail due to
commitcloud sync commands running in the background and holding the lock.

I can't see any good reason why this command should not wait for the lock to
be held.  The current behavior of failing when the lock is held dates back to
2006, in rFBSf5b6e7d2f591, when locking was first added to this command.

Reviewed By: DurhamG

Differential Revision: D23896302

fbshipit-source-id: 29bfeb8fd356abd31b6e1eb30c8f211a31fb044b
2020-09-24 19:05:33 -07:00
Xavier Deguillard
dc19397ccc doctor: use the right indexedlog config
Summary:
The remotefilelog.indexedlog{data,history}store configs are no longer in use,
so we shouldn't use them as a way to test whether the indexedlog are present.

Reviewed By: quark-zju

Differential Revision: D23918133

fbshipit-source-id: 902a369f5e1774b8e2fa1e4b3280fbb7cc377775
2020-09-24 16:58:36 -07:00
Arun Kulshreshtha
3a5b6d2958 http-client: fix curl_multi_wait timeout
Summary:
We were using the timeout parameter on `Multi::wait` (equivalent to `curl_multi_wait` in C) incorrectly. Previously, we were passing in the timeout provided by `curl_multi_timeout`.

This is incorrect usage because the value returned by `curl_multi_timeout` is the current value of libcurl's internal timeout (based on the state of the transfers), which will always be respected. The actual intention of the timeout parameter is to allow the caller to specify a hard cap on curl's internal timeout, so we should just pass some reasonable default value here. ([See explanation here.](https://github.com/curl/curl/issues/2996))

The purpose of `curl_multi_timeout` is to allow libcurl to tell the application what its desired timeout is in situations where the application itself is waiting for socket activity (using something like `epoll`), which is not the case when using `curl_multi_wait`.

Reviewed By: DurhamG

Differential Revision: D23914093

fbshipit-source-id: 76a25d7c59a4b08437c8d7be3d24708fb37b9172
2020-09-24 16:46:39 -07:00
Arun Kulshreshtha
621bb70089 treemanifest: add HTTP fetching
Summary: Add appropriate EdenAPI calls to allow for HTTP tree fetching in `treemanifest`. Enabling `remotefilelog.http` essentially reroutes `_prefetch` and `getdesignatednodes` to their HTTP equivalents.

Reviewed By: DurhamG

Differential Revision: D23877319

fbshipit-source-id: 8a71934b47d07d2655fa46c103a14fb99e2f7b1f
2020-09-24 16:46:39 -07:00
Arun Kulshreshtha
5bac6466e2 edenapi: add timeout option
Summary: Use the functionality from D23910534 (721f5af278) to set a timeout for EdenAPI requests, configured via the `edenapi.timeout` option.

Reviewed By: DurhamG

Differential Revision: D23911552

fbshipit-source-id: 4a6e3de1094d0faa1daaf6fe4b9b7aafb37a25a8
2020-09-24 16:46:39 -07:00
Arun Kulshreshtha
ac3dbcb84e treemanifest: cast names and nodes to lists
Summary:
Cast `names` and `nodes` to lists. The reason that they are sets is deduplication, but otherwise the code doesn't rely on them being sets (and in fact casts them to lists at multiple points later).

The main motivation for this is to allow these to be passed to Rust code later. The Rust bindings make a distinction between sequence types and unordered types, so passing a set in place of a list would result in a type error.

Reviewed By: DurhamG

Differential Revision: D23893108

fbshipit-source-id: 9ce2addb824867bcb2d24ba14c589b8791a156e8
2020-09-24 16:46:39 -07:00
Arun Kulshreshtha
721f5af278 http-client: add ability to set timeout
Summary: Add the ability to set a timeout on HTTP requests. Equivalent to [`CURLOPT_TIMEOUT_MS`](https://curl.haxx.se/libcurl/c/CURLOPT_TIMEOUT_MS.html).

Reviewed By: DurhamG

Differential Revision: D23910534

fbshipit-source-id: a7aec792ec3c122a01aa44fcfe2e2df6e3a111fc
2020-09-24 12:59:42 -07:00
Durham Goode
24aa3b50ca py3: fix traceprof
Summary: Fixes it for python 3

Reviewed By: kulshrax

Differential Revision: D23907996

fbshipit-source-id: 1347a1adb80ef643bdb581fea83362558d94e058
2020-09-24 11:56:21 -07:00
Durham Goode
2c790a0331 py3: fix crecord 'a' and 'r' commands
Summary: These concatenated strings and bytes and needed to be fixed.

Reviewed By: kulshrax

Differential Revision: D23907301

fbshipit-source-id: 0008d7d54469266ecbae8ddaaa7625820f62cb7e
2020-09-24 11:22:33 -07:00
Arun Kulshreshtha
183fff1b9f http-client: fail loudly on non-fatal errors
Summary:
There are several places in the HTTP client where we log and discard errors. (Typically, these are "this should never happen" type situations.)

Previously, these were logged at the `trace` log level, meaning that in practice no one would ever know if we did hit these errors.

Let's upgrade them to `error` so that they'll be printed out. (In theory, users should never see these error messages unless something has gone horribly wrong.)

Reviewed By: DurhamG

Differential Revision: D23888268

fbshipit-source-id: 9007205f946ebb0127238c76812cf62524878047
2020-09-24 11:19:36 -07:00
Durham Goode
eb5ac5b0fc tests: remove flakey test
Summary:
This test relies on precise timing of racing processes. This is flakey
in our automated tests. Since this is mainly about revlog based repos, and we
only have that on the servers now, and we're going to delete them soon, let's
delete this test to make our tests more stable.

Reviewed By: kulshrax

Differential Revision: D23908316

fbshipit-source-id: 3fd110a8267d3bc16bbcb4545b9ff921274f7588
2020-09-24 11:10:07 -07:00
Durham Goode
3fa03cf52c treemanifest: stop passing around linkrevs during recent tree discovery
Summary: Linkrevs are on their way out. Let's switch to linknodes.

Reviewed By: quark-zju

Differential Revision: D23765176

fbshipit-source-id: 0dc1e0db11d732ce1edd24d863f32f08a5a5ce42
2020-09-24 09:47:00 -07:00
Durham Goode
490468403b treemanifest: fix bundle usage with Rust contentstore
Summary:
The rust contentstore doesn't allow runtime manipulation of the list of
stores, which is required in order to insert the bundle store into the store.
Let's continue using the old python union store in these cases. This still let's
us delete the python pack code later, but we'll have to keep around the python
union store until we come up with a better solution.

Reviewed By: quark-zju

Differential Revision: D23689630

fbshipit-source-id: 0c60e6f268e81804149afa24409f64b5303e1e34
2020-09-24 09:46:59 -07:00
Durham Goode
c80cdf1f49 treemanifest: enable treemanifest.useruststore=True for most tests
Summary:
The remaining test failures are mostly around bundle support, which
I'll fix in a later diff.

Reviewed By: quark-zju

Differential Revision: D23664037

fbshipit-source-id: 2bdde3cb4fcded6e0cf3afdc23269662544821df
2020-09-24 09:46:59 -07:00
Durham Goode
9274720931 treemanifest: remove depth parameter from high level prefetch trees
Summary:
The high level prefetch trees API had a depth parameter, but the Rust
prefetch path doesn't support that. In the long run we probably want to get rid
of the depth parameter (or make it more useful), so for now let's get rid of it
from the function signature. You can still set the depth via config, and the few
places that needed depth are changed to use the config.

Reviewed By: quark-zju

Differential Revision: D23772384

fbshipit-source-id: a037d7207d4076a47368366ef7fd2dc1cfbf5cfb
2020-09-24 09:46:59 -07:00
Durham Goode
46d0991cd0 revisionstore: expose shared mutable stores to Python
Summary:
Treemanifest needs to be able to write to the shared stores from paths
other than just prefetch (like when it receives certain trees via a standard
pull). To make this possible we need to expose the Rust shared mutable stores.
This will also make just general integration with Python cleaner.

In the future we can get rid of the non-prefetch download paths and remove this.

Reviewed By: quark-zju

Differential Revision: D23772385

fbshipit-source-id: c1e67e3d21b354b85895dba8d82a7a9f0ffc5d73
2020-09-24 09:46:59 -07:00
Zeyi (Rice) Fan
9041ed077a doctor: repair indexedlog data store when running doctor without a repo
Reviewed By: xavierd

Differential Revision: D23873218

fbshipit-source-id: e0999a4fd5bd6d53e9b28a8c9e175a995f92efa2
2020-09-23 17:51:57 -07:00
Meyer Jacobs
75105421ce edenapi: Hide edenapi wire types from externally visible API
Summary:
Introduce separate wire types to allow protocol evolution and client API changes to happen independently.

* Duplicate `*Request`, `*Entry`, `Key`, `Parents`, `RepoPathBuf`, `HgId`, and `revisionstore_types::Metadata` types into the `wire` module. The versions in the `wire` module are required to have proper `serde` annotations, `Serialize` / `Deserialize` implementations, etc. These have been removed from the original structs.
* Introduce infallible conversions from "API types" to "wire types" with the `ToWire` trait and fallible conversions from "wire types" to "API types" with the `ToApi`. API -> wire conversions should never fail in a binary that builds succesfully, but wire -> API conversions can fail in the case that the server and client are using different versions of the library. This will cause, for instance, a newly-introduced enum variant used by the client to be deserialized into the catch-all `Unknown` variant on the server, which won't generally have a corresponding representation in the API type.
* Cleanup: remove `*Response` types, which are no longer used anywhere.
* Introduce a `map` method on `Fetch` struct which allows a fallible conversion function to be used to convert a `Fetch<T>` to a `Fetch<U>`. This function is used in the edenapi client implementation to convert from wire types to API types.
* Modify `edenapi_server` to convert from API types to wire types.
* Modify `edenapi_cli` to convert back to wire types before serializing responses to disk.
* Modify `make_req` to use `ToWire` for converting API structs from the `json` module to wire structs.
* Modify `read_res` to use `ToApi` to convert deserialized wire types to API types with the necessary methods for investigating the contents (`.data()`, primarily). It will print an error message to stderr if it encounters a wire type which cannot be converted into the corresponding API type.
* Add some documentation about protocol conventions to the root of the `wire` module.

Reviewed By: kulshrax

Differential Revision: D23224705

fbshipit-source-id: 88f8addc403f3a8da3cde2aeee765899a826446d
2020-09-23 17:27:08 -07:00
Arun Kulshreshtha
a745a145b1 edenapi: optionally print log messages
Summary: Add log messages for debugging using the `tracing` crate, which allows them to be enabled via `env_logger`.

Reviewed By: quark-zju

Differential Revision: D23858076

fbshipit-source-id: a8ef1afac6c9ecbfb5d6d78232aa0d03a2fe2054
2020-09-23 17:19:28 -07:00
Arun Kulshreshtha
613fbc858f hg-http: optionally print stats
Summary: Log HTTP stats to stderr to assist with ad-hoc debugging. Will not be printed unless `RUST_LOG` is set appropriately.

Reviewed By: quark-zju

Differential Revision: D23858077

fbshipit-source-id: 39acf3de3fd0ca4403a986eb5373a6a79f1d004a
2020-09-23 17:19:28 -07:00
Arun Kulshreshtha
31ceb7f0d1 hg-http: use autocargo
Summary: Onboard the crate onto autocargo.

Reviewed By: quark-zju

Differential Revision: D23858075

fbshipit-source-id: 7179ae0f9ca8a1d4e664d7eb5cb614940e2b2c30
2020-09-23 16:40:49 -07:00
Jun Wu
2f5752eda5 util: raise with traceback in Python 2
Summary: Similar to D23819023 (c96de76ac0) but works on Python 2, too.

Reviewed By: DurhamG

Differential Revision: D23858273

fbshipit-source-id: b15be07c8657bc8cb37960b631f2b31e4a78892b
2020-09-23 12:37:44 -07:00
Durham Goode
58667a3fe7 tests: fix test-commitcloud-sync.t and test-common-commands-fb.t
Summary:
test-commitcloud-sync.t is a new change and just needs to be made cross
platform.

I have no idea how test-common-commands-fb.t ever worked.  When HGRCPATH is set,
I expect the system hgrc to not be loaded, and therefore we can't run hg-clone.
Let's just unset it, since this is meant to test if the new Mercurial can
execute a clone. Ideally we'd redirect the system hgrc to the in-repo
staticfiles, but that's more effort.

Reviewed By: singhsrb

Differential Revision: D23869645

fbshipit-source-id: 66669d9fd9c3a23b01bc43b365723185b7b2ed33
2020-09-23 10:58:19 -07:00
Liubov Dmitrieva
c5328d9d0e move some operations under read path
Summary:
Move some commit cloud operations under infinitepush read path:

those are:
*  `hg cloud check` command
*  `hg cloud sync` command when the local repo is clean
* `hg cloud switch` command will normally use the read path for the dest workspace because we clean up the repo before performing the switch
*  `hg cloud rejoin` command we use in fbclone will normally go through the read path as it runs in a fresh repo

If something is broken, there is always a way to rerun any of these command with '--dest' flag pointing it to the write path.

```
./hg cloud check -r 0c9596fd1 --remote --dest infinitepush-write
./hg cloud sync --dest infinitepush-write
./hg cloud switch -w other --dest infinitepush-write
```

Those use cases are limited and the lag of forward filler shouldn't be noticeable for them but we will be able to collect more signal how Mononoke performs with Commit Cloud.

Sitevar to control the routing of read traffic:
https://www.internalfb.com/intern/sv/HG_SSH_WRAPPER_MONONOKE_ROLLOUT/#revisions_list

Reviewed By: mitrandir77

Differential Revision: D23840914

fbshipit-source-id: 40fbe2e72756e7a4cf8bc5be6a0b94f6cf4906b4
2020-09-23 08:42:13 -07:00
Jun Wu
1b7c3b6a13 localrepo: cache headnodes instead of headrevs
Summary:
With segmented changelog backend, the revs can be changed, even if len(repo)
didn't change. Caching revs might not get invalidated properly. Let's cache
head nodes instead.

Reviewed By: DurhamG

Differential Revision: D23856176

fbshipit-source-id: c5154c536298c348b847a12de8c4f582f877f96e
2020-09-22 18:11:05 -07:00
Jun Wu
27f4f7e94c test-commitcloud-sync: fix test on Ubuntu
Summary:
On Ubuntu the output is a bit different:

```
   $ hg cloud sync --use-bgssh
   commitcloud: synchronizing 'server' with 'user/test/default'
-  remote: /bin/sh: trashssh: command not found
-  abort: no suitable response from remote hg!
+  remote: /bin/sh: 1: trashssh: not found
+  abort: no suitable response from remote hg: '[Errno 32] Broken pipe'!
```

Glob them out to make the test pass.

Reviewed By: DurhamG

Differential Revision: D23824735

fbshipit-source-id: 7f96149ee16daff31fd0a1c68975b5edfa27cc46
2020-09-22 15:21:56 -07:00
Jun Wu
bcbacfebf4 dispatch: ensure SIGINT triggers KeyboardInterrupt
Summary:
It seems OSX python2 has SIGINT handler set to SIG_IGN by default when running
inside tests. Detect that and reset SIGINT handler to raise KeyboardInterrupt.

This fixes test-ctrl-c.t on OSX.

As we're here, improve test-ctrl-c.t so it checks a bit more things and run
quicker.

Reviewed By: DurhamG

Differential Revision: D23853455

fbshipit-source-id: 05c47650bc80f9880f724828d307c32786265e2c
2020-09-22 15:10:12 -07:00
Mark Thomas
ee0299cda0 phabstatus: batch peekahead for smartlog
Summary:
Phabstatus for smartlog uses `PeekeaheadList` rather than `PeekaheadRevsetIterator` as
all of the commits are known ahead of time, and we don't need to collect together
batches as we iterate across the revset.

However, we should still batch up requests to Phabricator, as users with very high
numbers of commits in their smartlog may hit timeouts.

Add a batching mechanism to `PeekaheadList` that splits the list into chunks to
return with each peekahead.

Reviewed By: liubov-dmitrieva

Differential Revision: D23840071

fbshipit-source-id: 68596c7eb4f7404ce6109e69914f328565e34582
2020-09-22 07:26:18 -07:00
Liubov Dmitrieva
c68e928d6f add --fource option to hg cloud backup command to reinitialise the local cache of backed up heads from the server
Summary:
This provides a way to fix the local cache of backed up heads if it is in an
invalid state.

The most important, it will allow early dogfooding of write traffic from Mononoke
without the reverse filler in place for developers or for the team.

You could just run `hg cloud backup -f` assuming the repo is backfilled to fix
any inconsistency when switch between the two backends

Reviewed By: markbt

Differential Revision: D23840162

fbshipit-source-id: bbd331162d65ba193c4774e37324f15ed0635f82
2020-09-22 07:12:28 -07:00
Mark Thomas
c55cb1914a cmdutil: ensure rust graph renderer messages are unicode
Summary:
For Python 3 we must ensure that the displayer messages have all been converted
to unicode before providing them to the Rust graph renderer.

The is because the Python 3 version of `encoding.unifromlocal` is a no-op, so
the result may still be `bytes` that need to be converted to `str`.

Reviewed By: quark-zju

Differential Revision: D23827233

fbshipit-source-id: 8f2b707ceceb210c0a2b5b589b99d4016452c61c
2020-09-22 04:04:12 -07:00
Durham Goode
737c07ca24 tests: fix test-fb-hgext-extutil.py on OSX
Summary:
D23759711 (be51116cf4) changed the way signal handlers work, which apparently causes
this test to fail. The SIGCHLD signal of the child changing state is received
during os.waitpid, which apparently counts as a signal during a system call,
which throws an OSError.

I'm not sure what the real fix should be. Sleeping gets us past the issue, since
presumably the signal is handled before the system call.

Reviewed By: quark-zju

Differential Revision: D23832606

fbshipit-source-id: 70fca19e419da55bbf546b8530406c9b3a9a6d77
2020-09-22 03:37:28 -07:00