mercurial/branchmap.py
branchstable
changeset 24159 5b4ed033390b
parent 23877 7cc77030c557
child 24163 bb11081562d7
equal deleted inserted replaced
24158:d414c28db84d 24159:5b4ed033390b
   328     branch and the last bit indicate that it is a branch close commit.
   328     branch and the last bit indicate that it is a branch close commit.
   329     The usage pattern for rbc-revs is thus somewhat similar to 00changelog.i
   329     The usage pattern for rbc-revs is thus somewhat similar to 00changelog.i
   330     and will grow with it but be 1/8th of its size.
   330     and will grow with it but be 1/8th of its size.
   331     """
   331     """
   332 
   332 
   333     def __init__(self, repo):
   333     def __init__(self, repo, readonly=True):
   334         assert repo.filtername is None
   334         assert repo.filtername is None
   335         self._names = [] # branch names in local encoding with static index
   335         self._names = [] # branch names in local encoding with static index
   336         self._rbcrevs = array('c') # structs of type _rbcrecfmt
   336         self._rbcrevs = array('c') # structs of type _rbcrecfmt
   337         self._rbcsnameslen = 0
   337         self._rbcsnameslen = 0
   338         try:
   338         try:
   340             self._rbcsnameslen = len(bndata) # for verification before writing
   340             self._rbcsnameslen = len(bndata) # for verification before writing
   341             self._names = [encoding.tolocal(bn) for bn in bndata.split('\0')]
   341             self._names = [encoding.tolocal(bn) for bn in bndata.split('\0')]
   342         except (IOError, OSError), inst:
   342         except (IOError, OSError), inst:
   343             repo.ui.debug("couldn't read revision branch cache names: %s\n" %
   343             repo.ui.debug("couldn't read revision branch cache names: %s\n" %
   344                           inst)
   344                           inst)
       
   345             if readonly:
       
   346                 # don't try to use cache - fall back to the slow path
       
   347                 self.branchinfo = self._branchinfo
       
   348 
   345         if self._names:
   349         if self._names:
   346             try:
   350             try:
   347                 data = repo.vfs.read(_rbcrevs)
   351                 data = repo.vfs.read(_rbcrevs)
   348                 self._rbcrevs.fromstring(data)
   352                 self._rbcrevs.fromstring(data)
   349             except (IOError, OSError), inst:
   353             except (IOError, OSError), inst: