Matt Harbison <matt_harbison@yahoo.com> [Mon, 18 Apr 2022 14:20:58 -0400] rev 49078
git: un-byteify the `mode` argument for the builtin `open()`
I guess this was assuming `pycompat.open` was imported, but it's not here or
elsewhere in the git extension.
Differential Revision: https://phab.mercurial-scm.org/D12568
Matt Harbison <matt_harbison@yahoo.com> [Mon, 18 Apr 2022 11:21:09 -0400] rev 49077
git: adapt to some recent dirstate API changes
There are still old methods like add() and drop(). I don't see anything that
looks equivalent, so there's likely more work to do. But this allows diff and
commit to work again on the simple webpage repo for thg.
Differential Revision: https://phab.mercurial-scm.org/D12567
Matt Harbison <matt_harbison@yahoo.com> [Mon, 18 Apr 2022 11:15:29 -0400] rev 49076
idirstate: add missing get_entry() method
Differential Revision: https://phab.mercurial-scm.org/D12566
Matt Harbison <matt_harbison@yahoo.com> [Wed, 13 Apr 2022 15:02:01 -0400] rev 49075
windows: disable pager when packaged with py2exe
With Windows and py3, all output that got directed to the pager was lost. It
can be worked around by the user piping to `more`, but that's easy to forget,
and can be dangerous if `hg diff` or similar incorrectly shows no changes. The
problem appears to be the new WindowsConsoleIO in py3.6[1]. We've worked around
it with PyOxidizer by setting the `Py_LegacyWindowsStdioFlag` interpreter
option, and worked around it with `hg.bat` and `exewrapper.c` by internally
setting `PYTHONLEGACYWINDOWSSTDIO=1`.
Unfortunately, py2exe doesn't appear to be able to set the interpreter option,
and somehow seems to also ignore the environment variable. The latter isn't a
good fix anyway, since setting it in the environment would affect other python
programs too. We can't install a global config for this because a config closer
to the user (e.g. from before pager was turned on by default) can override it.
[1] https://peps.python.org/pep-0528/
Differential Revision: https://phab.mercurial-scm.org/D12556
Matt Harbison <matt_harbison@yahoo.com> [Wed, 13 Apr 2022 14:37:57 -0400] rev 49074
resourceutil: force filesystem access to resources when using py2exe
I don't know why it doesn't work, but it avoids this fatal error on startup:
> hg debugshell
Traceback (most recent call last):
File "hg", line 58, in <module>
File "mercurial\dispatch.pyc", line 143, in run
File "mercurial\dispatch.pyc", line 232, in dispatch
File "mercurial\dispatch.pyc", line 254, in _rundispatch
File "mercurial\ui.pyc", line 316, in load
File "mercurial\rcutil.pyc", line 98, in rccomponents
File "mercurial\rcutil.pyc", line 68, in default_rc_resources
File "mercurial\utils\resourceutil.pyc", line 102, in contents
File "<frozen zipimport>", line 775, in contents
AssertionError
I assume the py2 version of py2exe never hit this because `importlib.resources`
failed to import.
Differential Revision: https://phab.mercurial-scm.org/D12554
Matt Harbison <matt_harbison@yahoo.com> [Wed, 13 Apr 2022 14:25:13 -0400] rev 49073
setup: fix the py2exe logic to work with py3
TortoiseHg still uses (the modernized) py2exe packaging, but the build was
failing since `py2exe.Distribution` was removed.
One thing to note is that later in this module, there's a hack to include
`distutils` when building from a virtualenv. While `import distutils` works in
`hg debugshell` when built with py2, it doesn't work in py3. I'm not sure why-
I don't see it in `library.zip` either. It doesn't seem to break anything
though.
Differential Revision: https://phab.mercurial-scm.org/D12553
Martin von Zweigbergk <martinvonz@google.com> [Wed, 13 Apr 2022 07:58:49 -0700] rev 49072
absorb: make `--edit-lines` imply `--apply-changes`
One of our users tried to use `hg absorb -e` but it seemed that it
would only bring up the editor if there were no changes the command
could automatically detect destination for. I spent probably half an
hour debugging why it worked that way. I finally figured out that it
does bring up the editor, but you have to answer "yes" to the "apply
changes" prompt *first*. That seems very unintuitive. If the user
wants to edit the changes, there seems to be little reason to present
them with a prompt first, so let's have `-e/--edit-lines` imply
`-a/--apply-changes`. All the tests using `-e` also already used
`-a`. I changed them to rely on the implied `-a` so we get coverage of
that.
Differential Revision: https://phab.mercurial-scm.org/D12550