Patchwork [6,of,7] blackbox: do not nullify repo to deactivate the logger on failure

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 27, 2018, 12:57 p.m.
Message ID <47d8e701444c98d35579.1543323463@mimosa>
Download mbox | patch
Permalink /patch/36814/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 27, 2018, 12:57 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1542455785 -32400
#      Sat Nov 17 20:56:25 2018 +0900
# Node ID 47d8e701444c98d355794b1a398e25840557a2b1
# Parent  abd5a060c6c9dfd455ecec7ff8a4f6a831ea8060
blackbox: do not nullify repo to deactivate the logger on failure

The _repo will be a mandatory attribute. Instead, make the logger to not
track any events.

Patch

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -184,7 +184,7 @@  class blackboxlogger(object):
                 fp.write(fmt % args)
         except (IOError, OSError) as err:
             # deactivate this to avoid failed logging again
-            self._repo = None
+            self._trackedevents.clear()
             ui.debug('warning: cannot write to blackbox.log: %s\n' %
                      encoding.strtolocal(err.strerror))