mercurial/win32.py
changeset 38783 e7aa113b14f7
parent 38533 3a0f322af192
child 39611 f3900f4c63d4
equal deleted inserted replaced
38782:7eba8f83129b 38783:e7aa113b14f7
   613     # A file that has been opened with posixfile can be renamed, so we rename
   613     # A file that has been opened with posixfile can be renamed, so we rename
   614     # f to a random temporary name before calling os.unlink on it. This allows
   614     # f to a random temporary name before calling os.unlink on it. This allows
   615     # callers to recreate f immediately while having other readers do their
   615     # callers to recreate f immediately while having other readers do their
   616     # implicit zombie filename blocking on a temporary name.
   616     # implicit zombie filename blocking on a temporary name.
   617 
   617 
   618     for tries in xrange(10):
   618     for tries in pycompat.xrange(10):
   619         temp = '%s-%08x' % (f, random.randint(0, 0xffffffff))
   619         temp = '%s-%08x' % (f, random.randint(0, 0xffffffff))
   620         try:
   620         try:
   621             os.rename(f, temp)  # raises OSError EEXIST if temp exists
   621             os.rename(f, temp)  # raises OSError EEXIST if temp exists
   622             break
   622             break
   623         except OSError as e:
   623         except OSError as e: