Commit Graph

55620 Commits

Author SHA1 Message Date
Saurabh Singh
8f5ec4b183 test-status-inprocess: make the test output more stable
Summary:
Write output using `ui` object instead of using `print` to improve
robustness.

Reviewed By: quark-zju

Differential Revision: D19738486

fbshipit-source-id: 4da80ce7efef44e9c5694ed71a55b7d64629166c
2020-02-04 20:36:42 -08:00
Saurabh Singh
5c37bfd373 nointerrupt: make output more stable
Summary:
Printing via `ui` object instead of directly to the `stderr` makes the
output more consistent.

Reviewed By: quark-zju

Differential Revision: D19738355

fbshipit-source-id: 384bf2de11f2ae7b5264ec5d94b041502c4ef7fb
2020-02-04 20:36:42 -08:00
Jun Wu
7316c4cc22 cpython-ext: add a way to wrap Rust Write object into a Python object
Summary:
The library already has a way to wrap a Python object into a Rust object that
exposes the Rust Read/Write interface. This is the reverse direction for
the Write interface.

The initial intention is to expose Rust stdout as described in D19702533.
However, I found Python's `sys.stdout.buffer` also enforces utf-8 encoding
on Windows (unless PYTHONLEGACYWINDOWSSTDIO is set). So Python's
stdout actually behaves similarly with Rust's stdout on Windows and is okay
to use. That said, it's still useful to have this abstraction, for streampager [1]
integration.

[1]: https://github.com/markbt/streampager/

Reviewed By: sfilipco

Differential Revision: D19716127

fbshipit-source-id: ba39898122561d9a49b7080ee95d7c940540eb40
2020-02-04 18:41:13 -08:00
Wez Furlong
650575122d eden: fix fuse init on linux kernel 5.4 and up
Summary:
1fb027d759
changed the kernel behavior to reject reads smaller than 8KB,
even for requests that would never need to be that large.

That causes eden to fail to start up on eg: Fedora 31 with a 5.4 kernel.

This commit adds some padding to satisfy this new check.

Reviewed By: chadaustin

Differential Revision: D19736893

fbshipit-source-id: 926456d72124b186976ee9a8a21242e93c26f790
2020-02-04 18:18:44 -08:00
David Tolnay
d358c71e6d Update to Rust 1.41.0
Reviewed By: jsgf

Differential Revision: D19656956

fbshipit-source-id: ef791638021ae55375ca35ca191cf1b8a3cc5d7f
2020-02-04 18:03:03 -08:00
David Tolnay
2b4b151905 Update to Rust 1.41.0
Reviewed By: jsgf

Differential Revision: D19656956

fbshipit-source-id: ef791638021ae55375ca35ca191cf1b8a3cc5d7f
2020-02-04 18:02:47 -08:00
svcscm
005ebfe28b Updating submodules
Summary:
GitHub commits:

fa0d7fcfa8

Reviewed By: yns88

fbshipit-source-id: cb06aca5f1add7d78ea33725f90360ad0883e8d2
2020-02-04 17:56:29 -08:00
Durham Goode
d3227d34c2 py3: remove forced decoding of environment variable
Summary:
On python 2, os.environ is expected to be bytes, so let's remove the
forced decoding. This broke run-tests.py on Windows.

Reviewed By: singhsrb

Differential Revision: D19737218

fbshipit-source-id: d4782eea279275f57cc91bc412a2d74857002cc1
2020-02-04 17:31:45 -08:00
svcscm
825d70f702 Updating submodules
Summary:
GitHub commits:

b2ba6b8cc4
f3fb63081d
b4165b07d5
788e9c67f9
11b313b0b8

Reviewed By: yns88

fbshipit-source-id: 61d790852b5440738595b26292fb66c961be45d1
2020-02-04 17:19:07 -08:00
David Tolnay
48597dcb4e Update rustfmt and reformat fbsource
Summary:
```
$ tools/third-party/rustfmt/rustfmt --version
rustfmt 1.4.11-nightly (1838235 2019-12-03)
```

Reviewed By: zertosh

Differential Revision: D19704678

fbshipit-source-id: fe8707e964495e76746edcb8b68e34fc1411f52a
2020-02-04 17:14:27 -08:00
David Tolnay
34a520536a Update rustfmt and reformat fbsource
Summary:
```
$ tools/third-party/rustfmt/rustfmt --version
rustfmt 1.4.11-nightly (1838235 2019-12-03)
```

Reviewed By: zertosh

Differential Revision: D19704678

fbshipit-source-id: fe8707e964495e76746edcb8b68e34fc1411f52a
2020-02-04 17:14:27 -08:00
svcscm
5e9733d096 Updating submodules
Summary:
GitHub commits:

619d2503cb
c442208177
75d9b18eba
ed5142083a

Reviewed By: yns88

fbshipit-source-id: 11a53fea064f8e40c2a89d3068421d7cad231d00
2020-02-04 16:36:54 -08:00
Arun Kulshreshtha
fb4764d17e edenapi_server: add request routing
Summary: Add a handler to the EdenAPI server for basic request routing.

Reviewed By: xavierd

Differential Revision: D19726776

fbshipit-source-id: 906a538ebfd48532c2488feb9f99747690f3351b
2020-02-04 16:31:11 -08:00
Arun Kulshreshtha
625025a6a6 lfs_server: import Middleware trait from gotham_ext
Summary: Make the LFS server depend on `gotham_ext` for its Middleware trait and Handler struct. The code itself was previously copied from here, so there should be no functional changes.

Reviewed By: krallin

Differential Revision: D19714661

fbshipit-source-id: 64f3b230c97219c7419cec4e92d30c2ee537c724
2020-02-04 16:31:11 -08:00
Arun Kulshreshtha
5ca1a925b5 gotham_ext: factor out common HTTP boilerplate into new crate
Summary:
A lot of the code in the LFS server is generally useful for any Gotham-based HTTP server, so let's create a place to put the common pieces. Mononoke's HTTP-based services like the LFS server and EdenAPI server can then depend on this common crate.

In this initial diff, I've simply factored out the `Middleware` trait, as well as the custom Handler struct, which right now appears to simply be a mechanism to run the middleware before and after each request.

Given that none of this code appears to be LFS-specific, I hope this is reasonable. I'm open to suggestions for naming things; for now I've named the new crate `gotham_ext` since it's built on Gotham, but I could see us using another name if we intend to move in the direction of plain `hyper` in the future.

In later diffs, I intend to start moving over some of the more general Middleware from the LFS server to the new crate (though LFS-specific Middleware will remain a part of the LFS server code).

Reviewed By: krallin

Differential Revision: D19714662

fbshipit-source-id: 21494d18be659a8ec399c61eb22ee10185efcc14
2020-02-04 16:31:11 -08:00
Durham Goode
fd47fd9202 py3: fix windows build
Summary:
We added pycompat3.py which only parses in Python 3. We need to
exclude it from the Windows build as well.

Unfortunately, the Windows build users PyZipFile.writepy which writes an entire
directory. Let's copy in the implementation from Python 3 which allows us to
filter out certain files.

Reviewed By: xavierd

Differential Revision: D19732319

fbshipit-source-id: 4cebb434d052c51d9ae0dccdec5eadd1f412f9e5
2020-02-04 15:40:35 -08:00
Carolyn Busch
d49c251d13 py3 iteritems -> pycompat.iteritems
Summary: More replacements of dict.iteritems with pycompat.iteritems(dict) for py3 compatibility.

Reviewed By: singhsrb

Differential Revision: D19704211

fbshipit-source-id: 544cb292c0241a293fc4ab83c3d9472dcf4328b6
2020-02-04 15:29:39 -08:00
svcscm
f454dbcfa4 Updating submodules
Summary:
GitHub commits:

23231f3828
e3c02bbb85
be23f69942

Reviewed By: yns88

fbshipit-source-id: 1d9206a6792da5a95b0998ef57ac7a8b75295e31
2020-02-04 15:29:38 -08:00
svcscm
e6a5eaadf0 Updating submodules
Summary:
GitHub commits:

8f3d7019bb
a5df50cf5c
b896a52075
3a073234da
7c05bee055
90f0aa9665
5cdd1abbb9

Reviewed By: yns88

fbshipit-source-id: 70dd062814f68bda77e119bb9deaefbf71c551e6
2020-02-04 13:00:09 -08:00
Saurabh Singh
3d78cca814 util: remove redundant 'timed' function
Summary:
`timed` has been replaced by the `timefunction` in util.

I have also removed the existing usages because they seemed relevant only
during the development.

Reviewed By: quark-zju

Differential Revision: D19727919

fbshipit-source-id: 58c466f02ac2a5bf7096948b17b49ceb26fc1fd9
2020-02-04 12:33:40 -08:00
Durham Goode
16efd0a0e0 py3: fix osx tests
Summary:
The path normalization OSX logic was using unicode, and when it
switched to use pycompat in D19613690 it stopped using unicode, which broke it.
Let's roll it back.

Reviewed By: singhsrb

Differential Revision: D19726322

fbshipit-source-id: fa7bfacdf41dfedbcfef2fdb5ccb826196101e61
2020-02-04 12:19:13 -08:00
Stanislau Hlebik
7291baa7e8 mononoke: revert D19683369
Summary:
This diff causes problems when new code (i.e. the one that generated linknodes
during hg changeset generation) and old code (i.e. the one that doesn't
generate linknodes) run at the same time.

Reviewed By: ikostia

Differential Revision: D19720991

fbshipit-source-id: b2278543020ed8e356b0ba95b61e1c91f5cd5de7
2020-02-04 11:48:27 -08:00
Pavel Aslanov
6e7c2ced4b remove BlobRepo::get_file_content_metadata
Summary:
- remove BlobRepo::get_file_content_metadata
- and method associated with alias resolutions

Reviewed By: krallin

Differential Revision: D19722457

fbshipit-source-id: d45e1cbb4ec769426e2ed7c6cc32173e4dbbac57
2020-02-04 10:25:15 -08:00
Thomas Orozco
7b30ea88fc mononoke/fastreplay: start ptail instead of piping it in
Summary:
We start Fastreplay with some cache warmup. During this time, it doesn't make
sense to go and start ptail, since we're not ready to process its output.

Instead, let's start ptail when we're ready. Piping from stdin is still
possible by not providing a command at all.

Reviewed By: ahornby

Differential Revision: D19723470

fbshipit-source-id: 64f58d9eced4a68fd8238b03b9234f3569215237
2020-02-04 09:32:17 -08:00
Stanislau Hlebik
c115c0c721 mononoke: make cache_warmup more resilient to missing linknode
Summary:
At the moment missing linknodes causes cache warmup to fail. While missing
linknode is not great, failing to start up is much worse - we can make Mononoke
completely unusuable.

This diff instead adds logging of missing filenodes. It also makes sure that we
derive filenodes before using them.

Reviewed By: ikostia

Differential Revision: D19722924

fbshipit-source-id: 10d23506731c45cfaaadee911be62189104c8036
2020-02-04 09:00:06 -08:00
Stanislau Hlebik
50a93cf5d1 mononoke: remove unnecessary async block
Reviewed By: farnz

Differential Revision: D19719718

fbshipit-source-id: 56b9edfcbbc92ffc1a5cba467d18394921f46285
2020-02-04 08:39:35 -08:00
Jun Wu
2203d207a6 tests: do not set stdin to /dev/null
Summary:
This makes it possible to use `--debug` to enter ipdb interactive debug
sessions on crash (which was a new run-tests.py feature added by
D19581174).

For example, I was able to use it to debug a crash in test-lfs-to-mononoke.t
when debugging D19702533:

  Traceback (most recent call last):
    ...
    File "buck-out/dev/gen/eden/scm/__hg__/runtime_resources/__default__/eden/scm/hglib/edenscm/mercurial/ui.py", line 648, in _write
      self.fout.write(encodeutf8("".join(msgs)))
    File "buck-out/dev/gen/eden/scm/__hg__/runtime_resources/__default__/eden/scm/hglib/edenscm/mercurial/pycompat.py", line 168, in encodeutf8
      assert isinstance(s, bytes)
  AssertionError
  > buck-out/dev/gen/eden/scm/__hg__/runtime_resources/__default__/eden/scm/hglib/edenscm/mercurial/pycompat.py(168)encodeutf8()
      167         # type: (bytes) -> bytes
  --> 168         assert isinstance(s, bytes)
      169         return s
  ipdb> up
  ipdb> p msgs
  (u'lfs: uploading e2fff2ce58d585b4b0572e0a323f9e7e5f98cc641489e12c03c401d05d0e350d (1.95 KB)\n',)
  ipdb> up (a few times)
  ipdb> p obj
  {u'oid': u'e2fff2ce58d585b4b0572e0a323f9e7e5f98cc641489e12c03c401d05d0e350d', u'size': 2000, u'authenticated': False, u'actions': {u'upload': {u'href': u'http://localhost:46705/repo/upload/e2fff2ce58d585b4b0572e0a323f9e7e5f98cc641489e12c03c401d05d0e350d/2000'}}}

Without this diff, the `ipdb>` prompt will be ended immediately since it's
reading from /dev/null.

Reviewed By: krallin

Differential Revision: D19709731

fbshipit-source-id: 76cefbf192c4592884e05afee81146963954c5d6
2020-02-04 08:26:35 -08:00
Pavel Aslanov
22e76e8860 remove BlobRepo::get_file_size
Summary: remove `BlobRepo::get_file_size`

Reviewed By: farnz

Differential Revision: D19696679

fbshipit-source-id: 33e940b1d6e4a1546fa808ca0902df8ccf893e18
2020-02-04 07:01:10 -08:00
Pavel Aslanov
5ea1f9318a remove BlobRepo::get_file_parents
Summary: remove `BlobRepo::get_file_parents`

Reviewed By: farnz

Differential Revision: D19694212

fbshipit-source-id: 6812a3821e6e809eb332a2b4d22b83688083231e
2020-02-04 07:01:09 -08:00
Pavel Aslanov
d5c9ffaa17 remove BlobRepo::get_file_envelope
Summary:
- Make `HgFileNodeId` an instance of `Loadable<Value=HgFileEnvelope>`.
- Remove `BlobRepo::get_file_envelope`

Reviewed By: StanislavGlebik

Differential Revision: D19694237

fbshipit-source-id: 67ec51e39cd6da944d505bfb69f087a4b70c544d
2020-02-04 07:01:09 -08:00
Thomas Orozco
c7baeefa23 common/rust/manifold: convert to async / await
Summary:
The underlying Thrift client code is already async / await, but the layer on
top of it is not. This isn't ideal, since it results in a lot of undesirable
clones happening all over the place (e.g. every key is cloned multiple times).

This fixes that by updating the wrapper code to async / await.

Reviewed By: farnz

Differential Revision: D19695708

fbshipit-source-id: b4c1b6fd6bf4d998ca6187c4cdde67294329d181
2020-02-04 06:56:22 -08:00
Stanislau Hlebik
43e5d4f968 mononoke: add missing phases initialization
Reviewed By: krallin

Differential Revision: D19717875

fbshipit-source-id: b77b07cb081108bcc238990c823c196ddf00314a
2020-02-04 01:39:54 -08:00
svcscm
ea723b3eb5 Updating submodules
Summary:
GitHub commits:

bedf2a2d54

Reviewed By: yns88

fbshipit-source-id: 5fa3d59b1854af6d0e99518c5d8fd1bff731583d
2020-02-03 23:05:10 -08:00
Adam Simpkins
0e1437c823 py3: add some additional type annotations on functions writing file data
Summary:
Add a few additional type annotations on some functions.
This did require some minor code restructuring in `filestore.setfile()` to
work around pyre's unwillingness to unwrap `Optional` member variables.

Reviewed By: quark-zju

Differential Revision: D19715243

fbshipit-source-id: 8078329c1e4a50ad0aa6c765d42a89b5ed58e7bf
2020-02-03 21:36:56 -08:00
Adam Simpkins
0657c35391 py3: add more vfs-related type annotations
Summary:
Add more type annotations to vfs.py and some of the platform-specific
functions that it calls.

This did catch a couple of cases where string/bytes conversion were not being
done properly in Python 3.

Reviewed By: quark-zju

Differential Revision: D19678717

fbshipit-source-id: b3979cc5e0668ddbb93372dee25ef02ea1867d6f
2020-02-03 21:36:56 -08:00
svcscm
d8f1c0b0eb Updating submodules
Summary:
GitHub commits:

5a3956bd9f
db67a81b72
4c8fa7af24
7330ec0ff1

Reviewed By: yns88

fbshipit-source-id: 00d407bccddae9fffd9cf8986426e7d8e3c78cca
2020-02-03 18:53:59 -08:00
Jun Wu
9602130aab py3: chg: fix compatibility
Summary:
Fix various type issues when running chg under Python 3.
Enable chg in setup3.py build.

This should make tests run faster. For example, test-rebase-detach.t
now completes in 8 seconds, down from 29 seconds.

Reviewed By: xavierd

Differential Revision: D19702535

fbshipit-source-id: 8928b1b920b9b52fd03dc86f996da18f2405f146
2020-02-03 18:26:57 -08:00
Jun Wu
3e0b781197 py3: only use binary stdin/stdout/stderr
Summary:
Drop stdoutbytes/stdinbytes. They make things unnecessarily complicated
(especially for chg / Rust dispatch entry point).

The new idea is IO are using bytes. Text are written in utf-8 (Python 3) or
local encoding (Python 2). To make stdout behave reasonably on systems not
using utf-8 locale (ex. Windows), we might add a Rust binding to Rust's stdout,
which does the right thing:
- When writing to stdout console, expect text to be utf-8 encoded and do proper decoding.
- Wehn writing to stdout file, write the raw bytes without translation.

Note Python's `sys.stdout.buffer` does not do translation when writing to stdout console
like Rust's stdout.

For now, my main motivation of this change is to fix chg on Python 3.

Reviewed By: xavierd

Differential Revision: D19702533

fbshipit-source-id: 74704c83e1b200ff66fb3a2d23d97ff21c7239c8
2020-02-03 18:26:57 -08:00
Durham Goode
16d4739981 fsmonitor: catch watchman issue and fallback
Summary:
My earlier refactor moved a watchmanclient.getcurrentclock() call out
of a "try/except Exception" block. This meant any watchman errors broke the hg
status entirely, instead of falling back to the old status path.

Let's add the logic around this watchman path.

Reviewed By: sfilipco

Differential Revision: D19709391

fbshipit-source-id: bfb0221ba405a926babddaf73c8e70924e4d9b25
2020-02-03 18:04:25 -08:00
Jasmeet Bagga
a7246e9781 Factor our hw_port_stats_fb303 lib
Summary:
Implementation based on what we do in bcm layer
for reporting (non histogram) port stat counters. Abstracting
this lib out so we can reuse this code in both SAI and bcm
layers. Plus pulling this out of BcmPort makes it much
easier to unit test this code.

Reviewed By: boryas

Differential Revision: D19676641

fbshipit-source-id: 88aa20f20339729f5387500bcf6084871f4e7caa
2020-02-03 17:37:05 -08:00
svcscm
99387283e9 Updating submodules
Summary:
GitHub commits:

68d1a8790b
b1758cc2a0
38887da845
4d396b1953
ccbe2b93d5
973085cbfc

Reviewed By: yns88

fbshipit-source-id: b3e90c88df073fb57ce916276e017e949e57e9d0
2020-02-03 17:31:19 -08:00
Jun Wu
2777fea957 py3: localrepo: manually fixup some type annotations
Summary: This might help pyre check more things.

Reviewed By: farnz

Differential Revision: D19678144

fbshipit-source-id: a04207ccb04ce76796e9a0a7326a8d527d17cff1
2020-02-03 17:07:36 -08:00
Jun Wu
165a8d4f8d py3: add stub for localrepository
Summary:
The "repo" type is a bit hard to type since it might be wrapped by extensions,
and the decorators like "unfilteredmethod" are too hard for type checkers.

Provide a stub for it so typecheck can work. The stub was generated by `pytype`,
I made a small change to `close` to make pyre happy.

Reviewed By: DurhamG

Differential Revision: D19677410

fbshipit-source-id: 71afb3fe78a75ee269c8005d18eee3a807b50df6
2020-02-03 17:07:36 -08:00
Aida Getoeva
38fca29eaf hg-py3: fix restack-multidest/t and fold
Reviewed By: xavierd

Differential Revision: D19700265

fbshipit-source-id: 557cec8388d5c7759d24e1b995f971e72f925a30
2020-02-03 17:05:35 -08:00
Aida Getoeva
acc0425925 hg-py3: make amend-next/prev work
Reviewed By: xavierd

Differential Revision: D19700028

fbshipit-source-id: 9aaab361058a2dfa34f4d0c9218c71c1654aaa8a
2020-02-03 17:05:34 -08:00
Wez Furlong
4c5168658f eden: teach eden redirect to use new apfs helper tool
Summary:
This commit enables mounting and unmounting using the
new helper, and fixes up the behavior of `eden redirect list`
and `eden gc` so that they have reasonable behavior when APFS
is in the mix.

The semantics of the `TARGET` field in the redirect list output
become a bit hazy when using APFS volumes; it's a bit less important
because the data isn't effectively moved to a different part of
the filesystem namespace: we're just mounting a different filesystem
over the top and it can only be accessed through its mountpoint.

Reviewed By: chadaustin

Differential Revision: D19403162

fbshipit-source-id: 136a7b02f605cde0a74016608179924be801eda9
2020-02-03 16:59:18 -08:00
Wez Furlong
30d0a77d53 eden: add helper command for working with apfs
Summary:
We've had a small proportion of our users run into problems
with hdiutil and diskimages-helper, where those components get into
an unhappy state and effectively block operating on the redirections.

This diff introduces a new utility that is intended to replace the
use of disk image files with APFS volumes that we mount in the
appropriate places.

The intention is that we will teach `eden redirect` to use this tool
when available, rather than disk images.

macOS's security model is weird: it is perfectly valid for a non-privileged
user to create and delete APFS volumes in the APFS storage container,
but root privs are required to mount it into the VFS.

The intent is that we deploy this utility setuid root to minimize
the fan out--this way we won't need to teach the priv helper about
this kind of redirection.

There are a couple of subcommands demonstrated in the test plan.

Reviewed By: chadaustin

Differential Revision: D19323850

fbshipit-source-id: 35556f841e49e5c4b77679b756af9093222f4500
2020-02-03 16:59:17 -08:00
Chad Austin
ad6b3f5323 require eden rm be given the checkout root
Summary:
To avoid accidents when people run `eden rm` with a subdirectory of
the mount, require that it be given the checkout root (or a symlink to
it).

Reviewed By: genevievehelsel

Differential Revision: D19549912

fbshipit-source-id: ae0a43e9164f73f5ad9c2f40f1b7226a1e85a567
2020-02-03 16:27:09 -08:00
svcscm
21f3196b8b Updating submodules
Summary:
GitHub commits:

d5d8571ec4
31a45b5039
36c504be17
321cd537b1

Reviewed By: yns88

fbshipit-source-id: 0b76baa11b371d4e67f2663ef2b7ee1ac9d57d56
2020-02-03 15:57:59 -08:00
Adam Simpkins
b6ce7a08a6 py3: make vfs.join() consistent across subclasses; add type hints
Summary:
Add type hints for `vfs.join()`.  Not all subclasses supported joining
multiple arguments, so fix them all to actually implement the full API.

Reviewed By: farnz

Differential Revision: D19678712

fbshipit-source-id: f7f77eee416cd5edda756a8423cbe3630e195d4a
2020-02-03 15:27:52 -08:00