comparison mercurial/util.py @ 13038:670f4e98276d stable

checknlink: return False if .hgtmp file preexists (issue2517) If os_link fails on Windows, errno is always errno.EINVAL, so we can't really say if the testlink could not be created because (a) the FS doesn't support hardlinks or (b) there is a leaked .hgtmp file lying around from a previous crashed run. So let's err on the safe side, keep the code simple and assume we can't detect hardlinks in both cases.
author Adrian Buehlmann <adrian@cadifra.com>
date Tue, 23 Nov 2010 22:53:47 +0100
parents bf826c0b9537
children dd24f3e7ca9e
comparison
equal deleted inserted replaced
13035:f08df4d38442 13038:670f4e98276d
720 '''check whether hardlink count reporting works properly''' 720 '''check whether hardlink count reporting works properly'''
721 f = testfile + ".hgtmp" 721 f = testfile + ".hgtmp"
722 722
723 try: 723 try:
724 os_link(testfile, f) 724 os_link(testfile, f)
725 except OSError, inst: 725 except OSError:
726 if inst.errno == errno.EINVAL:
727 # FS doesn't support creating hardlinks
728 return True
729 return False 726 return False
730 727
731 try: 728 try:
732 # nlinks() may behave differently for files on Windows shares if 729 # nlinks() may behave differently for files on Windows shares if
733 # the file is open. 730 # the file is open.