mercurial/obsolete.py
changeset 17071 11f26e2669aa
parent 17070 ad0d6c2b3279
child 17072 517af63ba382
--- a/mercurial/obsolete.py	Thu Jun 07 19:07:39 2012 +0200
+++ b/mercurial/obsolete.py	Thu Jun 07 19:15:23 2012 +0200
@@ -135,6 +135,23 @@
         self.precursors = {}
         self.successors = {}
 
+    def create(self, prec, succs=(), flag=0, metadata=None):
+        """obsolete: add a new obsolete marker
+
+        * ensuring it is hashable
+        * check mandatory metadata
+        * encode metadata
+        """
+        if metadata is None:
+            metadata = {}
+        if len(prec) != 20:
+            raise ValueError(prec)
+        for succ in succs:
+            if len(succ) != 20:
+                raise ValueError(prec)
+        marker = (str(prec), tuple(succs), int(flag), encodemeta(metadata))
+        self.add(marker)
+
     def add(self, marker):
         """Add a new marker to the store