equal
deleted
inserted
replaced
105 for i, f in enumerate(files): |
105 for i, f in enumerate(files): |
106 if f in subset: |
106 if f in subset: |
107 indices.append('%d' % i) |
107 indices.append('%d' % i) |
108 return '\0'.join(indices) |
108 return '\0'.join(indices) |
109 |
109 |
|
110 def decodefileindices(files, data): |
|
111 try: |
|
112 subset = [] |
|
113 for strindex in data.split('\0'): |
|
114 i = int(strindex) |
|
115 if i < 0 or i >= len(files): |
|
116 return None |
|
117 subset.append(files[i]) |
|
118 return subset |
|
119 except (ValueError, IndexError): |
|
120 # Perhaps someone had chosen the same key name (e.g. "added") and |
|
121 # used different syntax for the value. |
|
122 return None |
|
123 |
110 def stripdesc(desc): |
124 def stripdesc(desc): |
111 """strip trailing whitespace and leading and trailing empty lines""" |
125 """strip trailing whitespace and leading and trailing empty lines""" |
112 return '\n'.join([l.rstrip() for l in desc.splitlines()]).strip('\n') |
126 return '\n'.join([l.rstrip() for l in desc.splitlines()]).strip('\n') |
113 |
127 |
114 class appender(object): |
128 class appender(object): |
200 extra = attr.ib() |
214 extra = attr.ib() |
201 manifest = attr.ib(default=nullid) |
215 manifest = attr.ib(default=nullid) |
202 user = attr.ib(default='') |
216 user = attr.ib(default='') |
203 date = attr.ib(default=(0, 0)) |
217 date = attr.ib(default=(0, 0)) |
204 files = attr.ib(default=attr.Factory(list)) |
218 files = attr.ib(default=attr.Factory(list)) |
|
219 filesadded = attr.ib(default=None) |
|
220 filesremoved = attr.ib(default=None) |
205 p1copies = attr.ib(default=None) |
221 p1copies = attr.ib(default=None) |
206 p2copies = attr.ib(default=None) |
222 p2copies = attr.ib(default=None) |
207 description = attr.ib(default='') |
223 description = attr.ib(default='') |
208 |
224 |
209 class changelogrevision(object): |
225 class changelogrevision(object): |
304 off = self._offsets |
320 off = self._offsets |
305 if off[2] == off[3]: |
321 if off[2] == off[3]: |
306 return [] |
322 return [] |
307 |
323 |
308 return self._text[off[2] + 1:off[3]].split('\n') |
324 return self._text[off[2] + 1:off[3]].split('\n') |
|
325 |
|
326 @property |
|
327 def filesadded(self): |
|
328 rawindices = self.extra.get('filesadded') |
|
329 return rawindices and decodefileindices(self.files, rawindices) |
|
330 |
|
331 @property |
|
332 def filesremoved(self): |
|
333 rawindices = self.extra.get('filesremoved') |
|
334 return rawindices and decodefileindices(self.files, rawindices) |
309 |
335 |
310 @property |
336 @property |
311 def p1copies(self): |
337 def p1copies(self): |
312 rawcopies = self.extra.get('p1copies') |
338 rawcopies = self.extra.get('p1copies') |
313 return rawcopies and decodecopies(rawcopies) |
339 return rawcopies and decodecopies(rawcopies) |