Mercurial > hg > evolve
changeset 1494:7ddcbf5469bc
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.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Fri, 19 Jun 2015 11:04:18 -0700 |
parents | 35f2f54b557c |
children | 08ae023882f1 |
files | hgext/evolve.py tests/test-evolve.t |
diffstat | 2 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -2445,6 +2445,11 @@ raise util.Abort(_("cannot fold non-linear revisions " "(multiple heads given)")) head = repo[heads.first()] + disallowunstable = not obsolete.isenabled(repo, obsolete.allowunstableopt) + if disallowunstable: + if len(repo.revs("(%ld::) - %ld", revs, revs)) != 0: + raise util.Abort(_("cannot fold chain not ending with a head "\ + "or with branching")) wlock = lock = None try: wlock = repo.wlock()
--- a/tests/test-evolve.t +++ b/tests/test-evolve.t @@ -1148,3 +1148,29 @@ |/ o 18:0bb66d4c1968@default(draft) a3 | + +Check that fold respects the allowunstable option + $ hg up 0bb66d4c1968 + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ mkcommit unstableifparentisfolded + created new head + $ glog -r "18::" + @ 30:30ecefd67c0a@default(draft) add unstableifparentisfolded + | + | o 29:5a6c53544778@default(draft) add c5_ + | | + +---o 20:db3d894869b0@default(draft) add gh + | | + | o 19:10ffdd7e3cc9@default(draft) add gg + |/ + o 18:0bb66d4c1968@default(draft) a3 + | + + $ hg fold --exact "19 + 18" + abort: cannot fold chain not ending with a head or with branching + [255] + $ hg fold --exact "18::29" + abort: cannot fold chain not ending with a head or with branching + [255] + $ hg fold --exact "19::" + 2 changesets folded