Patchwork D7675: util: move common proxyobserver attributes to the base class

login
register
mail settings
Submitter phabricator
Date Dec. 17, 2019, 4:44 p.m.
Message ID <6926c105e7d7f14fd53efc9c60e940d1@localhost.localdomain>
Download mbox | patch
Permalink /patch/43927/
State Not Applicable
Headers show

Comments

phabricator - Dec. 17, 2019, 4:44 p.m.
Closed by commit rHG4222b9d5d4fb: util: move common proxyobserver attributes to the base class (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7675?vs=18739&id=18817

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7675/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7675

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -787,6 +787,12 @@ 
 
 
 class baseproxyobserver(object):
+    def __init__(self, fh, name, logdata, logdataapis):
+        self.fh = fh
+        self.name = name
+        self.logdata = logdata
+        self.logdataapis = logdataapis
+
     def _writedata(self, data):
         if not self.logdata:
             if self.logdataapis:
@@ -823,10 +829,7 @@ 
     def __init__(
         self, fh, name, reads=True, writes=True, logdata=False, logdataapis=True
     ):
-        self.fh = fh
-        self.name = name
-        self.logdata = logdata
-        self.logdataapis = logdataapis
+        super(fileobjectobserver, self).__init__(fh, name, logdata, logdataapis)
         self.reads = reads
         self.writes = writes
 
@@ -949,13 +952,10 @@ 
         logdata=False,
         logdataapis=True,
     ):
-        self.fh = fh
-        self.name = name
+        super(socketobserver, self).__init__(fh, name, logdata, logdataapis)
         self.reads = reads
         self.writes = writes
         self.states = states
-        self.logdata = logdata
-        self.logdataapis = logdataapis
 
     def makefile(self, res, mode=None, bufsize=None):
         if not self.states: