- Jan 05, 2025
-
-
Matt Harbison authored
It's know to fail, but I want a public CI run to show what breaks when legacy stdio is actually not used, but don't want to prune it just yet.
-
- Jan 03, 2025
-
-
Matt Harbison authored
This doesn't work because dispatch.py imports procutil, which does its setup of stdio outside of any function. That means replacing stdio here results in it not being at the closest to the OS (the procutil stuff is), and output is lost when the pager is spun up (but again not when explicitly piped to the pager). Womp womp. Maybe we can move this code to procutil (it already calls something in the windows module to wrap stdout/stderr), but it would have to be done first, prior to all of the other wrapping. Note there is a comment in there around line 162 about maybe needing a silly unicode wrapper if `.buffer` doesn't exist... that seems to be what this is. The comment in here is probably still useful, and I wonder if the `encoding` arg should be based on the `encoding.encoding` value instead of a hardcoded 'mbcs'. Ditto the `errors` being based on `encoding.encodingmode`, so that `HGENCODING` and `HGENCODINGMODE` respectively are honored. Otherwise, this is a lesson in what not to do.
-
Matt Harbison authored
PyCharm was yapping that these are final, but when I commented them out, I got a very early crash related to checking isatty() on a closed file descriptor. This fixes that, though I suspect it would be even simpler to do the replacement in the windows module. On the one hand, we do want this setup very early in the process. OTOH, the pager isn't configured until after stdio is customized. And if there is some error output that happens before that, writing bytes without the pager and without enabling legacy stdio seems to work. Aside: I wonder why we have custom line buffering classes in procutil if there's line buffering setup on stdio in dispatch, just below this. A python2 holdover maybe?
-
- Jan 05, 2025
-
-
Matt Harbison authored
I realized that the test runner also sets this, because a lot of the test modules also do stdio in bytes, so setting this in the runner fixed a lot of failures. We'll have to port whatever fix is made to hg itself to all of the needed places in the test modules (and we can make this smarter by only conditionally clearing it if a couple of test variables are also set), but for now, keep it simple.
-
- Jan 03, 2025
-
-
Matt Harbison authored
We need to stop doing this in order to exercize the new code in the previous commit. The environment variable can still be manually set to revert to the previous state of things that has been used since py3 support was added, for now. We should try to get away from it entirely though, because this problem affects more than what is written up in issue6952.[1] I've tested locally with the `hg.exe` form of this, and the tests pass. That gives me some hope, but 1) the pager wouldn't typically be used in tests due to the runner capturing the output, unless a pager is explicitly requested (like a few tests do), and 2) the tests are basically all ascii characters anyway, so that's kind of hard to screw up. (The test runner sets `HGENCODING=ascii`, I assume for portability, so that's unlikely to change. I've also managed to generate corrupt file names when trying to write a test for an issue with non-ascii file names[2], using code that works perfectly fine outside the test runner. But we do seem to be getting the output that was previously missing, and the project CI system will cover `hg.bat` when it tests the wheels.) [1] mercurial/tortoisehg/thg#5854 [2] mercurial/tortoisehg/thg#5923
-
Pierre Augier authored
Fix issue6952.
-
- Jan 07, 2025
-
-
Jörg Sonnenberger authored
-
- Jan 31, 2025
-
-
Arseniy Alekseyev authored
Before this commit, `hg status` was issuing multiple `write` syscalls per line printed, separately writing out the path and the status fragments. This change makes hg status on large number of files significantly faster, going from 1.8s to 1.2s in one case. This requires adding the color information to `StdoutBuffer`, and moving the formatting functions from ui to it. I made `StdoutBuffer` generic over the underlying writer, without insisting on BufWriter, because I anticipated the need to use it with both full-buffered and line-buffered writers. That didn't end up being necessary, but I think the code is still better this way.
-
- Jan 30, 2025
-
-
Pierre-Yves David authored
The issue with reusing the lock from another repository is that various internal state are no longer correct, the main example of that is the dirstate, captured in the wlock to make sure it is written (when needed) on lock release. So instead, we create a proper lock from the repository, but "stealing" the on-disk lock from the previous object. This is a bit weird, but less than the previous situation.
-
- Dec 20, 2024
-
-
Pierre-Yves David authored
This makes the call clearer.
-
- Feb 01, 2025
-
-
Raphaël Gomès authored
This is just a small obvious cleanup opportunity.
-
Pierre-Yves David authored
Including more context yield more false positive when detecting patch modification. The impact of this change is mostly seen in evolve's tests.
-
Pierre-Yves David authored
So far, the memctx was very optimized for being committed: so it did not need to access any untouched files. However the way we uses it in evolve to diff against more arbitrary changes requires to be able to access to any file content as any other ctx. This is now the case.
-
- Jan 25, 2025
-
-
Pierre Augier authored
-
- Jan 24, 2025
-
-
Pierre Augier authored
-
Pierre Augier authored
`py -3.9 run-tests.py --local` was broken on default (`ModuleNotFoundError` for `mercurial`). see !1207 (comment 379493)
-
- Jan 29, 2025
-
-
Pierre-Yves David authored
This canno hurt.
-
Pierre-Yves David authored
This is a bit shooting in the dark, but this probably does not hurt to apply the same helper as the `test-run-tests.t` file.
-
- Jan 30, 2025
-
-
Pierre Augier authored
-
- Jan 27, 2025
-
-
Pierre Augier authored
-
- Jan 30, 2025
-
-
Pierre Augier authored
-
- Jan 27, 2025
-
-
Pierre Augier authored
-
- Jan 29, 2025
-
-
Pierre Augier authored
Now that setuptools-scm is used, it is better to have a static MANIFEST.in file. From https://setuptools-scm.readthedocs.io: > Additionally setuptools-scm provides setuptools with a list of files that > are managed by the SCM (i.e. it automatically adds all the SCM-managed files to the sdist).
-
- Nov 30, 2024
-
-
Pierre-Yves David authored
This is closer to real life situation.
-
Pierre-Yves David authored
This avoid doing read access at the same time as write access and abstract the read time. It consume "quite some" memory for large repository through. Doing this speedup the command on a mozilla try clone by about 15%, helping us to focus on processing time instead.
-
- Nov 29, 2024
-
-
Pierre-Yves David authored
Progress can take a signifiant time and that is not what we are measuring it. This can impact the benchmark result when the command is run in a terminal. (looking at how much time is consume is now possible, but a quest for another day)
-
- Nov 28, 2024
-
-
Pierre-Yves David authored
See inline documentation and next commit for details.
-
Pierre-Yves David authored
Strictly speaking we could also do that for v1, but that is old enough that I don't want to bother.
-
Pierre-Yves David authored
Seems more logical. We also take this as an opportunity to explicitly track bytes count in "v2" as relying on progress internal start is error prone.
-
Pierre-Yves David authored
We do the same things in multiple place and it is starting to itch.
-
- Jan 07, 2025
-
-
Matt Harbison authored
`flushcommands()` and a few other generators got a slightly modified return type after the pyupgrade series ending with 70a75d379daf. This fixes those, and grabs some other low and mid hanging fruit here. Note that there are possibly two bugs detected here- in the `inputstream` and `outputstream` classes, the `flush()` and `finish()` methods respectively have surprising issues. pytype flagged the latter when the return value was typed, but it surprisingly doesn't see the lack of `flush()` on the `Decoder` class. I wonder if either of these are the cause of the occasional odd-length string error I see in the `hg serve` output from time to time. In any event, punt those changes down the road for now, and mark with a TODO.
-
- Jan 13, 2025
-
-
Matt Harbison authored
This was low hanging fruit, and will point out an apparent programming bug. The arguments are left untyped for now, because the internal compressors and decompressors generally take a `Buffer` object, and return bytes. I've had issues around using `typing_extensions.Buffer` with pytype in the past, but also the identity classes return the argument unmodified, so that will break the type annotation. We'd probably need an instance check, and a cast if it's not bytes. Having to roll up all of the encoder and decoder types into a union type is a bit annoying, but the protocol class can't be used in the map because it then assumes that type will be instantiated. I also couldn't get it to work with a `TypeVar` bound to indicate that it's actually a subclass either. Oh well.
-
Matt Harbison authored
The generated type annotations around `filemap()` and `files()` were slightly modified by the pyupgrade series culminating in 70a75d379daf. This module is way more complicated than the other changes, but these weren't too bad to figure out. The typing caught a trivial issue in `sparse`- it was passing an empty data list to `addfile()` for the `ACTION_REMOVE` case, instead of a tuple or None. `merge.manifestmerge()` calls this function with None for the data, so 1) it has to be typed as optional, and 2) is safe to pass None in the sparse code.
-
Matt Harbison authored
This avoids printing the error with a `b''` prefix in the case of `ValueError`. The custom `ProgrammingError` class is special in that it won't do that, and can take either bytes or str. But there's no point in passing bytes when it is just going to decode to str at runtime anyway.
-
Matt Harbison authored
These are the easy/obvious/documented ones. We'll leave the harder ones for later.
-
Matt Harbison authored
This avoids printing the error with a `b''` prefix. The `CBORDecodeError` class subclasses `Exception`, not one of the usual error classes in `mercurial.error`.
-
Matt Harbison authored
These are the easy/obvious/documented ones. We'll leave the harder ones for later.
-
Matt Harbison authored
For some reason, these reverted from a specific type to something less useful after the changes that culminated in 70a75d379daf. (e.g. the `remotefilectx` method went from `Generator[remotefilectx, Any, None]` to `Generator[nothing, Any, None]`.) The previous typing for `merge.filemap` was `Generator[Tuple[Any, Tuple[Any, Any, Any]], Any, None]`, and decayed to `Generator[nothing, Any, None]`. I don't feel like unravelling the specific types here, so restore the equivalent of that.
-
- Jan 07, 2025
-
-
Matt Harbison authored
After the changes culminating in 70a75d379daf, pytype was able to detect these types better (typically changing from something like `Generator[Any, Any, None]` to `Generator[bytes, Any, None]`). Let's make these explicit so they don't disappear because of other changes.
-
- Jan 15, 2025
-
-
Pierre Augier authored
-