Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG2d919ab6c5b4: posix: use inst.errno instead of inst[0] on OSError instances
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| pulkit |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| else: | else: | ||||
| try: | try: | ||||
| os.rename(name, checklink) | os.rename(name, checklink) | ||||
| except OSError: | except OSError: | ||||
| unlink(name) | unlink(name) | ||||
| return True | return True | ||||
| except OSError as inst: | except OSError as inst: | ||||
| # link creation might race, try again | # link creation might race, try again | ||||
| if inst[0] == errno.EEXIST: | if inst.errno == errno.EEXIST: | ||||
| continue | continue | ||||
| raise | raise | ||||
| finally: | finally: | ||||
| if fd is not None: | if fd is not None: | ||||
| fd.close() | fd.close() | ||||
| except AttributeError: | except AttributeError: | ||||
| return False | return False | ||||
| except OSError as inst: | except OSError as inst: | ||||
| # sshfs might report failure while successfully creating the link | # sshfs might report failure while successfully creating the link | ||||
| if inst[0] == errno.EIO and os.path.exists(name): | if inst.errno == errno.EIO and os.path.exists(name): | ||||
| unlink(name) | unlink(name) | ||||
| return False | return False | ||||
| def checkosfilename(path): | def checkosfilename(path): | ||||
| '''Check that the base-relative path is a valid filename on this platform. | '''Check that the base-relative path is a valid filename on this platform. | ||||
| Returns None if the path is ok, or a UI string describing the problem.''' | Returns None if the path is ok, or a UI string describing the problem.''' | ||||
| return None # on posix platforms, every path is ok | return None # on posix platforms, every path is ok | ||||