Show More
@@ -1,41 +1,44 b'' | |||||
1 | # changelog.py - changelog class for mercurial |
|
1 | # changelog.py - changelog class for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2005 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
6 | # of the GNU General Public License, incorporated herein by reference. |
|
6 | # of the GNU General Public License, incorporated herein by reference. | |
7 |
|
7 | |||
8 | import os, time |
|
8 | import os, time | |
9 | from revlog import * |
|
9 | from revlog import * | |
10 |
|
10 | |||
11 | class changelog(revlog): |
|
11 | class changelog(revlog): | |
12 | def __init__(self, opener): |
|
12 | def __init__(self, opener): | |
13 | revlog.__init__(self, opener, "00changelog.i", "00changelog.d") |
|
13 | revlog.__init__(self, opener, "00changelog.i", "00changelog.d") | |
14 |
|
14 | |||
15 | def extract(self, text): |
|
15 | def extract(self, text): | |
16 | if not text: |
|
16 | if not text: | |
17 | return (nullid, "", "0", [], "") |
|
17 | return (nullid, "", "0", [], "") | |
18 | last = text.index("\n\n") |
|
18 | last = text.index("\n\n") | |
19 | desc = text[last + 2:] |
|
19 | desc = text[last + 2:] | |
20 | l = text[:last].splitlines() |
|
20 | l = text[:last].splitlines() | |
21 | manifest = bin(l[0]) |
|
21 | manifest = bin(l[0]) | |
22 | user = l[1] |
|
22 | user = l[1] | |
23 | date = l[2] |
|
23 | date = l[2] | |
24 | if " " not in date: |
|
24 | if " " not in date: | |
25 | date += " 0" # some tools used -d without a timezone |
|
25 | date += " 0" # some tools used -d without a timezone | |
26 | files = l[3:] |
|
26 | files = l[3:] | |
27 | return (manifest, user, date, files, desc) |
|
27 | return (manifest, user, date, files, desc) | |
28 |
|
28 | |||
29 | def read(self, node): |
|
29 | def read(self, node): | |
30 | return self.extract(self.revision(node)) |
|
30 | return self.extract(self.revision(node)) | |
31 |
|
31 | |||
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 |
|
34 | if date: | |
|
35 | when, offset = map(int, date.split()) | |||
|
36 | assert abs(offset) < 43200, 'bad time zone offset: %d' % offset | |||
|
37 | else: | |||
35 | if time.daylight: offset = time.altzone |
|
38 | if time.daylight: offset = time.altzone | |
36 | else: offset = time.timezone |
|
39 | else: offset = time.timezone | |
37 | date = "%d %d" % (time.time(), offset) |
|
40 | date = "%d %d" % (time.time(), offset) | |
38 | list.sort() |
|
41 | list.sort() | |
39 | l = [hex(manifest), user, date] + list + ["", desc] |
|
42 | l = [hex(manifest), user, date] + list + ["", desc] | |
40 | text = "\n".join(l) |
|
43 | text = "\n".join(l) | |
41 | return self.addrevision(text, transaction, self.count(), p1, p2) |
|
44 | return self.addrevision(text, transaction, self.count(), p1, p2) |
General Comments 0
You need to be logged in to leave comments.
Login now