Mercurial > hg
comparison mercurial/util.py @ 12387:4f8067c94729
cleanup: use x in (a, b) instead of x == a or x == b
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Thu, 23 Sep 2010 00:02:31 -0500 |
parents | e0ee3e822a9a |
children | 4cdaf1adafc8 |
comparison
equal
deleted
inserted
replaced
12386:8eedf53547b8 | 12387:4f8067c94729 |
---|---|
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] == os.sep or name[l] == os.altsep: | 643 if name[l] in (os.sep, 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 == "GMT" or tz == "UTC": | 1011 if tz in ("GMT", "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 |