Mercurial > hg
view hgext/purge.py @ 48185:2f2107c01dee
dispatch: ignore failure to flush ui
When the pager dies, we get a `SIGPIPE`. That causes
`error.SignalInterrupt` to be raised ` (from `ui._catchterm()`). Any
further writes or flushes will cause further `SIGPIPE`s and furhter
`error.SignalInterrupt`. If we write or flush outside of the
try/except that handle `KeyboardInterrupt` (which
`error.SignalInterrupt` is a subclass of), then control will escape
from the `dispatch` module. Let's fix that by ignoring errors from
flushing the ui.
I would have rather fixed this by restoring the stdout and stderr
streams when the pager dies, but it gets complicated because of
multiple ui instances (ui/lui) and different pager setups between
regular hg and chg.
This changes a test in `test-pager.t`, but I don't understand why. I
would have thought that all the output from the command should have
gone to the broken pager.
Differential Revision: https://phab.mercurial-scm.org/D11627
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 08 Oct 2021 13:36:02 -0700 |
parents | 0caac68a5c3c |
children | 1c5810ce737e |
line wrap: on
line source
# Copyright (C) 2006 - Marco Barisione <marco@barisione.org> # # This is a small extension for Mercurial (https://mercurial-scm.org/) # that removes files not known to mercurial # # This program was inspired by the "cvspurge" script contained in CVS # utilities (http://www.red-bean.com/cvsutils/). # # For help on the usage of "hg purge" use: # hg help purge # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <http://www.gnu.org/licenses/>. '''command to delete untracked files from the working directory (DEPRECATED) The functionality of this extension has been included in core Mercurial since version 5.7. Please use :hg:`purge ...` instead. :hg:`purge --confirm` is now the default, unless the extension is enabled for backward compatibility. ''' # This empty extension looks pointless, but core mercurial checks if it's loaded # to implement the slightly different behavior documented above. # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should # be specifying the version(s) of Mercurial they are tested with, or # leave the attribute unspecified. testedwith = b'ships-with-hg-core'