Show More
@@ -151,11 +151,8 b' class changelogrevision(object):' | |||||
151 | """ |
|
151 | """ | |
152 |
|
152 | |||
153 | __slots__ = ( |
|
153 | __slots__ = ( | |
154 |
'_ |
|
154 | '_offsets', | |
155 |
'_ |
|
155 | '_text', | |
156 | '_rawfiles', |
|
|||
157 | '_rawmanifest', |
|
|||
158 | '_rawuser', |
|
|||
159 | ) |
|
156 | ) | |
160 |
|
157 | |||
161 | def __new__(cls, text): |
|
158 | def __new__(cls, text): | |
@@ -185,41 +182,41 b' class changelogrevision(object):' | |||||
185 | # changelog v0 doesn't use extra |
|
182 | # changelog v0 doesn't use extra | |
186 |
|
183 | |||
187 | nl1 = text.index('\n') |
|
184 | nl1 = text.index('\n') | |
188 | self._rawmanifest = text[0:nl1] |
|
|||
189 |
|
||||
190 | nl2 = text.index('\n', nl1 + 1) |
|
185 | nl2 = text.index('\n', nl1 + 1) | |
191 | self._rawuser = text[nl1 + 1:nl2] |
|
|||
192 |
|
||||
193 | nl3 = text.index('\n', nl2 + 1) |
|
186 | nl3 = text.index('\n', nl2 + 1) | |
194 | self._rawdateextra = text[nl2 + 1:nl3] |
|
|||
195 |
|
187 | |||
196 | # The list of files may be empty. Which means nl3 is the first of the |
|
188 | # The list of files may be empty. Which means nl3 is the first of the | |
197 | # double newline that precedes the description. |
|
189 | # double newline that precedes the description. | |
198 | if text[nl3 + 1] == '\n': |
|
190 | if text[nl3 + 1] == '\n': | |
199 |
|
|
191 | doublenl = nl3 | |
200 | self._rawdesc = text[nl3 + 2:] |
|
|||
201 | else: |
|
192 | else: | |
202 | doublenl = text.index('\n\n', nl3 + 1) |
|
193 | doublenl = text.index('\n\n', nl3 + 1) | |
203 | self._rawfiles = text[nl3 + 1:doublenl] |
|
194 | ||
204 | self._rawdesc = text[doublenl + 2:] |
|
195 | self._offsets = (nl1, nl2, nl3, doublenl) | |
|
196 | self._text = text | |||
205 |
|
197 | |||
206 | return self |
|
198 | return self | |
207 |
|
199 | |||
208 | @property |
|
200 | @property | |
209 | def manifest(self): |
|
201 | def manifest(self): | |
210 |
return bin(self._ |
|
202 | return bin(self._text[0:self._offsets[0]]) | |
211 |
|
203 | |||
212 | @property |
|
204 | @property | |
213 | def user(self): |
|
205 | def user(self): | |
214 | return encoding.tolocal(self._rawuser) |
|
206 | off = self._offsets | |
|
207 | return encoding.tolocal(self._text[off[0] + 1:off[1]]) | |||
215 |
|
208 | |||
216 | @property |
|
209 | @property | |
217 | def _rawdate(self): |
|
210 | def _rawdate(self): | |
218 | return self._rawdateextra.split(' ', 2)[0:2] |
|
211 | off = self._offsets | |
|
212 | dateextra = self._text[off[1] + 1:off[2]] | |||
|
213 | return dateextra.split(' ', 2)[0:2] | |||
219 |
|
214 | |||
220 | @property |
|
215 | @property | |
221 | def _rawextra(self): |
|
216 | def _rawextra(self): | |
222 | fields = self._rawdateextra.split(' ', 2) |
|
217 | off = self._offsets | |
|
218 | dateextra = self._text[off[1] + 1:off[2]] | |||
|
219 | fields = dateextra.split(' ', 2) | |||
223 | if len(fields) != 3: |
|
220 | if len(fields) != 3: | |
224 | return None |
|
221 | return None | |
225 |
|
222 | |||
@@ -247,14 +244,15 b' class changelogrevision(object):' | |||||
247 |
|
244 | |||
248 | @property |
|
245 | @property | |
249 | def files(self): |
|
246 | def files(self): | |
250 |
|
|
247 | off = self._offsets | |
|
248 | if off[2] == off[3]: | |||
251 | return [] |
|
249 | return [] | |
252 |
|
250 | |||
253 |
return self._ |
|
251 | return self._text[off[2] + 1:off[3]].split('\n') | |
254 |
|
252 | |||
255 | @property |
|
253 | @property | |
256 | def description(self): |
|
254 | def description(self): | |
257 |
return encoding.tolocal(self._ |
|
255 | return encoding.tolocal(self._text[self._offsets[3] + 2:]) | |
258 |
|
256 | |||
259 | class changelog(revlog.revlog): |
|
257 | class changelog(revlog.revlog): | |
260 | def __init__(self, opener): |
|
258 | def __init__(self, opener): |
General Comments 0
You need to be logged in to leave comments.
Login now