Patchwork [3,of,7,V2,apply,on,date,fix] createmarkers: automatically record the parent of pruned changeset

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 19, 2014, 5:53 p.m.
Message ID <ccb7430b59f3bd74b619.1408470819@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5511/
State Superseded
Headers show

Comments

Pierre-Yves David - Aug. 19, 2014, 5:53 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 ccb7430b59f3bd74b6192e3ca0858c509b94012e
# Parent  938d989ba1dfaa0b67dc26a49c6b07ebf58a8a06
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
@@ -877,13 +877,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()