##// END OF EJS Templates
obsstore: also store the 'parents' field on disk...
Pierre-Yves David -
r22258:cf414981 default
parent child Browse files
Show More
@@ -173,9 +173,28 b' def _readmarkers(data):'
173 173 date = util.parsedate(decodemeta(metadata).pop('date', '0 0'))
174 174 except util.Abort:
175 175 date = (0., 0)
176 parents = None
177 if 'p2' in meta:
178 parents = (meta.pop('p1', None), meta.pop('p2', None))
179 elif 'p1' in meta:
180 parents = (meta.pop('p1', None),)
181 elif 'p0' in meta:
182 parents = ()
183 if parents is not None:
184 try:
185 parents = tuple(node.bin(p) for p in parents)
186 # if parent content is not a nodeid, drop the data
187 for p in parents:
188 if len(p) != 20:
189 parents = None
190 break
191 except TypeError:
192 # if content cannot be translated to nodeid drop the data.
193 parents = None
194
176 195 metadata = encodemeta(meta)
177 196
178 yield (pre, sucs, flags, metadata, date, None)
197 yield (pre, sucs, flags, metadata, date, parents)
179 198
180 199 def encodemeta(meta):
181 200 """Return encoded metadata string to string mapping.
@@ -371,6 +390,12 b' def _encodeonemarker(marker):'
371 390 pre, sucs, flags, metadata, date, parents = marker
372 391 metadata = decodemeta(metadata)
373 392 metadata['date'] = '%d %i' % date
393 if parents is not None:
394 if not parents:
395 # mark that we explicitly recorded no parents
396 metadata['p0'] = ''
397 for i, p in enumerate(parents, 1):
398 metadata['p%i' % i] = node.hex(p)
374 399 metadata = encodemeta(metadata)
375 400 nbsuc = len(sucs)
376 401 format = _fmfixed + (_fmnode * nbsuc)
General Comments 0
You need to be logged in to leave comments. Login now