Skip to content
Snippets Groups Projects
  1. Feb 01, 2025
    • Pierre-Yves David's avatar
      overlayctx: build a memctx that can access non touched files · f071b18e
      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.
      f071b18e
  2. Jan 25, 2025
  3. Jan 24, 2025
  4. Jan 29, 2025
  5. Jan 30, 2025
  6. Jan 27, 2025
  7. Jan 30, 2025
  8. Jan 27, 2025
  9. Jan 29, 2025
  10. Nov 30, 2024
  11. Nov 29, 2024
    • Pierre-Yves David's avatar
      perf: disable progress by default in stream-generate · 492de5c0
      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)
      492de5c0
  12. Nov 28, 2024
  13. Jan 07, 2025
    • Matt Harbison's avatar
      typing: add some type annotations to the `wireprotoframing` module · 068398a8
      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.
      068398a8
  14. Jan 13, 2025
    • Matt Harbison's avatar
      typing: add type annotations for wireprotoframing encoder/decoder classes · 1a612f9e
      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.
      1a612f9e
    • Matt Harbison's avatar
      typing: add some type annotations to the `merge.mergeresult` class · f3762eaf
      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.
      f3762eaf
    • Matt Harbison's avatar
      streamclone: unbyteify string args to builtin Error classes · 10e7adbf
      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.
      10e7adbf
    • Matt Harbison's avatar
      typing: add trivial type annotations to `mercurial/streamclone.py` · f5471af9
      Matt Harbison authored
      These are the easy/obvious/documented ones.  We'll leave the harder ones for
      later.
      f5471af9
    • Matt Harbison's avatar
      cborutil: unbyteify string args to builtin Error classes · 8a2091a2
      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`.
      8a2091a2
    • Matt Harbison's avatar
      typing: add type annotations to most of `mercurial/utils/cborutil.py` · 5e09c6b5
      Matt Harbison authored
      These are the easy/obvious/documented ones.  We'll leave the harder ones for
      later.
      5e09c6b5
    • Matt Harbison's avatar
      typing: lock in the type annotations that were lost with the pyupgrade changes · 45dc0f87
      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.
      45dc0f87
  15. Jan 07, 2025
  16. Jan 15, 2025
  17. Jan 14, 2025
  18. Jan 23, 2025
  19. Jan 14, 2025
  20. Jan 13, 2025
  21. Jan 14, 2025
  22. Jan 13, 2025
    • Matt Harbison's avatar
      hghave: drop redundant parentheses · 1f76fd3e
      Matt Harbison authored
      Even fewer complaints from PyCharm now.
      1f76fd3e
    • Matt Harbison's avatar
      hghave: make the `ignorestatus` argument to `matchoutput()` a bool · e1c5d823
      Matt Harbison authored
      That's how PyCharm was seeing it because of the default param, so it was
      flagging the callers that passed an int.  Fewer yellow ticks are better (26
      remain).
      e1c5d823
    • Matt Harbison's avatar
      hghave: byteify the `regexp` arg to `matchoutput()` · 6ed726d1
      Matt Harbison authored
      This started failing in CI because a str was passed.  All other callers already
      pass bytes, and it's not clear why this started failing with a MR to use
      `setuptools-scm` to derive the version when building.  Clearly the
      `if checks["hg09"][0]()` prior to these usages were working before, and that's
      how it was overlooked.  But that check apparently continued to work for me
      locally in both Linux and Windows, as I can only hit this issue in CI.
      6ed726d1
  23. Oct 25, 2024
    • Pierre Augier's avatar
      packaging: get version with setuptools-scm · 30510238
      Pierre Augier authored
      Now that Mercurial is compatible with PEP 517, i.e. that setup.py is called
      by a PEP 517 frontend (pip, build, pipx, UV, ...) in an isolated environment,
      we can use setuptools-scm to obtain the version when building from the repo.
      
      After these changes, it is no longer supported to get the version from the
      repo when Mercurial is not installed.
      
      Of course, it is still possible to install Mercurial from source without
      Mercurial by getting an archive of the repo or the sdist on PyPI.
      
      A case becomes slightly more complicated: building mercurial from source in
      an environment where you cannot download anything from the web. One would
      need to get setuptools and setuptools-scm wheels from PyPI, transfer them
      to the computer, create a venv, install setuptools and setuptools-scm with
      pip in the venv and install Mercurial with
      `pip install . --no-build-isolation`.
      
      Of course, it is still very simple to install Mercurial in an environment
      where you cannot download anything from the web: just get a wheel and install.
      No need for setuptools and setuptools-scm in this case.
      30510238
  24. Jan 21, 2025
    • Mitchell Kember's avatar
      rust-revlog: fix storage.revlog.mmap.index logic · 8370eb2c
      Mitchell Kember authored
      This ensures that revlogs only use mmap when revlog.mmap.index is true (or
      defaulted to true based on can_populate_mmap()). This config previously had no
      effect because the code in its if-branch was accidentally duplicated below.
      8370eb2c
Loading