Mercurial > public > mercurial-scm > hg
comparison mercurial/win32.py @ 49284:d44e3c45f0e4
py3: replace `pycompat.xrange` by `range`
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sun, 29 May 2022 15:17:27 +0200 |
parents | 6000f5b25c9b |
children | 53e9422a9b45 |
comparison
equal
deleted
inserted
replaced
49283:44b26349127b | 49284:d44e3c45f0e4 |
---|---|
730 # A file that has been opened with posixfile can be renamed, so we rename | 730 # A file that has been opened with posixfile can be renamed, so we rename |
731 # f to a random temporary name before calling os.unlink on it. This allows | 731 # f to a random temporary name before calling os.unlink on it. This allows |
732 # callers to recreate f immediately while having other readers do their | 732 # callers to recreate f immediately while having other readers do their |
733 # implicit zombie filename blocking on a temporary name. | 733 # implicit zombie filename blocking on a temporary name. |
734 | 734 |
735 for tries in pycompat.xrange(10): | 735 for tries in range(10): |
736 temp = b'%s-%08x' % (f, random.randint(0, 0xFFFFFFFF)) | 736 temp = b'%s-%08x' % (f, random.randint(0, 0xFFFFFFFF)) |
737 try: | 737 try: |
738 os.rename(f, temp) # raises OSError EEXIST if temp exists | 738 os.rename(f, temp) # raises OSError EEXIST if temp exists |
739 break | 739 break |
740 except OSError as e: | 740 except OSError as e: |