1. 14 Dec, 2019 2 commits
  2. 22 Jun, 2020 1 commit
  3. 14 Apr, 2020 2 commits
  4. 14 Jul, 2020 1 commit
    • Martin von Zweigbergk's avatar
      extensions: make `hg nonexistent` not crash with PyOxidizer · 5d09a120b4be
      Martin von Zweigbergk authored
      When running `hg nonexistent`, we try to look for extensions that
      provide that command. We do that by looking for files in the
      `hgext.__file__` directory. However, PyOxidizer doesn't provide a
      `__file__`, so we crash when running with PyOxidizer.
      We should be able to look for the command in built-in extensions, but
      we seem to already have code for skipping the scan when running in a
      frozen binary, so I just modified that code instead.
      By the way, it also seems like we should be able to search for
      extensions in the `hgext3rd` module, but we don't do that yet either
      (before or after this patch).
      Differential Revision: https://phab.mercurial-scm.org/D8750
  5. 09 Jul, 2020 1 commit
  6. 15 Jul, 2020 1 commit
  7. 13 Jul, 2020 2 commits
  8. 09 Jul, 2020 1 commit
  9. 15 Jul, 2020 1 commit
  10. 06 Jul, 2020 1 commit
  11. 09 Jul, 2020 2 commits
    • Manuel Jacob's avatar
      tests: check that procutil.std{out,err}.write() returns correct result · dff208398ede
      Manuel Jacob authored
      On Windows, we currently don’t fully test the case when the stream is connected
      to a TTY, but we test the child process side by connecting them to NUL, which
      is recognized as a TTY by Python. To make the large write test a bit more
      useful besides checking that it doesn’t crash, we can check that the write()
      method returns the correct result.
    • Manuel Jacob's avatar
      tests: add tests for when stdout or stderr is connected to `os.devnull` · e9e452eafbfb
      Manuel Jacob authored
      The original motivation was that creating PTYs on Windows is not possible, but
      `NUL` is recognized as a TTY, so we can have at least some test coverage for
      the TTY case. I think it doesn’t hurt to run the test cases on all systems.
  12. 10 Jul, 2020 1 commit
    • Manuel Jacob's avatar
      procutil: ensure that procutil.std{out,err}.write() writes all bytes · 8e04607023e5
      Manuel Jacob authored
      Python 3 offers different kind of streams and it’s not guaranteed for all of
      them that calling write() writes all bytes.
      When Python is started in unbuffered mode, sys.std{out,err}.buffer are
      instances of io.FileIO, whose write() can write less bytes for
      platform-specific reasons (e.g. Linux has a 0x7ffff000 bytes maximum and could
      write less if interrupted by a signal; when writing to Windows consoles, it’s
      limited to 32767 bytes to avoid the "not enough space" error). This can lead to
      silent loss of data, both when using sys.std{out,err}.buffer (which may in fact
      not be a buffered stream) and when using the text streams sys.std{out,err}
      (I’ve created a CPython bug report for that:
      Python may fix the problem at some point. For now, we implement our own wrapper
      for procutil.std{out,err} that calls the raw stream’s write() method until all
      bytes have been written. We don’t use sys.std{out,err} for larger writes, so I
      think it’s not worth the effort to patch them.
  13. 11 Jul, 2020 1 commit
    • Manuel Jacob's avatar
      procutil: move assignments · b4c35e439ea5
      Manuel Jacob authored
      This should probably be part of the previous patch, but folding it results in a
      less useful word diff, so I decided to keep it separate for review.
  14. 10 Jul, 2020 1 commit
    • Manuel Jacob's avatar
      procutil: distribute code for stdout · 63196198dbf0
      Manuel Jacob authored
      It makes sense to have the distinction between Python 2 and 3 at the top level,
      as we have to fight a different kind of battle on each: On Python 3, we get
      consistent behavior on all platforms, but need to create correctly-behaving
      binary streams. On Python 2, we have to account for platform differences.
  15. 14 Jul, 2020 1 commit
  16. 11 Jul, 2020 3 commits
  17. 10 Jul, 2020 2 commits
  18. 09 Jul, 2020 3 commits
  19. 13 Jul, 2020 1 commit
  20. 10 Jul, 2020 4 commits
  21. 07 Jul, 2020 1 commit
  22. 08 Jul, 2020 2 commits
    • Manuel Jacob's avatar
      archival: abort if compression method is unavailable · 2c0043977b6d
      Manuel Jacob authored
      `tarfile.CompressionError` is documented to be the "exception for unavailable
      compression methods".
      Also, make tests conditional on whether the lzma module is available or not.
    • Manuel Jacob's avatar
      demandimport: ignore `lzma` module for demandimport · 40120de810ba
      Manuel Jacob authored
      This makes importing the module fail if the `_lzma` module is not present.
      This makes e.g. tarfile correctly recognize if LZMA support is not present. It
      changes the exception
          File "/usr/lib/python3.6/tarfile.py", line 1694, in xzopen
            fileobj = lzma.LZMAFile(fileobj or name, mode, preset=preset)
        AttributeError: module 'lzma' has no attribute 'LZMAFile'
      to the more correct exception
          File "/usr/lib/python3.6/tarfile.py", line 1692, in xzopen
            raise CompressionError("lzma module is not available")
        tarfile.CompressionError: lzma module is not available
      Also, it prevents that the error "abort: No module named '_lzma'!" is shown when
      a development warning is to be shown. The reason why that happened is that for
      showing the warning, we get information about the stack frames from the inspect
      module, which accesses the `__file__` attribute of all modules in `sys.modules`
      to build some cache, causing all modules (including `lzma`) to be imported.
  23. 11 Jul, 2020 1 commit
    • Manuel Jacob's avatar
      procutil: back out 8403cc54bc83 (make ....procutil.stderr unbuffered) · fa270dcbdb55
      Manuel Jacob authored
      Changeset 8403cc54bc83 introduced code that opens a second file object
      referring to the stderr file descriptor. This broke tests on Windows. The
      reason is that on Windows, sys.stderr is buffered and procutil.stderr closed
      the file descriptor when it got garbage collected before sys.stderr had the
      chance to flush buffered data.
      `procutil.stdout` had the same problem for a long time, but we didn’t realize,
      as in CI test runs, stdout is not a TTY and in this case no second file object
      is opened.
  24. 09 Jul, 2020 1 commit
  25. 21 May, 2020 1 commit
    • Jörg Sonnenberger's avatar
      hooklib: fix detection of successors for changeset_obsoleted · 04ef381000a8
      Jörg Sonnenberger authored
      Provide a hook for obsutil.getobsolete to be used with either a
      transaction or the changes item of the transaction, since hooks only
      have access to the latter. Use that to find the correct list of
      revisions with obsmarkers, even new ones, and then filter out revisions
      with known successors.
      Move the processing from pretxnclose to txnclose as the transaction
      access itself is no longer necessary. This is more in line with notify
      and ensures that sanity checks can abort the transaction first.
      Differential Revision: https://phab.mercurial-scm.org/D8575
  26. 10 Jul, 2020 2 commits