Show More
@@ -39,16 +39,7 b' class changelog(revlog):' | |||
|
39 | 39 | def add(self, manifest, list, desc, transaction, p1=None, p2=None, |
|
40 | 40 | user=None, date=None): |
|
41 | 41 | if date: |
|
42 | # validate explicit (probably user-specified) date and | |
|
43 | # time zone offset. values must fit in signed 32 bits for | |
|
44 | # current 32-bit linux runtimes. timezones go from UTC-12 | |
|
45 | # to UTC+14 | |
|
46 | when, offset = util.parsedate(date) | |
|
47 | if abs(when) > 0x7fffffff: | |
|
48 | raise ValueError(_('date exceeds 32 bits: %d') % when) | |
|
49 | if offset < -50400 or offset > 43200: | |
|
50 | raise ValueError(_('impossible time zone offset: %d') % offset) | |
|
51 | parseddate = "%d %d" % (when, offset) | |
|
42 | parseddate = "%d %d" % util.parsedate(date) | |
|
52 | 43 | else: |
|
53 | 44 | parseddate = "%d %d" % util.makedate() |
|
54 | 45 | list.sort() |
@@ -882,13 +882,25 b" def parsedate(string, formats=('%Y-%m-%d" | |||
|
882 | 882 | formats.""" |
|
883 | 883 | try: |
|
884 | 884 | when, offset = map(int, string.split(' ')) |
|
885 | return when, offset | |
|
886 | except ValueError: pass | |
|
887 | for format in formats: | |
|
888 | try: | |
|
889 | return strdate(string, format) | |
|
890 | except ValueError: pass | |
|
891 | raise ValueError(_('invalid date: %r') % string) | |
|
885 | except ValueError: | |
|
886 | for format in formats: | |
|
887 | try: | |
|
888 | when, offset = strdate(string, format) | |
|
889 | except ValueError: | |
|
890 | pass | |
|
891 | else: | |
|
892 | break | |
|
893 | else: | |
|
894 | raise ValueError(_('invalid date: %r') % string) | |
|
895 | # validate explicit (probably user-specified) date and | |
|
896 | # time zone offset. values must fit in signed 32 bits for | |
|
897 | # current 32-bit linux runtimes. timezones go from UTC-12 | |
|
898 | # to UTC+14 | |
|
899 | if abs(when) > 0x7fffffff: | |
|
900 | raise ValueError(_('date exceeds 32 bits: %d') % when) | |
|
901 | if offset < -50400 or offset > 43200: | |
|
902 | raise ValueError(_('impossible time zone offset: %d') % offset) | |
|
903 | return when, offset | |
|
892 | 904 | |
|
893 | 905 | def shortuser(user): |
|
894 | 906 | """Return a short representation of a user name or email address.""" |
General Comments 0
You need to be logged in to leave comments.
Login now