Patchwork [4,of,8] debugobsolete: use the new date argument on obsstore.create

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 16, 2014, 12:33 a.m.
Message ID <cea57ac65a52905a5431.1408149206@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5443/
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 1407997507 25200
#      Wed Aug 13 23:25:07 2014 -0700
# Node ID cea57ac65a52905a543147ef36ae446a8b8699b2
# Parent  545b8965d9e13e4f81a61f5fd4715d2916b3a167
debugobsolete: use the new date argument on obsstore.create

Now that we have this new argument, we can just use it.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2329,21 +2329,25 @@  def debugobsolete(ui, repo, precursor=No
             raise util.Abort('changeset references must be full hexadecimal '
                              'node identifiers')
 
     if precursor is not None:
         metadata = {}
-        if 'date' in opts:
-            metadata['date'] = opts['date']
         metadata['user'] = opts['user'] or ui.username()
         succs = tuple(parsenodeid(succ) for succ in successors)
         l = repo.lock()
         try:
             tr = repo.transaction('debugobsolete')
             try:
                 try:
+                    date = opts.get('date')
+                    if date:
+                        date = util.parsedate(date)
+                    else:
+                        date = None
                     repo.obsstore.create(tr, parsenodeid(precursor), succs,
-                                         opts['flags'], metadata=metadata)
+                                         opts['flags'], date=date,
+                                         metadata=metadata)
                     tr.close()
                 except ValueError, exc:
                     raise util.Abort(_('bad obsmarker input: %s') % exc)
             finally:
                 tr.release()