changeset 31540 | 6d5b77abf306 |
parent 31539 | 52361c4f4dac |
child 31541 | bd9daafbf87c |
--- a/mercurial/util.py Tue Mar 21 06:50:28 2017 -0700 +++ b/mercurial/util.py Tue Mar 21 06:50:28 2017 -0700 @@ -1617,6 +1617,14 @@ except OSError: pass +def tryunlink(f): + """Attempt to remove a file, ignoring ENOENT errors.""" + try: + unlink(f) + except OSError as e: + if e.errno != errno.ENOENT: + raise + def makedirs(name, mode=None, notindexed=False): """recursive directory creation with parent mode inheritance