- 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.
-
- Dec 17, 2024
-
-
Matt Harbison authored
These were unlocked by 8de9bab826bc, so lock them in.
-
- Dec 16, 2024
-
-
Matt Harbison authored
-
Matt Harbison authored
It looks like `BaseIndexObject` is meant to be a base class with common implementation across the subclasses. Both subclasses provide the class attrs typed here, as well as `_calculate_index()` that are accessed by the base class. The trick is, `revlog.RustIndexProxy` also uses it as a base class, and forwards some methods such that it doesn't want or need this method. This is kind of a workaround to keep everything happy. Likewise, it doesn't need the 3 class variables, because it overrides the methods in this class that use them. But there's no way to conditionally declare these. Their presence seems conditional on the version of Python- see 199b0e62b403. (Also, it looks like the rust class doesn't override `append()`, which would need `_extra`. Not sure if this is an oversight, or if it's more of a "protected" field instead of private.) `PersistentNodeMapIndexObject` says it's for debugging, so I'm not going to bother trying to figure out what the 3 required class attr types are right now, and risk introducing a cycle that confuses pytype.
-
- Dec 17, 2024
-
-
Matt Harbison authored
-
Matt Harbison authored
-
Matt Harbison authored
I wanted to use `util.readfiles()` here, but it looks like very little core code is imported, and I assume that's by design?
-
Matt Harbison authored
The file never got closed if the write failed, but take the opportunity to simplify the method with the corresponding util functions.
-
Matt Harbison authored
-
Matt Harbison authored
No changes here, other than running `black`.
-
Matt Harbison authored
Not sure why there's an `os.stat()` here- I'd expect any errors that it might hit to also be hit by attempting to open the file in read mode. It goes all the way back to a9343f9d7365 in 2006, and mentions making things more secure, so I'll leave it be for now.
-
Matt Harbison authored
-
Matt Harbison authored
-
Matt Harbison authored
Also put a comment here, because I initially thought opening in non-binary mode was a mistake, but 7cc913396f8c did it purposely.
-
Matt Harbison authored
I suppose the first case isn't fully fixed (i.e. if `os.fdopen()` raises an exception), but this handles the majority of the potential exceptions. Closing the second file is especially important on Windows, because `os.unlink()` can't delete an open file.
-
Matt Harbison authored
The one in `shallowutil` is especially important, because the caller may try to delete the file. That generally doesn't work on Windows when the file is open.
-
Matt Harbison authored
-
Matt Harbison authored
It only would have happened in an exception case, but there are now language contructs to tighten this up.
-
Matt Harbison authored
-
Matt Harbison authored
`patch.linereader()` isn't a context manager, rather a simple iterator over a file descriptor. So let's manage the fd outside of it.
-
Matt Harbison authored
Two possible leaks here, plus I bungled aa31c8566fb8 trying to read the file in binary mode, and instead gave the `rb` arg meant for `open()` as a second arg to `get()`. Instead, use the `util` function for readability.
-
Matt Harbison authored
-
Matt Harbison authored
No changes here, other than indent and running `black`.
-
Matt Harbison authored
-
Matt Harbison authored
I have no idea how to fix this because `wireprototypes.streamreslegacy()` doesn't consume the generator before the return from this method, and then things get lost in the wire protocol layers.
-
Matt Harbison authored
Since we're already importing the `util` module, use its `readfile()` method that had the same code, with a context manager.
-
Matt Harbison authored
Not as big of a deal as a file that might need to be renamed/moved, but the fd counts against process resources, so it should be managed.
-
Matt Harbison authored
This was noticed when migrating away from `pycompat.open()` this cycle.
-
- Dec 30, 2024
-
-
Arseniy Alekseyev authored
Remove the `name` field from the `SubCommand` record, make it an accessor instead, which makes the record smaller, and the macro smaller.
-
- Dec 13, 2024
-
-
Arseniy Alekseyev authored
Add a command `script::hgignore --print-re` to print the hgignore regexp. One complication is that the `rootfilesin`-only matcher doesn't use a regular expression, and the existing converts it to something that's not a regular expression. We add code to handle that case. Since this command is now sufficient to generate a tidy-looking regexp for scripting, this frees up the "debug" command to report the internal regexp used by the regex engine, so we make that change too.
-
- Dec 06, 2024
-
-
Arseniy Alekseyev authored
Rework how we convert patterns to regexes in rust. Instead of going patterns -> string -> Regex, which is slow and causes some correctness issues, build a structured regex_syntax::hir::Hir value, which is faster and it also prevents surprising regex escape. This change makes the time of `build_regex_match` go from ~70-80ms to ~40ms in my testing (for a large hgignore). The bug I mentioned involves regex patterns that "escape" their intended scope. For example, a sequence of hgignore regexp patterns like this would previously lead to surprising behavior: foo(?: bar baz ) this matches foobar and foobaz, and doesn't match bar and baz. The new behavior is to report a pattern parse error The Python hg also has this bug, so this bugfix not really helping much, but it's probably better to fall back to real Python bugs than to simulate them.
-
- Dec 22, 2024
-
-
Felipe Resende authored
When recursing into a subrepository all the paths were being passed on to them. However, each subrepository is mapped to only one destination (subrepository state uses the destination to derive the final path). The for loop is responsible for recursing into the subrepository for each destination so we only need to pass the current destination. If we have the following repository structure parent/sub/sub_sub, and call outgoing to parent_p1 and parent_p2, the outgoing method will be called with the following arguments: dests = (parent_p1, parent_p2), subpath = None dests = (parent_p1 path.loc, ), subpath = sub dests = (parent_p1 path.loc, ), subpath = sub/sub_sub dests = (parent_p2 path.loc, ), subpath = sub dests = (parent_p2 path.loc, ), subpath = sub/sub_sub Then, the subrepositories absolute path will be formed concatenating both arguments. If subpath is absolute, dests is ignored.
-
- Dec 29, 2024
-
-
Felipe Resende authored
calling `hg outgoing` to multiple paths was not working with subrepositories
-
- Dec 04, 2024
-
-
Pierre Augier authored
-
- Nov 28, 2024
-
-
Pierre Augier authored
pip has no option like this since one should instead use the standard environment variables (CC and co).
-
- Dec 13, 2024
-
-
Matt Harbison authored
VS 2017 was getting old, and 2022 is the latest supported compiler[1]. The exact bootstrapper here is the newly released LTSC 17.12.3, which looks to be supported until July 2026[2]. In making this change, I'm switching to the exported config settings file, because it's easier to open the bootstrapper, select the things needed, and then export to a file than figuring out all of the component names from the website. Somehow, I missed the x86/x64 compiler adapting the previous command line args. Also, the file nicely cleans up a very long command line. [1] https://wiki.python.org/moin/WindowsCompilers#Microsoft_Visual_C.2B-.2B-_14.x_with_Visual_Studio_2022_.28x86.2C_x64.2C_ARM.2C_ARM64.29 [2] https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history#fixed-version-bootstrappers
-
- Dec 14, 2024
-
-
Matt Harbison authored
This is needed in order to build Windows wheels, because we force the translations to be built. The default options are good enough (i.e. it is added to `PATH`).
-
- Dec 12, 2024
-
-
Matt Harbison authored
Not sure why this was turned off originally, but this config puts the launcher in `%WINDOWS%\py.exe`, and is able to launch any of these privately installed pythons. The only caveat I see is the python install will fail if a newer one is already installed. But as this script is structured, it installs the oldest python first, so it upgrades it as needed when installing on a clean system.
-
Matt Harbison authored
-