comparison mercurial/util.py @ 12401:4cdaf1adafc8

backout most of 4f8067c94729
author Matt Mackall <mpm@selenic.com>
date Fri, 24 Sep 2010 12:46:54 -0500
parents 4f8067c94729
children 9b324c5e6273
comparison
equal deleted inserted replaced
12400:40852b4b910c 12401:4cdaf1adafc8
638 called, for case-sensitive filesystems (simply because it's expensive). 638 called, for case-sensitive filesystems (simply because it's expensive).
639 ''' 639 '''
640 # If name is absolute, make it relative 640 # If name is absolute, make it relative
641 if name.lower().startswith(root.lower()): 641 if name.lower().startswith(root.lower()):
642 l = len(root) 642 l = len(root)
643 if name[l] in (os.sep, os.altsep): 643 if name[l] == os.sep or name[l] == os.altsep:
644 l = l + 1 644 l = l + 1
645 name = name[l:] 645 name = name[l:]
646 646
647 if not os.path.lexists(os.path.join(root, name)): 647 if not os.path.lexists(os.path.join(root, name)):
648 return None 648 return None
1006 if tz[0] in "+-" and len(tz) == 5 and tz[1:].isdigit(): 1006 if tz[0] in "+-" and len(tz) == 5 and tz[1:].isdigit():
1007 sign = (tz[0] == "+") and 1 or -1 1007 sign = (tz[0] == "+") and 1 or -1
1008 hours = int(tz[1:3]) 1008 hours = int(tz[1:3])
1009 minutes = int(tz[3:5]) 1009 minutes = int(tz[3:5])
1010 return -sign * (hours * 60 + minutes) * 60 1010 return -sign * (hours * 60 + minutes) * 60
1011 if tz in ("GMT", "UTC"): 1011 if tz == "GMT" or tz == "UTC":
1012 return 0 1012 return 0
1013 return None 1013 return None
1014 1014
1015 # NOTE: unixtime = localunixtime + offset 1015 # NOTE: unixtime = localunixtime + offset
1016 offset, date = timezone(string), string 1016 offset, date = timezone(string), string