comparison mercurial/util.py @ 13040:44b26a87f73e

Merge with stable
author Steve Borho <steve@borho.org>
date Wed, 24 Nov 2010 13:43:40 -0600
parents 3da456d0c885 dd24f3e7ca9e
children e2b8c7a6ff4d
comparison
equal deleted inserted replaced
13037:9beac11b8c56 13040:44b26a87f73e
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.
1024 """represent a (unixtime, offset) tuple as a localized time. 1021 """represent a (unixtime, offset) tuple as a localized time.
1025 unixtime is seconds since the epoch, and offset is the time zone's 1022 unixtime is seconds since the epoch, and offset is the time zone's
1026 number of seconds away from UTC. if timezone is false, do not 1023 number of seconds away from UTC. if timezone is false, do not
1027 append time zone to string.""" 1024 append time zone to string."""
1028 t, tz = date or makedate() 1025 t, tz = date or makedate()
1026 if t < 0:
1027 t = 0 # time.gmtime(lt) fails on Windows for lt < -43200
1028 tz = 0
1029 if "%1" in format or "%2" in format: 1029 if "%1" in format or "%2" in format:
1030 sign = (tz > 0) and "-" or "+" 1030 sign = (tz > 0) and "-" or "+"
1031 minutes = abs(tz) // 60 1031 minutes = abs(tz) // 60
1032 format = format.replace("%1", "%c%02d" % (sign, minutes // 60)) 1032 format = format.replace("%1", "%c%02d" % (sign, minutes // 60))
1033 format = format.replace("%2", "%02d" % (minutes % 60)) 1033 format = format.replace("%2", "%02d" % (minutes % 60))