Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/branchmap.py @ 47759:d7515d29761d stable 5.9rc0
branching: merge default into stable
This mark the start of the 5.9 freeze.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 21 Jul 2021 22:52:09 +0200 |
parents | bea4717415c0 |
children | 8e5effbf52d0 |
comparison
equal
deleted
inserted
replaced
47054:29ea3b4c4f62 | 47759:d7515d29761d |
---|---|
10 import struct | 10 import struct |
11 | 11 |
12 from .node import ( | 12 from .node import ( |
13 bin, | 13 bin, |
14 hex, | 14 hex, |
15 nullid, | |
16 nullrev, | 15 nullrev, |
17 ) | 16 ) |
18 from . import ( | 17 from . import ( |
19 encoding, | 18 encoding, |
20 error, | 19 error, |
187 | 186 |
188 def __init__( | 187 def __init__( |
189 self, | 188 self, |
190 repo, | 189 repo, |
191 entries=(), | 190 entries=(), |
192 tipnode=nullid, | 191 tipnode=None, |
193 tiprev=nullrev, | 192 tiprev=nullrev, |
194 filteredhash=None, | 193 filteredhash=None, |
195 closednodes=None, | 194 closednodes=None, |
196 hasnode=None, | 195 hasnode=None, |
197 ): | 196 ): |
198 # type: (localrepo.localrepository, Union[Dict[bytes, List[bytes]], Iterable[Tuple[bytes, List[bytes]]]], bytes, int, Optional[bytes], Optional[Set[bytes]], Optional[Callable[[bytes], bool]]) -> None | 197 # type: (localrepo.localrepository, Union[Dict[bytes, List[bytes]], Iterable[Tuple[bytes, List[bytes]]]], bytes, int, Optional[bytes], Optional[Set[bytes]], Optional[Callable[[bytes], bool]]) -> None |
199 """hasnode is a function which can be used to verify whether changelog | 198 """hasnode is a function which can be used to verify whether changelog |
200 has a given node or not. If it's not provided, we assume that every node | 199 has a given node or not. If it's not provided, we assume that every node |
201 we have exists in changelog""" | 200 we have exists in changelog""" |
202 self._repo = repo | 201 self._repo = repo |
203 self.tipnode = tipnode | 202 if tipnode is None: |
203 self.tipnode = repo.nullid | |
204 else: | |
205 self.tipnode = tipnode | |
204 self.tiprev = tiprev | 206 self.tiprev = tiprev |
205 self.filteredhash = filteredhash | 207 self.filteredhash = filteredhash |
206 # closednodes is a set of nodes that close their branch. If the branch | 208 # closednodes is a set of nodes that close their branch. If the branch |
207 # cache has been updated, it may contain nodes that are no longer | 209 # cache has been updated, it may contain nodes that are no longer |
208 # heads. | 210 # heads. |
534 self.tiprev = ntiprev | 536 self.tiprev = ntiprev |
535 self.tipnode = cl.node(ntiprev) | 537 self.tipnode = cl.node(ntiprev) |
536 | 538 |
537 if not self.validfor(repo): | 539 if not self.validfor(repo): |
538 # cache key are not valid anymore | 540 # cache key are not valid anymore |
539 self.tipnode = nullid | 541 self.tipnode = repo.nullid |
540 self.tiprev = nullrev | 542 self.tiprev = nullrev |
541 for heads in self.iterheads(): | 543 for heads in self.iterheads(): |
542 tiprev = max(cl.rev(node) for node in heads) | 544 tiprev = max(cl.rev(node) for node in heads) |
543 if tiprev > self.tiprev: | 545 if tiprev > self.tiprev: |
544 self.tipnode = cl.node(tiprev) | 546 self.tipnode = cl.node(tiprev) |