Mon, 10 Apr 2017 16:50:41 +0200 obsolescence: add test case C-1 for obsolescence markers exchange
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Mon, 10 Apr 2017 16:50:41 +0200] rev 31965
obsolescence: add test case C-1 for obsolescence markers exchange About 3 years ago, in August 2014, the logic to select what markers to select on push was ported from the evolve extension to Mercurial core. However, for some unclear reasons, the tests for that logic were not ported alongside. I realised it a couple of weeks ago while working on another push related issue. I've made a clean up pass on the tests and they are now ready to integrate the core test suite. This series of changesets do not change any logic. I just adds test for logic that has been around for about 10 versions of Mercurial. They are a patch for each test case. It makes it easier to review and postpone one with documentation issues without rejecting the wholes series. This patch introduce C-1: Multiple pruned changeset atop each other Each test case comes it in own test file. It help parallelism and does not introduce a significant overhead from having a single unified giant test file. Here are timing to support this claim. # Multiple test files version: # run-tests.py --local -j 1 test-exchange-*.t 53.40s user 6.82s system 85% cpu 1:10.76 total 52.79s user 6.97s system 85% cpu 1:09.97 total 52.94s user 6.82s system 85% cpu 1:09.69 total # Single test file version: # run-tests.py --local -j 1 test-exchange-obsmarkers.t 52.97s user 6.85s system 85% cpu 1:10.10 total 52.64s user 6.79s system 85% cpu 1:09.63 total 53.70s user 7.00s system 85% cpu 1:11.17 total
Tue, 11 Apr 2017 14:54:12 -0700 stdio: add Linux-specific tests for error checking
Bryan O'Sullivan <bryano@fb.com> [Tue, 11 Apr 2017 14:54:12 -0700] rev 31964
stdio: add Linux-specific tests for error checking
Tue, 11 Apr 2017 14:54:12 -0700 stdio: raise StdioError if something goes wrong in ui.flush
Bryan O'Sullivan <bryano@fb.com> [Tue, 11 Apr 2017 14:54:12 -0700] rev 31963
stdio: raise StdioError if something goes wrong in ui.flush The prior code used to ignore all errors, which was intended to deal with a decade-old problem with writing to broken pipes on Windows. However, that code inadvertantly went a lot further, making it impossible to detect *all* I/O errors on stdio ... but only sometimes. What actually happened was that if Mercurial wrote less than a stdio buffer's worth of output (the overwhelmingly common case for most commands), any error that occurred would get swallowed here. But if the buffering strategy changed, an unhandled IOError could be raised from any number of other locations. Because we now have a top-level StdioError handler, and ui._write and ui._write_err (and now flush!) will raise that exception, we have one rational place to detect and handle these errors.
Tue, 11 Apr 2017 14:54:12 -0700 stdio: raise StdioError if something goes wrong in ui._write_err
Bryan O'Sullivan <bryano@fb.com> [Tue, 11 Apr 2017 14:54:12 -0700] rev 31962
stdio: raise StdioError if something goes wrong in ui._write_err The prior code used to ignore certain classes of error, which was not the right thing to do.
Tue, 11 Apr 2017 14:54:12 -0700 stdio: raise StdioError if something goes wrong in ui._write
Bryan O'Sullivan <bryano@fb.com> [Tue, 11 Apr 2017 14:54:12 -0700] rev 31961
stdio: raise StdioError if something goes wrong in ui._write
Tue, 11 Apr 2017 14:54:12 -0700 stdio: catch StdioError in dispatch.run and clean up appropriately
Bryan O'Sullivan <bryano@fb.com> [Tue, 11 Apr 2017 14:54:12 -0700] rev 31960
stdio: catch StdioError in dispatch.run and clean up appropriately We attempt to report what went wrong, and more importantly exit the program with an error code. (The exception we catch is not yet raised anywhere in the code.)
Tue, 11 Apr 2017 14:54:12 -0700 stdio: add machinery to identify failed stdout/stderr writes
Bryan O'Sullivan <bryano@fb.com> [Tue, 11 Apr 2017 14:54:12 -0700] rev 31959
stdio: add machinery to identify failed stdout/stderr writes Mercurial currently fails to notice failures to write to stdout or stderr. A correctly functioning command line tool should detect this and exit with an error code. To achieve this, we need a little extra plumbing, which we start adding here.
Tue, 11 Apr 2017 14:54:12 -0700 atexit: switch to home-grown implementation
Bryan O'Sullivan <bryano@fb.com> [Tue, 11 Apr 2017 14:54:12 -0700] rev 31958
atexit: switch to home-grown implementation
Tue, 11 Apr 2017 14:54:12 -0700 atexit: test failing handlers
Bryan O'Sullivan <bryano@fb.com> [Tue, 11 Apr 2017 14:54:12 -0700] rev 31957
atexit: test failing handlers
Tue, 11 Apr 2017 14:54:12 -0700 ui: add special-purpose atexit functionality
Bryan O'Sullivan <bryano@fb.com> [Tue, 11 Apr 2017 14:54:12 -0700] rev 31956
ui: add special-purpose atexit functionality In spite of its longstanding use, Python's built-in atexit code is not suitable for Mercurial's purposes, for several reasons: * Handlers run after application code has finished. * Because of this, the code that runs handlers swallows exceptions (since there's no possible stacktrace to associate errors with). If we're lucky, we'll get something spat out to stderr (if stderr still works), which of course isn't any use in a big deployment where it's important that exceptions get logged and aggregated. * Mercurial's current atexit handlers make unfortunate assumptions about process state (specifically stdio) that, coupled with the above problems, make it impossible to deal with certain categories of error (try "hg status > /dev/full" on a Linux box). * In Python 3, the atexit implementation is completely hidden, so we can't hijack the platform's atexit code to run handlers at a time of our choosing. As a result, here's a perfectly cromulent atexit-like implementation over which we have control. This lets us decide exactly when the handlers run (after each request has completed), and control what the process state is when that occurs (and afterwards).
(0) -30000 -10000 -3000 -1000 -300 -100 -10 +10 +100 +300 +1000 +3000 +10000 tip