Patchwork [4,of,8] createmarkers: automatically record the parent of pruned changeset

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 19, 2014, 10:46 p.m.
Message ID <6506a10c1fab25e50b7a.1408488402@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5519/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 19, 2014, 10:46 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1408403836 25200
#      Mon Aug 18 16:17:16 2014 -0700
# Node ID 6506a10c1fab25e50b7adfdc67157054896df596
# Parent  33cd02c4abe039f111f83e5a8a30189a8539b1a3
createmarkers: automatically record the parent of pruned changeset

We need this information to build the set of relevant markers during exchanges. This can only be done at `createmarkers` level since the `obsstore.create` function does not have a repo have therefore not access to the parent information.

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -884,13 +884,16 @@  def createmarkers(repo, relations, flag=
             if not prec.mutable():
                 raise util.Abort("cannot obsolete immutable changeset: %s"
                                  % prec)
             nprec = prec.node()
             nsucs = tuple(s.node() for s in sucs)
+            npare = None
+            if not nsucs:
+                npare = tuple(p.node() for p in prec.parents())
             if nprec in nsucs:
                 raise util.Abort("changeset %s cannot obsolete itself" % prec)
-            repo.obsstore.create(tr, nprec, nsucs, flag, date=date,
-                                 metadata=localmetadata)
+            repo.obsstore.create(tr, nprec, nsucs, flag, parents=npare,
+                                 date=date, metadata=localmetadata)
             repo.filteredrevcache.clear()
         tr.close()
     finally:
         tr.release()