Comments
Patch
@@ -257,10 +257,13 @@ class obsstore(object):
* check mandatory metadata
* encode metadata
If you are a human writing code creating marker you want to use the
`createmarkers` function in this module instead.
+
+ return True if a new marker have been added, False if the markers
+ already existed (no op).
"""
if metadata is None:
metadata = {}
if 'date' not in metadata:
metadata['date'] = "%d %d" % util.makedate()
@@ -268,11 +271,11 @@ class obsstore(object):
raise ValueError(prec)
for succ in succs:
if len(succ) != 20:
raise ValueError(succ)
marker = (str(prec), tuple(succs), int(flag), encodemeta(metadata))
- self.add(transaction, [marker])
+ return bool(self.add(transaction, [marker]))
def add(self, transaction, markers):
"""Add new markers to the store
Take care of filtering duplicate.