Skip to content
Snippets Groups Projects
  1. Jan 30, 2025
  2. Jan 29, 2025
  3. Jan 30, 2025
  4. Jan 27, 2025
  5. Jan 30, 2025
  6. Jan 27, 2025
  7. Jan 29, 2025
  8. Jan 28, 2025
  9. Nov 30, 2024
  10. Nov 29, 2024
    • Pierre-Yves David's avatar
      perf: disable progress by default in stream-generate · 492de5c0ecdd
      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)
      492de5c0ecdd
  11. Nov 28, 2024
  12. Jan 07, 2025
    • Matt Harbison's avatar
      typing: add some type annotations to the `wireprotoframing` module · 068398a8c9cb
      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.
      068398a8c9cb
  13. Jan 13, 2025
    • Matt Harbison's avatar
      typing: add type annotations for wireprotoframing encoder/decoder classes · 1a612f9ec2c4
      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.
      1a612f9ec2c4
    • Matt Harbison's avatar
      typing: add some type annotations to the `merge.mergeresult` class · f3762eafed66
      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.
      f3762eafed66
    • Matt Harbison's avatar
      streamclone: unbyteify string args to builtin Error classes · 10e7adbffa8c
      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.
      10e7adbffa8c
    • Matt Harbison's avatar
      typing: add trivial type annotations to `mercurial/streamclone.py` · f5471af96a52
      Matt Harbison authored
      These are the easy/obvious/documented ones.  We'll leave the harder ones for
      later.
      f5471af96a52
    • Matt Harbison's avatar
      cborutil: unbyteify string args to builtin Error classes · 8a2091a2f974
      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`.
      8a2091a2f974
    • Matt Harbison's avatar
      typing: add type annotations to most of `mercurial/utils/cborutil.py` · 5e09c6b5b795
      Matt Harbison authored
      These are the easy/obvious/documented ones.  We'll leave the harder ones for
      later.
      5e09c6b5b795
    • Matt Harbison's avatar
      typing: lock in the type annotations that were lost with the pyupgrade changes · 45dc0f874b8c
      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.
      45dc0f874b8c
  14. Jan 07, 2025
  15. Jan 15, 2025
  16. Jan 14, 2025
  17. Jan 23, 2025
  18. Jan 14, 2025
  19. Jan 13, 2025
  20. Jan 14, 2025
  21. Jan 13, 2025
Loading