Mercurial > hg
comparison mercurial/util.py @ 29832:bac1829ec31f
util: checknlink should remove file it creates if an exception occurs
There's no reason to leave the file behind.
author | Tony Tung <tonytung@merly.org> |
---|---|
date | Fri, 19 Aug 2016 13:30:40 -0700 |
parents | 79add5a4e857 |
children | 6f447b9ec263 |
comparison
equal
deleted
inserted
replaced
29831:1316c7cccc76 | 29832:bac1829ec31f |
---|---|
1339 if os.path.lexists(f1): | 1339 if os.path.lexists(f1): |
1340 return False | 1340 return False |
1341 try: | 1341 try: |
1342 posixfile(f1, 'w').close() | 1342 posixfile(f1, 'w').close() |
1343 except IOError: | 1343 except IOError: |
1344 try: | |
1345 os.unlink(f1) | |
1346 except OSError: | |
1347 pass | |
1344 return False | 1348 return False |
1345 | 1349 |
1346 f2 = testfile + ".hgtmp2" | 1350 f2 = testfile + ".hgtmp2" |
1347 fd = None | 1351 fd = None |
1348 try: | 1352 try: |