Skip to content
Snippets Groups Projects
  1. Feb 20, 2025
    • Pierre-Yves David's avatar
      cleanup: drop the LIBDIR related code · 33e06272ff1a
      Pierre-Yves David authored
      This code is no longer used as the python packaging echo system evolved.
      
      This code was introduced in 10da5a1f25dd, with two feature in mind:
      
      - Mercurial may be installed into a non-standard location without
        having to set PYTHONPATH.
      - Multiple installations can use Mercurial from different locations.
      
      As a side effect it also provided performance improvement at a time where the
      `sys.path` could be greatly inflated from setuptools `.pth` files. And it also
      protected from incompatible directory within the `$PTYHONPATH` variable. Both of
      these benefit has faded overtime as `.pth` are less common and `$PYTHONPATH` is
      less used (as both where creating issue to more than just Mercurial).
      
      The initial motivation (easily install Mercurial anywhere), can now be handled
      by a new generation of tool like pipx or uv, so it is less of a concern.
      
      Regardless of all the above, the current code is no longer used. The evolution
      of python packaging means that installation always go through first building a
      location agnostic "wheel" that cannot update LIBDIR to a proper location.
      Upstream packaging (debian, redhat, etc…) does not seems to adjust this variable
      themself. So it is safer to drop this dead code that pretend we could be doing
      something with it.
      33e06272ff1a
  2. Sep 16, 2024
    • Matt Harbison's avatar
      typing: add `from __future__ import annotations` to most files · f4733654f144
      Matt Harbison authored
      Now that py36 is no longer supported, we can postpone annotation evaluation.
      This means that the quoting is usually optional (for things imported under the
      guard of `if typing.TYPE_CHECKING:` to avoid circular imports), and there's less
      overhead on startup[1].
      
      There may be some missing here.  I backed out 6000f5b25c9b (which removed the
      `from __future__ import ...` that was supporting py2), reverted the changes in
      `contrib/`, `doc/`, and `tests/`, and then ran:
      
          $ hg status -n --change . | \
              xargs sed -i -e 's/from __future__ import .*$/from __future__ import annotations/'
      
      There were some minor tweaks needed when reviewing (mostly making the spacing
      around the import consistent, and `mercurial/testing/__init__.py` had a
      multiline import that wasn't fully rewritten.
      
      [1] https://docs.python.org/3/whatsnew/3.7.html#pep-563-postponed-evaluation-of-annotations
      f4733654f144
  3. Apr 20, 2023
  4. Mar 09, 2022
  5. Mar 03, 2022
  6. Aug 26, 2021
  7. Mar 25, 2021
  8. Dec 07, 2020
    • Matt Harbison's avatar
      hg: add user-site to `sys.path` on Windows to allow pip-installed extensions · 7740d5102760
      Matt Harbison authored
      This has been in the TortoiseHg builds for several cycles now on Windows, and
      even longer on macOS.  It allows an extension to be configured with `ext =`
      syntax, instead of requiring the full path to be specified.  It's confusing for
      a user to be hit with messages about not being able to load extensions, based
      solely on which `hg.exe` is being run.
      
      This only applies to py2exe binaries, since wrapper.exe already sees into the
      user site area.  There are no frozen binaries on other platforms (that I'm aware
      of), and an equivalent change will need to be made to `dispatch.py` in order to
      work with PyOxidizer, since it bypasses this module completely.  (It also has
      the ability to use the `site` module, so it will look completely different.)
      
      Differential Revision: https://phab.mercurial-scm.org/D9531
      7740d5102760
  9. Nov 06, 2020
    • Gregory Szorc's avatar
      global: use python3 in shebangs · c102b704edb5
      Gregory Szorc authored
      Python 3 is the future. We want Python scripts to be using Python 3
      by default.
      
      This change updates all `#!/usr/bin/env python` shebangs to use
      `python3`.
      
      Does this mean all scripts use or require Python 3: no.
      
      In the test environment, the `PATH` environment variable in tests is
      updated to guarantee that the Python executable used to run
      run-tests.py is used. Since test scripts all now use
      `#!/usr/bin/env python3`, we had to update this code to install
      a `python3` symlink instead of `python`.
      
      It is possible there are some random scripts now executed with the
      incorrect Python interpreter in some contexts. However, I would argue
      that this was a pre-existing bug: we should almost always be executing
      new Python processes using the `sys.executable` from the originating
      Python script, as `python` or `python3` won't guarantee we'll use the
      same interpreter.
      
      Differential Revision: https://phab.mercurial-scm.org/D9273
      c102b704edb5
  10. Nov 15, 2019
    • Gregory Szorc's avatar
      black: blacken scripts · 99e231afc29c
      Gregory Szorc authored
      test-check-format.t doesn't appear to detect Python scripts with shebangs.
      But my editor which is configured to auto run black on Python files does
      and it appears some files are not blackened.
      
      This commit blackens scripts that need it.
      
      # skip-blame reformatting
      
      Differential Revision: https://phab.mercurial-scm.org/D7420
      99e231afc29c
  11. Oct 05, 2019
  12. Aug 21, 2018
  13. Oct 02, 2017
  14. Aug 22, 2017
  15. May 21, 2017
    • Siddharth Agarwal's avatar
      init: turn on demandimport for Python 3.6 and above · b4810bf95c03
      Siddharth Agarwal authored
      This uses the new demandimport implementation for Python 3 introduced in
      previous patches.
      
      This doesn't yet enhance performance because it isn't integrated with the
      custom source file loader we use on Python 3. We'll integrate the two in
      upcoming patches.
      b4810bf95c03
  16. May 11, 2016
  17. Apr 05, 2016
  18. Jun 23, 2014
    • durin42's avatar
      hg: add support for HGUNICODEPEDANTRY environment variable · 73e4a02e6d23
      durin42 authored
      This lets us easily verify that there are no implicit conversions
      between unicodes and bytes in Mercurial's codebase. Based on something
      mpm did by hand periodically, but it kept regressing, so just open the
      door to running it in a buildbot.
      73e4a02e6d23
  19. May 06, 2011
  20. Oct 21, 2010
  21. Aug 17, 2010
  22. Jan 20, 2010
  23. Apr 25, 2009
  24. Jan 19, 2009
  25. Nov 10, 2007
    • Patrick Mezard's avatar
      Change standard streams mode to binary at hg startup · a3fe91b4f6eb
      Patrick Mezard authored
      Standard streams are expected to operate in binary mode everywhere, especially with archive, cat, diff and export commands. Rewriting these to separate informational output from binary content is complicated to do and to maintain, nonwithstanding mode switching reliability. Changing all output mode to binary should not have much impact on Windows were stream processing tools are barely used and usually cope with unix style endings.
      
      Streams mode being process wide, the switch is performed in the startup script to avoid polluting existing API users who may have solved this issue already or ignored it at least for the mercurial part.
      a3fe91b4f6eb
  26. Aug 18, 2007
  27. Aug 15, 2007
  28. Jun 19, 2007
  29. Dec 13, 2006
  30. Feb 06, 2006
  31. Jun 29, 2005
    • mpm's avatar
      Whitespace cleanups · 03f27b1381f9
      mpm authored
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1
      
      Whitespace cleanups
      
      manifest hash: ac954bc3a4f034c12638a259ecd65841f5b63c5c
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.0 (GNU/Linux)
      
      iD8DBQFCwuubywK+sNU5EO8RAluIAJ98XQpNdZUpSmYKgDmrMRlbL76ZzQCfes0t
      rknNUN/PhtyA4bzL646dOz4=
      =UyCE
      -----END PGP SIGNATURE-----
      03f27b1381f9
  32. Jun 24, 2005
    • mpm's avatar
      Release tweaks · 12e0fdbc57a0
      mpm authored
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1
      
      Release tweaks
      
      manifest hash: ded5f9b4432ab05c28d6e0ca56adbf3d14b8e6f6
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.0 (GNU/Linux)
      
      iD8DBQFCvGzZywK+sNU5EO8RAlzYAJ4ix4F5cKYXBo8L6UwwZJbnZa7RpgCgme9H
      ByLO3Pcf9RSmQEO6vxYfuLs=
      =7fKS
      -----END PGP SIGNATURE-----
      0.6
      12e0fdbc57a0
  33. Jun 08, 2005
    • mpm's avatar
      Mark the usual things executable · a69c3b2957d1
      mpm authored
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1
      
      Mark the usual things executable
      
      manifest hash: e55dde46fd1a97ce338c1ac71278b67ca9d96bf7
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.0 (GNU/Linux)
      
      iD8DBQFCpz5RywK+sNU5EO8RAnypAJwLpjrQ09nMSJUELtCondHI0fvuVACfQu2J
      mFi9D3L9ULGO457NWB4h3kY=
      =3bcD
      -----END PGP SIGNATURE-----
      a69c3b2957d1
  34. Jun 04, 2005
    • mpm's avatar
      import and startup cleanups · 619e775aa7f9
      mpm authored
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1
      
      import and startup cleanups
      
      add commands:run()
      add copyright notice to commands
      eliminate/reorganize imports to speed up start time:
      
      0.5b:
      $ time bash -c 'for i in `seq 100`; do ~/bin/hg > /dev/null; done'
      
      real    0m7.718s
      user    0m6.719s
      sys     0m0.794s
      
      new:
      
      $ time bash -c 'for i in `seq 100`; do hg > /dev/null; done' 
      real    0m2.171s
      user    0m1.684s
      sys     0m0.444s
      
      just python:
      
      $ time bash -c 'for i in `seq 100`; do python -c pass; done' 
      real    0m0.988s
      user    0m0.771s
      sys     0m0.207s
      
      Ignoring the fixed cost of loading the Python interpreter, we're 5.6
      times faster. With the Python load time, we're still 3.5 times faster.
      
      manifest hash: acce5882a55c76eb165316f5741724c8ce4ef587
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.0 (GNU/Linux)
      
      iD8DBQFCoihAywK+sNU5EO8RAqMdAJwMe6Ur0R9G6jjayNa5hH2C3c4k/gCeIYvc
      N178vaWWGciX9zq+g5qCAls=
      =buhv
      -----END PGP SIGNATURE-----
      619e775aa7f9
    • mpm's avatar
      migrate remaining commands · b7645b3c86ff
      mpm authored
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1
      
      migrate remaining commands
      
      This removes basically everything from the top-level hg script
      
      manifest hash: 34883e89d8def30e28936b38a9342d2f650f4c94
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.0 (GNU/Linux)
      
      iD8DBQFCoiD7ywK+sNU5EO8RAh0cAKCeOO9vahYs0tGmMNKk8bflw35p2wCgr6Wr
      y0SNLHSVBMCzXtC9zlfDPog=
      =3nJx
      -----END PGP SIGNATURE-----
      b7645b3c86ff
    • mpm's avatar
      migrate verify · 863b508c5b36
      mpm authored
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1
      
      migrate verify
      
      Move the bulk of the verify code into the localrepository class and move
      the command into commands.py
      
      manifest hash: 793a8d0094d56ab0a411cd11d7fe7f39c923f209
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.0 (GNU/Linux)
      
      iD8DBQFCog33ywK+sNU5EO8RApfBAJ4mCmiMmZE1fEfbR6sA+aP1csPvqQCfXHzY
      3XK7yc19AivXf5HGKEOL3eM=
      =GISf
      -----END PGP SIGNATURE-----
      863b508c5b36
    • mpm's avatar
      Migrate rawcommit, import, export, history, and merge · 96cde50a746f
      mpm authored
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1
      
      Migrate rawcommit, import, export, history, and merge
      
      manifest hash: f932108ee40e34b460e94b6fe60d6a06ac9f760c
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.0 (GNU/Linux)
      
      iD8DBQFCoguVywK+sNU5EO8RAtohAKCe9Qr5R+YeLRluJlTxRGrJW/nnoQCfW/+F
      I0BSOeNpb6jdUxTZY1jV0xo=
      =hNXm
      -----END PGP SIGNATURE-----
      96cde50a746f
    • mpm's avatar
      big heap of command clean-up work · fef0f8e041aa
      mpm authored
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1
      
      big heap of command clean-up work
      
      Migrate add, forget, remove, commit, diff, addremove, tip, log,
      recover, and serve.
      
      Fix up filterfiles, relfilter, and relpath to be a bit more bulletproof
      
      Alphabetize functions and the command table
      
      Make everything in commands.py relative-path aware
      
      manifest hash: f0856031a7be4e49289677b467f29bcf24ebce4a
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.0 (GNU/Linux)
      
      iD8DBQFCof6gywK+sNU5EO8RAoW1AJsHu8vchPSjls7wVbvsq/UKlGhqtgCgtnnl
      xSBxyf/TEVWjHIk3uTa8WSE=
      =YPMl
      -----END PGP SIGNATURE-----
      fef0f8e041aa
    • mpm's avatar
      Resolve bits from TAH · afe895fcc0d0
      mpm authored
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1
      
      Resolve bits from TAH
      
      manifest hash: dc639d419de857b22da9f707cbb557c328eb12f5
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.0 (GNU/Linux)
      
      iD8DBQFCoRIaywK+sNU5EO8RAswQAKCiEcQ5RV3C2JZXgQBch28VO3NpSgCdEzcD
      Td8bV8IKVUIXtvrcy1rCZTY=
      =tAU7
      -----END PGP SIGNATURE-----
      afe895fcc0d0
  35. Jun 03, 2005
Loading