mercurial/repoview.py
changeset 25086 140c2d1e57e7
parent 24620 7c6f9097e2e0
child 25149 3f0744eeaeaf
equal deleted inserted replaced
25085:e05734cd7902 25086:140c2d1e57e7
   113       20 byte    sha1 to validate the cache
   113       20 byte    sha1 to validate the cache
   114      n*4 byte    hidden revs
   114      n*4 byte    hidden revs
   115     """
   115     """
   116     wlock = fh = None
   116     wlock = fh = None
   117     try:
   117     try:
   118         try:
   118         wlock = repo.wlock(wait=False)
   119             wlock = repo.wlock(wait=False)
   119         # write cache to file
   120             # write cache to file
   120         newhash = cachehash(repo, hideable)
   121             newhash = cachehash(repo, hideable)
   121         fh = repo.vfs.open(cachefile, 'w+b', atomictemp=True)
   122             fh = repo.vfs.open(cachefile, 'w+b', atomictemp=True)
   122         _writehiddencache(fh, newhash, hidden)
   123             _writehiddencache(fh, newhash, hidden)
   123     except (IOError, OSError):
   124         except (IOError, OSError):
   124         repo.ui.debug('error writing hidden changesets cache')
   125             repo.ui.debug('error writing hidden changesets cache')
   125     except error.LockHeld:
   126         except error.LockHeld:
   126         repo.ui.debug('cannot obtain lock to write hidden changesets cache')
   127             repo.ui.debug('cannot obtain lock to write hidden changesets cache')
       
   128     finally:
   127     finally:
   129         if fh:
   128         if fh:
   130             fh.close()
   129             fh.close()
   131         if wlock:
   130         if wlock:
   132             wlock.release()
   131             wlock.release()