# HG changeset patch # User Raphaël Gomès # Date 2021-10-19 11:54:49 # Node ID d24bba52407de7a672603b645d1d98eb8f16e715 # Parent e9faae0f445c9f22757a3ded3265c4c273c33d5c backout: backed out changeset 2f2107c01dee (+1 change) Following discussion on the original Phabricator patch, we've agreed to back out this change until Python 2 is dropped since it's simpler than figuring out why the Python 2 version doesn't behave the same. The additional change is the one in test-chg.t since the error type changes back but only for Python 3. diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -252,14 +252,9 @@ def dispatch(req): err = e status = -1 - # Somehow we have to catcht he exception here; catching it inside - # _flushstdio() doesn't work. - try: - ret = _flushstdio(req.ui, err) - if ret and not status: - status = ret - except BaseException: - pass + ret = _flushstdio(req.ui, err) + if ret and not status: + status = ret return status @@ -322,10 +317,7 @@ def _rundispatch(req): ret = -1 finally: duration = util.timer() - starttime - try: - req.ui.flush() # record blocked times - except BaseException: - pass + req.ui.flush() # record blocked times if req.ui.logblockedtimes: req.ui._blockedtimes[b'command_duration'] = duration * 1000 req.ui.log( @@ -349,10 +341,7 @@ def _rundispatch(req): except: # exiting, so no re-raises ret = ret or -1 # do flush again since ui.log() and exit handlers may write to ui - try: - req.ui.flush() - except BaseException: - pass + req.ui.flush() return ret @@ -473,10 +462,7 @@ def _runcatch(req): try: return _dispatch(req) finally: - try: - ui.flush() # record blocked times - except BaseException: - pass + ui.flush() except: # re-raises # enter the debugger when we hit an exception if req.earlyoptions[b'debugger']: diff --git a/tests/test-chg.t b/tests/test-chg.t --- a/tests/test-chg.t +++ b/tests/test-chg.t @@ -185,6 +185,17 @@ in this test. > bulkwrite = $TESTTMP/bulkwrite.py > EOF +#if py3 + $ chg bulkwrite --pager=on --color no --config ui.formatted=True + paged! 'going to write massive data\n' + killed! (?) + [255] + + $ chg bulkwrite --pager=on --color no --config ui.formatted=True + paged! 'going to write massive data\n' + killed! (?) + [255] +#else $ chg bulkwrite --pager=on --color no --config ui.formatted=True paged! 'going to write massive data\n' killed! (?) @@ -194,6 +205,7 @@ in this test. paged! 'going to write massive data\n' killed! (?) [250] +#endif $ cd .. diff --git a/tests/test-pager.t b/tests/test-pager.t --- a/tests/test-pager.t +++ b/tests/test-pager.t @@ -219,7 +219,8 @@ use shell=True in the subprocess call: #endif A complicated pager command gets worse behavior. Bonus points if you can -improve this. +improve this. Windows apparently does this better, but only sometimes? +#if windows $ hg log --limit 3 \ > --config pager.pager='this-command-better-never-exist --seriously' \ > 2>/dev/null || true @@ -239,6 +240,11 @@ improve this. date: Thu Jan 01 00:00:00 1970 +0000 (?) summary: modify a 8 (?) (?) +#else + $ hg log --limit 3 \ + > --config pager.pager='this-command-better-never-exist --seriously' \ + > 2>/dev/null || true +#endif Pager works with shell aliases.