Patchwork [2,of,4,evolve-ext] evolve: compute prune destination node before creating obsolescence markers

login
register
mail settings
Submitter Laurent Charignon
Date April 3, 2015, 2:09 a.m.
Message ID <89b46ecc6bcfec588667.1428026996@lcharignon-mbp.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/8464/
State Changes Requested
Headers show

Comments

Laurent Charignon - April 3, 2015, 2:09 a.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1428024824 25200
#      Thu Apr 02 18:33:44 2015 -0700
# Node ID 89b46ecc6bcfec588667eec38e6ce85ea002b82b
# Parent  3a9143852da729fb8c0183ca5bbce2009ea02f8b
evolve: compute prune destination node before creating obsolescence markers

Prune used to compute the destination commit to update to after creating the
obsolescence markers. This is a commit to prevent a bug that would occur
with the changes in inhibit for transactions (next commit).

Indeed, with that change in inhibit, when creating the obsolescence markers
in prune, they would get inhibited right away and we wouldn't update to the
first non obsolete parent but stay on the same obsolete node (bug).
Pierre-Yves David - April 3, 2015, 6:44 p.m.
On 04/02/2015 07:09 PM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon@fb.com>
> # Date 1428024824 25200
> #      Thu Apr 02 18:33:44 2015 -0700
> # Node ID 89b46ecc6bcfec588667eec38e6ce85ea002b82b
> # Parent  3a9143852da729fb8c0183ca5bbce2009ea02f8b
> evolve: compute prune destination node before creating obsolescence markers
>
> Prune used to compute the destination commit to update to after creating the
> obsolescence markers. This is a commit to prevent a bug that would occur
> with the changes in inhibit for transactions (next commit).
>
> Indeed, with that change in inhibit, when creating the obsolescence markers
> in prune, they would get inhibited right away and we wouldn't update to the
> first non obsolete parent but stay on the same obsolete node (bug).

This is not going to be enough. The working copy update and bookmark 
update must be completed before the transaction is closed. So you need 
to get the markers created at the end of the function. (not super happy 
about this logic inversion, so make sure you document it properly)

I just pushed a test update that show the failure.

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -1832,12 +1832,6 @@ 
         if biject:
             relations = [(p, (s,)) for p, s in zip(precs, sucs)]
 
-        # create markers
-        obsolete.createmarkers(repo, relations, metadata=metadata)
-
-        # informs that changeset have been pruned
-        ui.status(_('%i changesets pruned\n') % len(precs))
-
         wdp = repo['.']
 
         if len(sucs) == 1 and len(precs) == 1 and wdp in precs:
@@ -1847,8 +1841,13 @@ 
             # update to an unkilled parent
             newnode = wdp
 
-            while newnode.obsolete():
+            while newnode in precs or newnode.obsolete():
                 newnode = newnode.parents()[0]
+        # create markers
+        obsolete.createmarkers(repo, relations, metadata=metadata)
+
+        # informs that changeset have been pruned
+        ui.status(_('%i changesets pruned\n') % len(precs))
 
         if newnode.node() != wdp.node():
             if opts.get('keep', False):