161 def copy(self): |
156 def copy(self): |
162 """return an deep copy of the branchcache object""" |
157 """return an deep copy of the branchcache object""" |
163 if util.safehasattr(self, '_entries'): |
158 if util.safehasattr(self, '_entries'): |
164 _entries = self._entries |
159 _entries = self._entries |
165 else: |
160 else: |
166 # hg <= 4.9 (624d6683c705, b137a6793c51) |
161 # hg <= 4.9 (624d6683c705+b137a6793c51) |
167 _entries = self |
162 _entries = self |
168 new = self.__class__(_entries, self.tipnode, self.tiprev, |
163 new = self.__class__(_entries, self.tipnode, self.tiprev, |
169 self.filteredhash, self._closednodes) |
164 self.filteredhash, self._closednodes) |
170 new.phaseshash = self.phaseshash |
165 new.phaseshash = self.phaseshash |
171 return new |
166 return new |
235 assert issubclass(current, new), (current, new, targetclass) |
230 assert issubclass(current, new), (current, new, targetclass) |
236 |
231 |
237 def uisetup(ui): |
232 def uisetup(ui): |
238 wrapclass(branchmap, 'branchcache', _topiccache) |
233 wrapclass(branchmap, 'branchcache', _topiccache) |
239 try: |
234 try: |
240 # Mercurial 4.8 and older |
235 # hg <= 4.9 (3461814417f3) |
241 extensions.wrapfunction(branchmap, 'read', wrapread) |
236 extensions.wrapfunction(branchmap, 'read', wrapread) |
242 except AttributeError: |
237 except AttributeError: |
243 # Mercurial 4.9; branchcache.fromfile now takes care of this |
238 # Mercurial 5.0; branchcache.fromfile now takes care of this |
244 # which is alredy defined on _topiccache |
239 # which is alredy defined on _topiccache |
245 pass |
240 pass |
246 extensions.wrapfunction(wireproto, '_capabilities', wireprotocaps) |
241 extensions.wrapfunction(wireprotov1server, '_capabilities', wireprotocaps) |
247 extensions.wrapfunction(context.changectx, 'branch', topicbranch) |
242 extensions.wrapfunction(context.changectx, 'branch', topicbranch) |