mercurial/branchmap.py
changeset 20181 b9515fb9e72a
parent 20032 175c6fd8cacc
child 20185 7d4219512823
equal deleted inserted replaced
20180:969148b49fc6 20181:b9515fb9e72a
    92         partial.write(repo)
    92         partial.write(repo)
    93     assert partial.validfor(repo), filtername
    93     assert partial.validfor(repo), filtername
    94     repo._branchcaches[repo.filtername] = partial
    94     repo._branchcaches[repo.filtername] = partial
    95 
    95 
    96 class branchcache(dict):
    96 class branchcache(dict):
    97     """A dict like object that hold branches heads cache"""
    97     """A dict like object that hold branches heads cache.
       
    98 
       
    99     This cache is used to avoid costly computations to determine all the
       
   100     branch heads of a repo.
       
   101 
       
   102     The cache is serialized on disk in the following format:
       
   103 
       
   104     <tip hex node> <tip rev number> [optional filtered repo hex hash]
       
   105     <branch head hex node> <branch name>
       
   106     <branch head hex node> <branch name>
       
   107     ...
       
   108 
       
   109     The first line is used to check if the cache is still valid. If the
       
   110     branch cache is for a filtered repo view, an optional third hash is
       
   111     included that hashes the hashes of all filtered revisions.
       
   112     """
    98 
   113 
    99     def __init__(self, entries=(), tipnode=nullid, tiprev=nullrev,
   114     def __init__(self, entries=(), tipnode=nullid, tiprev=nullrev,
   100                  filteredhash=None):
   115                  filteredhash=None):
   101         super(branchcache, self).__init__(entries)
   116         super(branchcache, self).__init__(entries)
   102         self.tipnode = tipnode
   117         self.tipnode = tipnode