Summary:
I have a suspicion that most edenfs starts are unclean. To test that
hypothesis, add a "mount" structured event type that records whether
the mount was cleanly shut down, how long mounting took, and whether
it's a graceful restart.
Reviewed By: genevievehelsel
Differential Revision: D19585161
fbshipit-source-id: 16eedfeb6181742e64b45bca1ed3cce3edb663cb
Summary:
This has been a minor nit reported by our macOS users for a little
while.
* Skip the code that collects the process tree, as there is no
out of the box function for this on macOS. (We still run it
on Linux)
* Adjust the `ps` command arguments for macOS when running on macOS
Reviewed By: chadaustin
Differential Revision: D19649881
fbshipit-source-id: c2e7a434a3264951c3ecbd02dab3459f401190d6
Summary: The module no longer exist in Python3, it has been renamed.
Reviewed By: quark-zju
Differential Revision: D19663426
fbshipit-source-id: a805e7fa3d15335a0be4f6a8d8ae096328470728
Summary: Command lines with newlines were messing up the output of `eden top`, so escape them like a shell would.
Reviewed By: wez
Differential Revision: D19611525
fbshipit-source-id: 96c7ac00d02ac4d0f78f4f9b56fedd71b9728585
Summary:
Different versions of dulwich return different types for
`localclient.fetch_pack`. If the returned type is a real dict, then we can't
test the inner `refs` attribute, so check if it is there before testing if it
is `None`.
Reviewed By: singhsrb
Differential Revision: D19657503
fbshipit-source-id: 63cce72fa87f615e7b33279726dcb19c2fdf5b9e
Summary:
Use sed to convert testutil.ddot requires to hghave.
ignore-conflict-markers
for test-simplemerge.py
Reviewed By: simpkins
Differential Revision: D19658355
fbshipit-source-id: afae73eb1e43ead79514dfaf9f911f51ac25972e
Summary:
This breaks test-alias.t, so it looks like demandimport no longer behaves properly.
Original commit changeset: d56814049181
Reviewed By: simpkins
Differential Revision: D19658109
fbshipit-source-id: 9fd4865bd00d2307afe0c99f1500b6e08fe3e785
Summary:
D19652082 changed `urllibcompat.urlreq.quote()` to always return bytes.
This broke most of the code outside of the bundle2 module that was expecting
it to operate on strings.
This changes `quote()` to operate on strings again, since this is what the
Python 3 standard library does. This updates `bundle2` to handle encoding and
decoding properly when parsing strings that go through `quote()` and
`unquote()`.
This also changes bundle2 to stop going through the `urllibcompat.urlreq`
wrapper class, since that wrapper class prevents type checking from being
performed on its members.
Reviewed By: quark-zju
Differential Revision: D19657765
fbshipit-source-id: 0611838213ec22221e0b8367e1f0d8a6dcfceb15
Summary:
D19656501 added a usage of the `b"%b"` format specifier, which only works in
Python 3. Change the code to use `b"".join()` for now, which works in both
Python 2 and Python 3.
Reviewed By: farnz
Differential Revision: D19657472
fbshipit-source-id: 22d3123f4939fa984ffd17516e1cc48bad2bb2b7
Summary:
This diff allows us to remove the `type: ignore` specification on the
affected lines.
Reviewed By: farnz
Differential Revision: D19657442
fbshipit-source-id: 4626daf20c57fbb511b203e54f2575edc619f40f
Summary:
Fix the type annotation for `journalentry.serialize()`: It needs to come
immediately after the method declaration to be recognized, not after the
docstring.
Fixing this causes pyre to produce type errors for this method. I have
changed `journalentry` to derive from `typing.NamedTuple` to fix this. This
syntax is somewhat awkward with Python 2, but is much cleaner in Python 3.
Reviewed By: quark-zju
Differential Revision: D19656758
fbshipit-source-id: a97b8a092bff0bdc7e9dee0650c35ef383b32248
Summary:
This diff marks **ALL** mercurial tests requiring Python 2 feature.
After you fixes some tests, simply remove the `py2` feature requirement and that tests will be continuously run after your diff is landed.
To bypass this feature requirement, run the tests command with `HGTEST_FORCE_PY2=1`. For example:
```
HGTEST_FORCE_PY2=1 buck test //eden/scm/tests:hg_run_tests
```
or
```
HGTEST_FORCE_PY2=1 python run-tests.py
```
----
Basically this diff are created with the following commands:
```
$ sed -i 's/import feature\(.*\)$/import feature\1\n\nfeature.require(["py2"])/' test-*-t.py
$ sed -i '1s/^/#require py2\n/' test-*.t
$ ls | grep -P "^test.*(?<\!-t)\.py$" > list && vim -p $(cat list)
# manually adding feature requires for these Python tests.
```
(Note: this ignores all push blocking failures!)
ignore-conflict-markers
Reviewed By: singhsrb
Differential Revision: D19655148
fbshipit-source-id: 985e3ccb4010cc559049f1d89f8909bc2d9b5e20
Summary:
This is used in D19655148 to skip all the tests that are not passing in Python 3.
(Note: this ignores all push blocking failures!)
Reviewed By: farnz
Differential Revision: D19655164
fbshipit-source-id: 1a0d26926aa1b764077fa1e5bdddf853621a54f1
Summary: The urlreq.quote returns a byte string, let's use b string to manipulate it.
Reviewed By: farnz
Differential Revision: D19656773
fbshipit-source-id: 1cbcc0f19e9463d5eabec2f67f5b00329188777d
Summary: Reading/writing to files is done via bytes, not strings.
Reviewed By: quark-zju
Differential Revision: D19656321
fbshipit-source-id: 9a9b13b27fc9dd8db6fe757dcd53e4730179832d
Summary: These aren't bytes, they are strings.
Reviewed By: quark-zju
Differential Revision: D19656112
fbshipit-source-id: fcd505e3b4e522154358c80305e39ebca5936395
Summary:
Process the backupstate file as UTF-8. Previously it was being read as raw
bytes, causing the code to think it was an unknown version.
These files contain the version specifier (pure-ASCII), the remote path
(unicode), followed by a list of hexadecimal node IDs (pure-ASCII). Therefore
reading the whole file as UTF-8 should be fine.
Reviewed By: farnz
Differential Revision: D19655547
fbshipit-source-id: 6ca536d445cbf81b19122916f1b70b8895304bdb
Summary:
D19539064 disabled demandimport when using Python 3 as a precaution while we
were initially working on Python 3 support. However, it appears to work
correctly and does not seem to cause obvious problems when enabled.
This re-enables demand import by default. It can be explicitly disabled at
runtime by specifying `HGDEMANDIMPORT=disable` in the environment.
Reviewed By: xavierd, farnz
Differential Revision: D19655548
fbshipit-source-id: d56814049181da2d68abd09ac7ca772b04e06618
Summary:
When used in an `hg status` command the `relpath()` template function would
throw an unhandled `KeyError` when it tried to access `ctx` in the template
mapping. This field is only present in `hg log` templates, and is not present
in `hg status` templates.
This updates the `relpath()` template function to look for `repo` in the
template mapping instead. I also updated the `hg status` code to pass in the
`repo` value now. The `hg log` code already passes in this field.
Reviewed By: quark-zju
Differential Revision: D19568463
fbshipit-source-id: 3e1c1d6571c73e4b24bfce22ea28f57679d39846
Summary:
The sources are opened in byte mode, therefore the regexp needs to be a byte
one.
Reviewed By: singhsrb
Differential Revision: D19655928
fbshipit-source-id: 79b54cc5016dc47aee4fe6cf053f28bf04ba630c
Summary:
Bunch of read/writes to files were using plain strings, use byte strings
instead.
Reviewed By: quark-zju
Differential Revision: D19655101
fbshipit-source-id: 0cb70cbc51630d2c83752846774ff1a1c5ec9f41
Summary: The file is opened in binary mode, we need to write bytes into it.
Reviewed By: quark-zju
Differential Revision: D19655103
fbshipit-source-id: a2d059adff72db6c65e2933b3c64804325e51a71
Summary:
Make it possible to run edenscm via a "python package".
This makes it possible to run monkeytype [1] via debugpyhon:
./hg3 debugpython -- -m monkeytype run edenscm help log --pager=off
[1]: https://github.com/Instagram/MonkeyType
Reviewed By: farnz
Differential Revision: D19655850
fbshipit-source-id: 358f9dcf976141f798af2d57fb6392f2bca6a396
Summary: on file copies instead of contents we were commiting b'contents'
Reviewed By: markbt
Differential Revision: D19656501
fbshipit-source-id: e1cb0bdac79da851494318ce31396a2aca6c5754
Summary:
dott tests rig up a custom stdout/stderr. In Python 3 we expect them to
be strings, so we need to use an appropriate io object.
Unfortunatly upstream already created a pycompat.stringio object which uses
bytes for both python 3 and 2, so I had to use a new name for now.
Reviewed By: quark-zju
Differential Revision: D19653469
fbshipit-source-id: a529df5a2ab179c105fa441c4503ed6606e77543
Summary:
The C implementation of util.dirs doesn't work with Python 3. Instead of trying to port it, write an implementation in Rust that works in both Python 2 and Python 3.
The old implementation had a hack for flat dirstate to omit certain entries. Remove this hack as we now only use flat dirstate in tests and small repos. This simplifies the code in the fastpath case.
Reviewed By: quark-zju
Differential Revision: D19634699
fbshipit-source-id: cbb6562bc9a0209b13f67db3dfa5250800a9fcbe
Summary: `PyPath` is to `PyPathBuf` as `Path` is to `PathBuf` and `str` is to `String`.
Reviewed By: quark-zju
Differential Revision: D19647995
fbshipit-source-id: 841a5f6fea295bc72b00da028ae256ca38578504
Summary:
Fix some common errors when run `run-tests` in Python 3.
shlib would be using `str` for stdin/stdout instead of bytes as most of the code in Python 2 operates with that assumption. Getting it to `bytes` will take some work.
Reviewed By: DurhamG, quark-zju
Differential Revision: D19649475
fbshipit-source-id: 1f0190fce4df9a530246774fd17cdfc2d7974a65
Summary: These are Python 2 style print statements not surfaced during the tests. Mostly because they are used in `hg dbsh` or invoked with Mercurial's Python interrupter. So I did a ripgrep to find these statements and convert them into functions.
Reviewed By: farnz
Differential Revision: D19612968
fbshipit-source-id: 1b07e9c789ab834be692ba00fd58c575bc4a17bf
Summary: With this change `hg rm` works even with extensions enabled. Since this is a Cython extension, I did not bother adding type annotations since IIUC Pyre cannot type check Cython files.
Reviewed By: quark-zju
Differential Revision: D19652178
fbshipit-source-id: 2e03a0f241f80732bdae3f472a1e0576684b1911
Summary: This diff just adds the type hints for `memcommit` extension.
Reviewed By: quark-zju
Differential Revision: D19651074
fbshipit-source-id: 834a5980cded92641e4d368ce00d01a3dcaec330
Summary: We need to encode the key to be able to hash it.
Reviewed By: genevievehelsel
Differential Revision: D19651373
fbshipit-source-id: 214a3d127eb71a1c9cbf4ed1fec4f5a58f7f5195
Summary:
Importing directly from collection is deprecated, we should import from
collections.abc in Python3.
Reviewed By: DurhamG
Differential Revision: D19650852
fbshipit-source-id: b2e470e5fde3fe915944ae68a4274e47ed91071a
Summary:
A previous change requires the default value to be a tuple with 4 values,
fsmonitor was only passing 1.
Reviewed By: kulshrax
Differential Revision: D19652000
fbshipit-source-id: c9ae04109c61173a1df27ce653622dc4db653977
Summary:
Server reads & writes bytes. Convert between bytes and unicode where
neccessary in chgserver. Add some type annotations.
Reviewed By: xavierd
Differential Revision: D19645028
fbshipit-source-id: 1ad4bec25c398422112ee0ed1780ee9d704e6622
Summary:
Writing to the file should happen in bytes, so let's make the
journalentry serializer/deserializer convert from strings to bytes for us.
Reviewed By: xavierd
Differential Revision: D19650468
fbshipit-source-id: 3c13aff032ace1a15611c2370fc7d6ed44a6df34
Summary:
bundle2 parameter values are bytes, so when we compare the treemanifest
category with the bundle2 part category we need to encode the bundle2 part one.
Also fix wirepack to read utf8 paths.
Reviewed By: xavierd
Differential Revision: D19650197
fbshipit-source-id: 67da3bd8244f7953ec608019844988b20ad1929f
Summary: Username as utf8, so let's make mutationmarker treat them as such.
Reviewed By: xavierd
Differential Revision: D19649887
fbshipit-source-id: 3f8b2db434a57ee8ee3017de8d925c19a2002b20
Summary:
The commit context requires commit data to be bytes, but drawdag was using str
for it, breaking tests.
Reviewed By: DurhamG
Differential Revision: D19650219
fbshipit-source-id: 1409ce9a277c1c410ede8109989e07595378ff3e
Summary: This change all the tests to use strings as the command names.
Reviewed By: simpkins
Differential Revision: D19649479
fbshipit-source-id: 4b2cb9b3af73a7508ef359ee3c407d04a39c7893
Summary:
This is directly used in fctx.data() which expects bytes to be returned, encode
the return value of vfs.symlink.
Reviewed By: quark-zju
Differential Revision: D19647846
fbshipit-source-id: 966a5e79db6843c4bc6b802aeb90364e983cd834
Summary:
A previous diff missed these PyPath. As a bonus, replace most of the PyObject
into proper Rust types.
Reviewed By: quark-zju
Differential Revision: D19646139
fbshipit-source-id: a3b55e5a802d8bbef86e9a9431f605bb4e284b32
Summary:
changectx takes an arbitrary identifier and tries to resolve it. If it
takes a binary node and the node is not known, the fallback looksup don't accept
bytes and throw an exception. Let's stop early and raise the RepoLookupError.
Reviewed By: quark-zju
Differential Revision: D19643834
fbshipit-source-id: cfee39e0487f908ebd4ff628b847e53dec13c66e
Summary:
In Python 3, subprocess creates FileIO type pipes, which do one syscall
and are not guaranteed to return 'size' bytes. In Python 2 they're 'file' types
which are guaranteed to return 'size' bytes (via multiple syscalls).
So let's handle that case.
Reviewed By: quark-zju, xavierd
Differential Revision: D19648035
fbshipit-source-id: 7d04a67acc569a55d3a855fc8521f1b8261f4636
Summary:
remotenames are stored as unicode in memory and bytes on disk. We need
to convert before we write in this case.
Reviewed By: quark-zju
Differential Revision: D19648032
fbshipit-source-id: 4b96cf05eefd66ca031436d9979b94da8e28b8dd
Summary:
Follow up to the previous diff setting language_level to 3str for
`edenscmnative/clindex.pyx`. Consistent behavior for all files.
Reviewed By: quark-zju
Differential Revision: D19634907
fbshipit-source-id: 779d6090b5660e109a37f9740299fb9623d8f34d
Summary: Add `PyNone`. This is a marker struct that indicates that a python function can only return `PyNone`.
Reviewed By: xavierd
Differential Revision: D19644338
fbshipit-source-id: f846b146237ebf7de996177494934fec662cde0f
Summary:
When checking if a commit is valid explicitly check against the backing
repository rather than the Eden checkout. This makes the commit work
correctly if the Eden checkout's `.hg` directory has been corrupted but the
backing repository is still fine.
Reviewed By: genevievehelsel
Differential Revision: D19629959
fbshipit-source-id: 57992260332cbc1d6868813263fb3768b50db07e
Summary: Make the command server write and read bytes. Add type annotations.
Reviewed By: quark-zju
Differential Revision: D19642862
fbshipit-source-id: 2dfcd8f0c2e6124cc6afe1e85c0f5275e7fe5b1f
Summary:
`PyPath` is the type that owns the data. Rename it to `PyPathBuf` for analogy
with `PathBuf` and `RepoPathBuf`, and to allow us to introduce a reference type
named `PyPath`.
Reviewed By: xavierd
Differential Revision: D19643797
fbshipit-source-id: 56d80fea5677f7223e967b0723039d1763b26f68
Summary:
It was iterating over what it thought was a string, but in python3 it's
a byte string, which results in iterating over integers. So known always claimed
the server knew every commit.
Reviewed By: quark-zju
Differential Revision: D19644837
fbshipit-source-id: 4e84a33b4d3e436006f93a5d8e1bdabf12e7d120
Summary: The Python code expect paths to be unicode in Python3, not bytes.
Reviewed By: markbt
Differential Revision: D19643701
fbshipit-source-id: fa98da2daccccf70ac047a69b2e2359270f7e3d0
Summary:
Fix `threadedstderr` to stop directly deriving from `threading.Thread`.
Deriving directly from `threading.Thread` is somewhat tricky. Classes that
derive from `Thread` are only allowed to implement `__init__()` and `run()`.
This class also defined `close()`, which violates the `Thread` docs. Changing
this to no longer derive from `Thread` fixes exceptions being thrown when
trying to read from the SSH stderr pipe in this thread.
This also updates `_writessherror()` to decode the stderr data before writing
it to the `ui` object.
Reviewed By: quark-zju
Differential Revision: D19634265
fbshipit-source-id: bddd120c7995f49d3bbebbb171384d5b15b779e9
Summary: Various fixes to make it stop crashing
Reviewed By: quark-zju
Differential Revision: D19643879
fbshipit-source-id: 9dd0bcef5369b769a8c968ea86de0e8aaf640650
Summary:
Sparse logs the profile to scuba, but our logging data must be utf8.
Let's encode it first. We probably want to make this "replace" instead of
"strict" for the conversion once D19634265 lands.
Reviewed By: quark-zju
Differential Revision: D19643832
fbshipit-source-id: 550c67f194171ccdbd244bc79edfa1b999467824
Summary: Moves pull closer to working by appropriately encoding and decoding.
Reviewed By: quark-zju
Differential Revision: D19643833
fbshipit-source-id: d311fb897d15594f2cb644b15038866ce506e011
Summary:
Revlog did a type check against str. In python 3 it accepts bytes
instead, so we need to support that.
Reviewed By: xavierd
Differential Revision: D19634882
fbshipit-source-id: 04ae908b4bfe8ed5de7a6d41cbe748dcb34b2540
Summary:
cl.__contains__ does a "0 < rev <= len(repo)" check, so passing nodes
will always fail. In python 3 this causes a type error, so let's fix this.
Reviewed By: quark-zju
Differential Revision: D19634880
fbshipit-source-id: 011ab2f0c07a16fa45734d360ac952273c4fefc2
Summary: This preserves the Python errors across language boundaries.
Reviewed By: xavierd
Differential Revision: D19635355
fbshipit-source-id: 14ab8af38362182ca43951d4c560fa405687bf6e
Summary:
Make the type easier to use. Namely, the treestate bindings want PyPath <->
bytes since treestate internally uses bytes.
Reviewed By: xavierd
Differential Revision: D19635357
fbshipit-source-id: 37d1889b5da1d7f3869bb7820de0219b87b71a8b
Summary: Some strings had to stay as unicode
Reviewed By: quark-zju
Differential Revision: D19628661
fbshipit-source-id: 6ea191c60a4ef2ed98b2e2d3ab90c875e6eea248
Summary:
This causes the code to always treat unprefixed string literals as the `str`:
i.e., bytes in Python 2 and Unicode in Python 3. Without this setting our
unprefixed string literals were always being treated as unicode.
Reviewed By: lisroach
Differential Revision: D19634266
fbshipit-source-id: 770d7d03a96aa92a4e183819d34c72281c6c794b
Summary:
If the hg data in a checkout is corrupt running `hg` commands may cause
Mercurial to crash and print backtrace information. Hide this error output
when performing our `check_filesystems` checks.
The `check_hg` logic will already detect and handle corrupt repositories. If
the hg error messages are displayed directly to stderr when running the
`check_filesystems` checks earlier this just makes the output more confusing
to the user.
Reviewed By: genevievehelsel
Differential Revision: D19629960
fbshipit-source-id: 774287f37b216216be3eda2247307416d7ae4034
Summary: This diff makes `run-test.py` compatible with Python 3, so we can run this tests both in Python 3 and 2.
Differential Revision: D19611680
fbshipit-source-id: 97571cca7e1310e482ac8c03af73eb345ab825c1
Summary:
We temporarily pin these test tools to run with Python 2 so the tests can pass no matter if it is run with 3 or 2.
This diff also makes the fake biggrep client to be Python 3 compatible.
Reviewed By: farnz
Differential Revision: D19611681
fbshipit-source-id: 0c980165934899902b152e27a0a444d6a6c9eb2f
Summary: because of the test `type(b"") != type("")` we actually have different behavior in Python 3 and Python 2. So we remove this test temporarily and we can add it back later.
Reviewed By: sfilipco
Differential Revision: D19611682
fbshipit-source-id: 7bca979f8ef871672ac9666286c8d5e54747e8b3
Summary: This diff converts the rest of our tests to be compatible with Python 3. There are still a few tests are not fully compatible with Python 3 yet and I'll address these individually as they require major modifications.
Reviewed By: markbt
Differential Revision: D19608299
fbshipit-source-id: 3779dd0d4641ce8470598fa4909306317cf777d8
Summary:
In Python3 the result of filter is a class that does not have len
implemented. In Python2 the result of filter is a list.
Reviewed By: quark-zju
Differential Revision: D19629139
fbshipit-source-id: a7a1d9d831d72b2aab8b7a920bf82295c4673603
Summary:
Globs and patterns generally speaking. They should be typed as Str in
Python3 following how paths are typed.
Reviewed By: quark-zju
Differential Revision: D19628654
fbshipit-source-id: eeaede72f41258d6fe0f3cde26c434fe0b908b8b
Summary: File contents are read as bytes but content should be interpreted as utf-8.
Reviewed By: quark-zju
Differential Revision: D19628315
fbshipit-source-id: 523a201ddf57a2aabcd135156e71034c52b59adb
Summary:
The extra call to encode makes everything a big slower, fortunately python
standard library provides functions that do the right thing.
Reviewed By: xavierd
Differential Revision: D19634034
fbshipit-source-id: 6bb0de26300c41667824422c016e8d4f0aee70d3
Summary: This makes hg pull make more progress.
Reviewed By: mitrandir77
Differential Revision: D19630124
fbshipit-source-id: 6e8d6bd441353ffbf87076addd2774d5e09dd24a
Summary: I think my editor eat the spaces incorrectly. Fix it.
Reviewed By: xavierd
Differential Revision: D19630482
fbshipit-source-id: 3a8b94cdb269b045f678e07d0f21975effbaf7f9
Summary:
S194477 was caused by a config change adding a custom path to
repositories, where the path had the same url as default. This caused all the
remotebookmarks to be associated with the new path instead of default.
This is subtle and undesirable. Let's make it so that the default path takes
precedence.
I also deleted a hggit test because it was causing the entire test to be skipped
when dulwich wasn't available.
Reviewed By: quark-zju
Differential Revision: D19627711
fbshipit-source-id: 55b3ce94f18a26ccb9471c8e96a584d3087dbb82
Summary: The wireprotocol for streaming clones should be explicitly bytes, encoding filenames as UTF-8 when needed. Make it so
Reviewed By: quark-zju, xavierd
Differential Revision: D19616097
fbshipit-source-id: 3513c801035c8d7ba950777aa119e1d1480013a5
Summary: This allows edenapi to be able to fetch trees on Python3.
Reviewed By: quark-zju
Differential Revision: D19629411
fbshipit-source-id: f6abd585d8d672854f7219ef8e3ab86d2f659118
Summary:
Provide an option to run an external script that calculates the rename
destination. This is especially helpful for cases where development happened in
another branch and *directory* and want to merge changes back.
For example, we recently had an experimental `scm3` branch that copies files
from `scm` to `scm3` to try out changes:
o master <-- rebase destination
|
o (changes in scm/)
:
| o (changes that need to backport to scm/) <-- rebase source
| |
| o (changes in scm3/ that got implemented differently in scm/)
| :
| o (copy scm/ to scm3/ for experiments)
|/
o
This allows `--config experimental.rename-cmd='sed "s#scm3/#scm/#"'` to be
used for the above case.
While working on this feature, I noticed a bug that if the "copy" information
is recorded, rebase might lose changes. I added a test to track that bug.
Reviewed By: mitrandir77
Differential Revision: D19609868
fbshipit-source-id: 94462889d3ce9214b48fac793852d16aeacecc77