Patchwork [5,of,8] obsolete: add a date argument to the `createmarkers` function

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 16, 2014, 12:33 a.m.
Message ID <be27fa71fb8a019a3333.1408149207@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5439/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 16, 2014, 12:33 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1408046388 25200
#      Thu Aug 14 12:59:48 2014 -0700
# Node ID be27fa71fb8a019a3333a0a47a737f589c63597a
# Parent  cea57ac65a52905a543147ef36ae446a8b8699b2
obsolete: add a date argument to the `createmarkers` function

The function is now just passing the value to create markers.

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -830,11 +830,11 @@  def _computedivergentset(repo):
                 break
             toprocess.update(obsstore.precursors.get(prec, ()))
     return divergent
 
 
-def createmarkers(repo, relations, flag=0, metadata=None):
+def createmarkers(repo, relations, flag=0, date=None, metadata=None):
     """Add obsolete markers between changesets in a repo
 
     <relations> must be an iterable of (<old>, (<new>, ...)[,{metadata}])
     tuple. `old` and `news` are changectx. metadata is an optional dictionary
     containing metadata for this marker only. It is merged with the global
@@ -849,12 +849,10 @@  def createmarkers(repo, relations, flag=
     not take any lock on the repo.
     """
     # prepare metadata
     if metadata is None:
         metadata = {}
-    if 'date' not in metadata:
-        metadata['date'] = '%i %i' % util.makedate()
     if 'user' not in metadata:
         metadata['user'] = repo.ui.username()
     tr = repo.transaction('add-obsolescence-marker')
     try:
         for rel in relations:
@@ -869,11 +867,11 @@  def createmarkers(repo, relations, flag=
                                  % prec)
             nprec = prec.node()
             nsucs = tuple(s.node() for s in sucs)
             if nprec in nsucs:
                 raise util.Abort("changeset %s cannot obsolete itself" % prec)
-            repo.obsstore.create(tr, nprec, nsucs, flag,
+            repo.obsstore.create(tr, nprec, nsucs, flag, date=date,
                                  metadata=localmetadata)
             repo.filteredrevcache.clear()
         tr.close()
     finally:
         tr.release()