mercurial/branchmap.py
changeset 41677 bfc49f1df615
parent 41615 328ca3b9e545
child 41678 9d0d8793e847
equal deleted inserted replaced
41676:0531dff73d0b 41677:bfc49f1df615
   146 
   146 
   147     The open/closed state is represented by a single letter 'o' or 'c'.
   147     The open/closed state is represented by a single letter 'o' or 'c'.
   148     This field can be used to avoid changelog reads when determining if a
   148     This field can be used to avoid changelog reads when determining if a
   149     branch head closes a branch or not.
   149     branch head closes a branch or not.
   150     """
   150     """
       
   151 
       
   152     def __init__(self, entries=(), tipnode=nullid, tiprev=nullrev,
       
   153                  filteredhash=None, closednodes=None):
       
   154         super(branchcache, self).__init__(entries)
       
   155         self.tipnode = tipnode
       
   156         self.tiprev = tiprev
       
   157         self.filteredhash = filteredhash
       
   158         # closednodes is a set of nodes that close their branch. If the branch
       
   159         # cache has been updated, it may contain nodes that are no longer
       
   160         # heads.
       
   161         if closednodes is None:
       
   162             self._closednodes = set()
       
   163         else:
       
   164             self._closednodes = closednodes
       
   165 
   151     @classmethod
   166     @classmethod
   152     def fromfile(cls, repo):
   167     def fromfile(cls, repo):
   153         f = None
   168         f = None
   154         try:
   169         try:
   155             f = repo.cachevfs(cls._filename(repo))
   170             f = repo.cachevfs(cls._filename(repo))
   205         filename = "branch2"
   220         filename = "branch2"
   206         if repo.filtername:
   221         if repo.filtername:
   207             filename = '%s-%s' % (filename, repo.filtername)
   222             filename = '%s-%s' % (filename, repo.filtername)
   208         return filename
   223         return filename
   209 
   224 
   210     def __init__(self, entries=(), tipnode=nullid, tiprev=nullrev,
       
   211                  filteredhash=None, closednodes=None):
       
   212         super(branchcache, self).__init__(entries)
       
   213         self.tipnode = tipnode
       
   214         self.tiprev = tiprev
       
   215         self.filteredhash = filteredhash
       
   216         # closednodes is a set of nodes that close their branch. If the branch
       
   217         # cache has been updated, it may contain nodes that are no longer
       
   218         # heads.
       
   219         if closednodes is None:
       
   220             self._closednodes = set()
       
   221         else:
       
   222             self._closednodes = closednodes
       
   223 
       
   224     def validfor(self, repo):
   225     def validfor(self, repo):
   225         """Is the cache content valid regarding a repo
   226         """Is the cache content valid regarding a repo
   226 
   227 
   227         - False when cached tipnode is unknown or if we detect a strip.
   228         - False when cached tipnode is unknown or if we detect a strip.
   228         - True when cache is up to date or a subset of current repo."""
   229         - True when cache is up to date or a subset of current repo."""