mercurial/branchmap.py
changeset 46780 6266d19556ad
parent 46372 3e91d9978bec
child 46794 e2f7b2695ba1
equal deleted inserted replaced
46779:49fd21f32695 46780:6266d19556ad
    95                 bcache = self[subset].copy()
    95                 bcache = self[subset].copy()
    96                 extrarevs = subset.changelog.filteredrevs - cl.filteredrevs
    96                 extrarevs = subset.changelog.filteredrevs - cl.filteredrevs
    97                 revs.extend(r for r in extrarevs if r <= bcache.tiprev)
    97                 revs.extend(r for r in extrarevs if r <= bcache.tiprev)
    98             else:
    98             else:
    99                 # nothing to fall back on, start empty.
    99                 # nothing to fall back on, start empty.
   100                 bcache = branchcache()
   100                 bcache = branchcache(repo)
   101 
   101 
   102         revs.extend(cl.revs(start=bcache.tiprev + 1))
   102         revs.extend(cl.revs(start=bcache.tiprev + 1))
   103         if revs:
   103         if revs:
   104             bcache.update(repo, revs)
   104             bcache.update(repo, revs)
   105 
   105 
   127                     closed.add(h)
   127                     closed.add(h)
   128 
   128 
   129         if rbheads:
   129         if rbheads:
   130             rtiprev = max((int(clrev(node)) for node in rbheads))
   130             rtiprev = max((int(clrev(node)) for node in rbheads))
   131             cache = branchcache(
   131             cache = branchcache(
       
   132                 repo,
   132                 remotebranchmap,
   133                 remotebranchmap,
   133                 repo[rtiprev].node(),
   134                 repo[rtiprev].node(),
   134                 rtiprev,
   135                 rtiprev,
   135                 closednodes=closed,
   136                 closednodes=closed,
   136             )
   137             )
   182     branch head closes a branch or not.
   183     branch head closes a branch or not.
   183     """
   184     """
   184 
   185 
   185     def __init__(
   186     def __init__(
   186         self,
   187         self,
       
   188         repo,
   187         entries=(),
   189         entries=(),
   188         tipnode=nullid,
   190         tipnode=nullid,
   189         tiprev=nullrev,
   191         tiprev=nullrev,
   190         filteredhash=None,
   192         filteredhash=None,
   191         closednodes=None,
   193         closednodes=None,
   193     ):
   195     ):
   194         # type: (Union[Dict[bytes, List[bytes]], Iterable[Tuple[bytes, List[bytes]]]], bytes,  int, Optional[bytes], Optional[Set[bytes]], Optional[Callable[[bytes], bool]]) -> None
   196         # type: (Union[Dict[bytes, List[bytes]], Iterable[Tuple[bytes, List[bytes]]]], bytes,  int, Optional[bytes], Optional[Set[bytes]], Optional[Callable[[bytes], bool]]) -> None
   195         """hasnode is a function which can be used to verify whether changelog
   197         """hasnode is a function which can be used to verify whether changelog
   196         has a given node or not. If it's not provided, we assume that every node
   198         has a given node or not. If it's not provided, we assume that every node
   197         we have exists in changelog"""
   199         we have exists in changelog"""
       
   200         self._repo = repo
   198         self.tipnode = tipnode
   201         self.tipnode = tipnode
   199         self.tiprev = tiprev
   202         self.tiprev = tiprev
   200         self.filteredhash = filteredhash
   203         self.filteredhash = filteredhash
   201         # closednodes is a set of nodes that close their branch. If the branch
   204         # closednodes is a set of nodes that close their branch. If the branch
   202         # cache has been updated, it may contain nodes that are no longer
   205         # cache has been updated, it may contain nodes that are no longer
   278             filteredhash = None
   281             filteredhash = None
   279             hasnode = repo.changelog.hasnode
   282             hasnode = repo.changelog.hasnode
   280             if len(cachekey) > 2:
   283             if len(cachekey) > 2:
   281                 filteredhash = bin(cachekey[2])
   284                 filteredhash = bin(cachekey[2])
   282             bcache = cls(
   285             bcache = cls(
       
   286                 repo,
   283                 tipnode=last,
   287                 tipnode=last,
   284                 tiprev=lrev,
   288                 tiprev=lrev,
   285                 filteredhash=filteredhash,
   289                 filteredhash=filteredhash,
   286                 hasnode=hasnode,
   290                 hasnode=hasnode,
   287             )
   291             )
   386         return pycompat.itervalues(self._entries)
   390         return pycompat.itervalues(self._entries)
   387 
   391 
   388     def copy(self):
   392     def copy(self):
   389         """return an deep copy of the branchcache object"""
   393         """return an deep copy of the branchcache object"""
   390         return type(self)(
   394         return type(self)(
       
   395             self._repo,
   391             self._entries,
   396             self._entries,
   392             self.tipnode,
   397             self.tipnode,
   393             self.tiprev,
   398             self.tiprev,
   394             self.filteredhash,
   399             self.filteredhash,
   395             self._closednodes,
   400             self._closednodes,