hgext3rd/topic/topicmap.py
branchmercurial-4.6
changeset 5368 844b1ad5b34b
parent 5193 a4d081923c81
equal deleted inserted replaced
5284:0471b9ddd0b2 5368:844b1ad5b34b
   123     class topiccache(_topiccache, branchmap.branchcache):
   123     class topiccache(_topiccache, branchmap.branchcache):
   124         pass
   124         pass
   125     branchmap.branchcache = topiccache
   125     branchmap.branchcache = topiccache
   126 
   126 
   127     try:
   127     try:
   128         # Mercurial 4.9
   128         # Mercurial 5.0
   129         class remotetopiccache(_topiccache, branchmap.remotebranchcache):
   129         class remotetopiccache(_topiccache, branchmap.remotebranchcache):
   130             pass
   130             pass
   131         branchmap.remotebranchcache = remotetopiccache
   131         branchmap.remotebranchcache = remotetopiccache
   132 
   132 
   133         def _wrapupdatebmcachemethod(orig, self, repo):
   133         def _wrapupdatebmcachemethod(orig, self, repo):
   134             # pass in the bound method as the original
   134             # pass in the bound method as the original
   135             return _wrapupdatebmcache(orig.__get__(self), repo)
   135             return _wrapupdatebmcache(orig.__get__(self), repo)
   136         extensions.wrapfunction(branchmap.BranchMapCache, 'updatecache', _wrapupdatebmcachemethod)
   136         extensions.wrapfunction(branchmap.BranchMapCache, 'updatecache', _wrapupdatebmcachemethod)
   137     except AttributeError:
   137     except AttributeError:
   138         # Mercurial 4.8 and before
   138         # hg <= 4.9 (3461814417f3)
   139         extensions.wrapfunction(branchmap, 'updatecache', _wrapupdatebmcache)
   139         extensions.wrapfunction(branchmap, 'updatecache', _wrapupdatebmcache)
   140 
   140 
   141 
   141 
   142 def _wrapupdatebmcache(orig, repo):
   142 def _wrapupdatebmcache(orig, repo):
   143     previous = getattr(repo, '_autobranchmaptopic', False)
   143     previous = getattr(repo, '_autobranchmaptopic', False)
   171     def copy(self):
   171     def copy(self):
   172         """return an deep copy of the branchcache object"""
   172         """return an deep copy of the branchcache object"""
   173         if util.safehasattr(self, '_entries'):
   173         if util.safehasattr(self, '_entries'):
   174             _entries = self._entries
   174             _entries = self._entries
   175         else:
   175         else:
   176             # hg <= 4.9 (624d6683c705, b137a6793c51)
   176             # hg <= 4.9 (624d6683c705+b137a6793c51)
   177             _entries = self
   177             _entries = self
   178         new = self.__class__(_entries, self.tipnode, self.tiprev,
   178         new = self.__class__(_entries, self.tipnode, self.tiprev,
   179                              self.filteredhash, self._closednodes)
   179                              self.filteredhash, self._closednodes)
   180         new.phaseshash = self.phaseshash
   180         new.phaseshash = self.phaseshash
   181         return new
   181         return new