[PATCH 1 of 2] obsstore: update create docstring to point to the coder friendly function

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Fri Feb 14 17:47:52 CST 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1392341625 28800
#      Thu Feb 13 17:33:45 2014 -0800
# Node ID 1bfd796fc968827d75b20abb7ef9d8d27d7d8e68
# Parent  0f1ef9e9e904c18f1ac96aef3a0e0d3aa5f1190c
obsstore: update create docstring to point to the coder friendly function

The `obsstore` class have a `create` method that create new obsolescence marker
from node. There is another function in the same module `createmarkers`. This
other function is higher level and automatically missing meta data (ultimately
calling the first one)

We add a new comment in the docstring of `obsstore.create` highlighting that
people writing new code probably want to use the top level one.

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -254,10 +254,13 @@ class obsstore(object):
         """obsolete: add a new obsolete marker
 
         * ensuring it is hashable
         * 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.
         """
         if metadata is None:
             metadata = {}
         if 'date' not in metadata:
             metadata['date'] = "%d %d" % util.makedate()


More information about the Mercurial-devel mailing list