##// END OF EJS Templates
Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan -
r1196:3738e85e default
parent child Browse files
Show More
@@ -0,0 +1,13 b''
1 #!/bin/sh
2
3 hg init test
4 cd test
5 echo foo > foo
6 hg add foo
7 hg commit -d '0 0' -m commit-1
8 echo foo >> foo
9 hg commit -d '1 4444444' -m commit-3
10 hg commit -d '1 15.1' -m commit-4
11 hg commit -d 'foo bar' -m commit-5
12 hg commit -d ' 1 4444' -m commit-6
13 hg commit -d '111111111111 0' -m commit-7
@@ -32,7 +32,10 b' class changelog(revlog):'
32 def add(self, manifest, list, desc, transaction, p1=None, p2=None,
32 def add(self, manifest, list, desc, transaction, p1=None, p2=None,
33 user=None, date=None):
33 user=None, date=None):
34 if date:
34 if date:
35 when, offset = map(int, date.split())
35 # validate explicit (probably user-specified) date and
36 # time zone offset
37 when, offset = map(int, date.split(' '))
38 time.localtime(when)
36 assert abs(offset) < 43200, 'bad time zone offset: %d' % offset
39 assert abs(offset) < 43200, 'bad time zone offset: %d' % offset
37 else:
40 else:
38 if time.daylight: offset = time.altzone
41 if time.daylight: offset = time.altzone
General Comments 0
You need to be logged in to leave comments. Login now