changeset 22254:b8a0e8176693

obsstore: add a `parents` field This field is intended to store the parent of the precursor. This is useful to attach pruned changesets to a set of exchanged changesets. We currently just add the fields with a None value. None stands for "no data recorded".
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 18 Aug 2014 16:08:44 -0700
parents 4cdc3c333806
children adb3798dce49
files mercurial/obsolete.py
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsolete.py	Tue Aug 19 14:42:08 2014 -0700
+++ b/mercurial/obsolete.py	Mon Aug 18 16:08:44 2014 -0700
@@ -173,7 +173,7 @@
         except util.Abort:
             date = (0., 0)
 
-        yield (pre, sucs, flags, metadata, date)
+        yield (pre, sucs, flags, metadata, date, None)
 
 def encodemeta(meta):
     """Return encoded metadata string to string mapping.
@@ -242,12 +242,14 @@
     - successors[x] -> set(markers on successors edges of x)
     """
 
-    fields = ('prec', 'succs', 'flag', 'meta', 'date')
-    # prec:   nodeid, precursor changesets
-    # succs: tuple of nodeid, successor changesets (0-N length)
-    # flag:   integer, flag field carrying modifier for the markers (see doc)
-    # meta:   binary blob, encoded metadata dictionary
-    # date:   (float, int) tuple, date of marker creation
+    fields = ('prec', 'succs', 'flag', 'meta', 'date', 'parents')
+    # prec:    nodeid, precursor changesets
+    # succs:   tuple of nodeid, successor changesets (0-N length)
+    # flag:    integer, flag field carrying modifier for the markers (see doc)
+    # meta:    binary blob, encoded metadata dictionary
+    # date:    (float, int) tuple, date of marker creation
+    # parents: (tuple of nodeid) or None, parents of precursors
+    #          None is used when no data has been recorded
 
     def __init__(self, sopener):
         # caches for various obsolescence related cache
@@ -300,7 +302,7 @@
         if prec in succs:
             raise ValueError(_('in-marker cycle with %s') % node.hex(prec))
         marker = (str(prec), tuple(succs), int(flag), encodemeta(metadata),
-                  date)
+                  date, None)
         return bool(self.add(transaction, [marker]))
 
     def add(self, transaction, markers):
@@ -364,7 +366,7 @@
 
 
 def _encodeonemarker(marker):
-    pre, sucs, flags, metadata, date = marker
+    pre, sucs, flags, metadata, date, parents = marker
     metadata = decodemeta(metadata)
     metadata['date'] = '%d %i' % date
     metadata = encodemeta(metadata)