Patchwork [4,of,4,evolve-ext] evolve: make fold aware of allowunstable

login
register
mail settings
Submitter Laurent Charignon
Date June 4, 2015, 6:52 p.m.
Message ID <da540b5fc4afd9fc7d02.1433443937@lcharignon-mbp.local>
Download mbox | patch
Permalink /patch/9485/
State Changes Requested
Headers show

Comments

Laurent Charignon - June 4, 2015, 6:52 p.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1432072589 25200
#      Tue May 19 14:56:29 2015 -0700
# Node ID da540b5fc4afd9fc7d02957f30a72321fbf3ecb4
# Parent  1c2467a8f3a936b7e1d9c02a5a750ef0de140187
evolve: make fold aware of allowunstable

Before this patch, the fold command was performing the same way regardless of
the value of experimental.evolution.
With this patch if the configuration does not allow unstability, fold won't
create instability.
Pierre-Yves David - June 4, 2015, 9:09 p.m.
On 06/04/2015 11:52 AM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon@fb.com>
> # Date 1432072589 25200
> #      Tue May 19 14:56:29 2015 -0700
> # Node ID da540b5fc4afd9fc7d02957f30a72321fbf3ecb4
> # Parent  1c2467a8f3a936b7e1d9c02a5a750ef0de140187
> evolve: make fold aware of allowunstable
>
> Before this patch, the fold command was performing the same way regardless of
> the value of experimental.evolution.
> With this patch if the configuration does not allow unstability, fold won't
> create instability.

The three other patches seems okay, but have trouble applying on the 
current default branch. Can you rebase and provide a pull URL?

The message could maybe use a hint, but this will be fine for now.
Laurent Charignon - June 4, 2015, 9:41 p.m.
I will fix the last one and send a rebased V2

> On Jun 4, 2015, at 2:09 PM, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote:
> 
> 
> 
> On 06/04/2015 11:52 AM, Laurent Charignon wrote:
>> # HG changeset patch
>> # User Laurent Charignon <lcharignon@fb.com>
>> # Date 1432072589 25200
>> #      Tue May 19 14:56:29 2015 -0700
>> # Node ID da540b5fc4afd9fc7d02957f30a72321fbf3ecb4
>> # Parent  1c2467a8f3a936b7e1d9c02a5a750ef0de140187
>> evolve: make fold aware of allowunstable
>> 
>> Before this patch, the fold command was performing the same way regardless of
>> the value of experimental.evolution.
>> With this patch if the configuration does not allow unstability, fold won't
>> create instability.
> 
> The three other patches seems okay, but have trouble applying on the current default branch. Can you rebase and provide a pull URL?
> 
> The message could maybe use a hint, but this will be fine for now.
> 
> -- 
> Pierre-Yves David

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -2356,6 +2356,10 @@ 
         raise util.Abort(_("cannot fold non-linear revisions "
                            "(multiple heads given)"))
     head = repo[heads.first()]
+    disallowunstable = not obsolete.isenabled(repo, obsolete.allowunstableopt)
+    notarepohead = not head.rev() in repo.changelog.headrevs()
+    if disallowunstable and notarepohead:
+        raise util.Abort(_("cannot fold chain not ending with a head"))
     wlock = lock = None
     try:
         wlock = repo.wlock()
diff --git a/tests/test-evolve.t b/tests/test-evolve.t
--- a/tests/test-evolve.t
+++ b/tests/test-evolve.t
@@ -1179,3 +1179,29 @@ 
   $ hg prune bb4ea90d7601
   1 changesets pruned
 
+Check that fold respects the allowunstable option
+  $ cat >> $HGRCPATH <<EOF
+  > [experimental]
+  > evolution=createmarkers
+  > evolutioncommands=fold
+  > EOF
+  $ glog
+  @  19:10ffdd7e3cc9@default(draft) add gg
+  |
+  o  18:0bb66d4c1968@default(draft) a3
+  |
+  o  13:d66b1e328488@default(draft) bumped update to f37ed7a60f43:
+  |
+  o  11:f37ed7a60f43@mybranch(public) a2
+  |
+  o  10:9f8b83c2e7f3@default(public) a1__
+  |
+  o  0:07c1c36d9ef0@default(public) a0
+  
+  $ hg fold --exact "13+18" 
+  abort: cannot fold chain not ending with a head
+  [255]
+  $ hg fold --exact "13+18+19"
+  3 changesets folded
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+