Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 37321:e826fe7a08c7
peer: make ui an attribute
With abc interfaces, instance attributes could not satisfy
@abc.abstractproperty requirements because interface conformance
was tested at type creation time. When we created the abc
peer interfaces, we had to make "ui" a @property to satisfy
abc.
Now that peer interfaces are using zope.interface and there is no
import time validation (but there are tests validating instances
conform to the interface), we can go back to using regular object
attributes.
Differential Revision: https://phab.mercurial-scm.org/D3069
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 30 Mar 2018 18:57:13 -0700 |
parents | 836867586b83 |
children | fdd22bf6398f |
comparison
equal
deleted
inserted
replaced
37320:39f7d4ee8bcd | 37321:e826fe7a08c7 |
---|---|
160 super(localpeer, self).__init__() | 160 super(localpeer, self).__init__() |
161 | 161 |
162 if caps is None: | 162 if caps is None: |
163 caps = moderncaps.copy() | 163 caps = moderncaps.copy() |
164 self._repo = repo.filtered('served') | 164 self._repo = repo.filtered('served') |
165 self._ui = repo.ui | 165 self.ui = repo.ui |
166 self._caps = repo._restrictcapabilities(caps) | 166 self._caps = repo._restrictcapabilities(caps) |
167 | 167 |
168 # Begin of _basepeer interface. | 168 # Begin of _basepeer interface. |
169 | |
170 @util.propertycache | |
171 def ui(self): | |
172 return self._ui | |
173 | 169 |
174 def url(self): | 170 def url(self): |
175 return self._repo.url() | 171 return self._repo.url() |
176 | 172 |
177 def local(self): | 173 def local(self): |