Patchwork [2,of,8] obsolete: explicitly pass metadata argument using keyword argument

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 16, 2014, 12:33 a.m.
Message ID <543cc6d8c5bb067d4a41.1408149204@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5437/
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 1408006387 25200
#      Thu Aug 14 01:53:07 2014 -0700
# Node ID 543cc6d8c5bb067d4a41bb72516ef2933ce6bb77
# Parent  23c889905c6298cab09eba54e65faa7c1c015da7
obsolete: explicitly pass metadata argument using keyword argument

We are about to adds more argument to this function (date, parents, etc).
Passing metadata as a keyword argument give use more flexibility when adding
them.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2339,11 +2339,11 @@  def debugobsolete(ui, repo, precursor=No
         try:
             tr = repo.transaction('debugobsolete')
             try:
                 try:
                     repo.obsstore.create(tr, parsenodeid(precursor), succs,
-                                         opts['flags'], metadata)
+                                         opts['flags'], metadata=metadata)
                     tr.close()
                 except ValueError, exc:
                     raise util.Abort(_('bad obsmarker input: %s') % exc)
             finally:
                 tr.release()
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -866,10 +866,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, localmetadata)
+            repo.obsstore.create(tr, nprec, nsucs, flag,
+                                 metadata=localmetadata)
             repo.filteredrevcache.clear()
         tr.close()
     finally:
         tr.release()