[PATCH] obsolete: ensure all markers have a date

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Thu Mar 28 13:00:45 CDT 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1360578012 -3600
#      Mon Feb 11 11:20:12 2013 +0100
# Node ID fc5388b69f50c5c504736151898a4da0471811f8
# Parent  a7d0ddc7540b2691f8a5af8006588a80e582754a
obsolete: ensure all markers have a date

Obsolescence creates a sparse DAG mostly composed of a lot of small independent
chain of markers. Date is the only simple and "reliable" way to sort them. The
existence of a date is now enforced at creation time as I'm more and more
convinced that date will have a key role in obsolescence markers exchange.

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -248,10 +248,12 @@ class obsstore(object):
         * check mandatory metadata
         * encode metadata
         """
         if metadata is None:
             metadata = {}
+        if 'date' not in metadata:
+            metadata['date'] = "%d %d" % util.makedate()
         if len(prec) != 20:
             raise ValueError(prec)
         for succ in succs:
             if len(succ) != 20:
                 raise ValueError(succ)


More information about the Mercurial-devel mailing list