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

login
register
mail settings
Submitter Laurent Charignon
Date June 4, 2015, 11:09 p.m.
Message ID <edd9447f3242ef2a4bdf.1433459361@lcharignon-mbp.local>
Download mbox | patch
Permalink /patch/9497/
State Changes Requested
Headers show

Comments

Laurent Charignon - June 4, 2015, 11:09 p.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1432072589 25200
#      Tue May 19 14:56:29 2015 -0700
# Node ID edd9447f3242ef2a4bdf0070e33f2f22e6fab797
# Parent  5bb1a7c466988c57ba224c9aa59b02c4e778b4bd
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 5, 2015, 5:37 a.m.
On 06/04/2015 04:09 PM, 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 edd9447f3242ef2a4bdf0070e33f2f22e6fab797
> # Parent  5bb1a7c466988c57ba224c9aa59b02c4e778b4bd
> evolve: make fold aware of allowunstable

I would happily take the allow unstable part of this series, but the 
tests hunk depends on the commands activation part. Try avoiding 
building such dependency of 'ready patch' above 'still maturing patch'.
Laurent Charignon - June 5, 2015, 5:59 a.m.
Thanks for the feedback, it would be helpful if you had mentioned that in your prior review.

In your first review, you said that it was good except the lack of 'all' and 'basic' so I assumed that it was ready.


> On Jun 4, 2015, at 10:37 PM, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote:
> 
> 
> 
>> On 06/04/2015 04:09 PM, 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 edd9447f3242ef2a4bdf0070e33f2f22e6fab797
>> # Parent  5bb1a7c466988c57ba224c9aa59b02c4e778b4bd
>> evolve: make fold aware of allowunstable
> 
> I would happily take the allow unstable part of this series, but the tests hunk depends on the commands activation part. Try avoiding building such dependency of 'ready patch' above 'still maturing patch'.
> 
> -- 
> Pierre-Yves David

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -2443,6 +2443,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
@@ -1440,3 +1440,32 @@ 
   [255]
   $ hg prune 897e7966b9ef
   1 changesets pruned
+
+Check that fold respects the allowunstable option
+  $ cat >> $HGRCPATH <<EOF
+  > [experimental]
+  > evolution=createmarkers
+  > evolutioncommands=fold
+  > EOF
+  $ glog -r "25::"
+  o  51:07aaa06da467@default(draft) add c3_
+  |
+  | @  50:e543e9e71376@default(draft) add b4_
+  | |
+  o |  49:9379d7237601@default(draft) add c2prime
+  | |
+  | o  48:2b5cbe59aeca@default(draft) add b3prime
+  | |
+  | o  47:aa4f5bf8925e@default(draft) add b1prime
+  | |
+  o |  42:4a34f6744d4b@default(draft) add c1second
+  |/
+  o  25:4c0bc042ef3b@default(draft) add j1
+  |
+ 
+  $ hg fold --exact "aa4f5bf8925e + 2b5cbe59aeca"
+  abort: cannot fold chain not ending with a head
+  [255]
+  $ hg fold --exact "aa4f5bf8925e + 2b5cbe59aeca + e543e9e71376"
+  3 changesets folded
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved