Submitter | Durham Goode |
---|---|
Date | Oct. 15, 2014, 8:03 p.m. |
Message ID | <a22ff14b5ff64123d37e.1413403401@dev2000.prn2.facebook.com> |
Download | mbox | patch |
Permalink | /patch/6287/ |
State | Accepted |
Headers | show |
Comments
On 10/15/2014 01:03 PM, Durham Goode wrote: > # HG changeset patch > # User Durham Goode <durham@fb.com> > # Date 1413317855 25200 > # Tue Oct 14 13:17:35 2014 -0700 > # Node ID a22ff14b5ff64123d37e1fc42cad86cf76a4c3b1 > # Parent 75d0edb68b417964110e3fcd69187c867f31a119 > obsolete: add isenabled function for option checking I'll probably push this series later today after a renames of `experimental.obsoleteoptions` to `experimentation.evolution` and some tests addition. CCing Matt to give him time for growling if applicable.
On 10/15/14 1:37 PM, Pierre-Yves David wrote: > > > On 10/15/2014 01:03 PM, Durham Goode wrote: >> # HG changeset patch >> # User Durham Goode <durham@fb.com> >> # Date 1413317855 25200 >> # Tue Oct 14 13:17:35 2014 -0700 >> # Node ID a22ff14b5ff64123d37e1fc42cad86cf76a4c3b1 >> # Parent 75d0edb68b417964110e3fcd69187c867f31a119 >> obsolete: add isenabled function for option checking > > I'll probably push this series later today after a renames of > `experimental.obsoleteoptions` to `experimentation.evolution` and some > tests addition. > > CCing Matt to give him time for growling if applicable. > This was pushed to the clowncopter after Pierre-Yves did an over the shoulder review (along with tests). We have not removed obsolete._enabled, but will do that once the mutable-history repo supports the new option flags.
Patch
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -1144,3 +1144,18 @@ def createmarkers(repo, relations, flag= tr.close() finally: tr.release() + +def isenabled(repo, option): + """Returns True if the given repository has the given obsolete option + enabled. + """ + result = set(repo.ui.configlist('experimental', 'obsoleteoptions')) + if 'all' in result: + return True + + # For migration purposes, temporarily return true if the config hasn't been + # set but _enabled is true. + if len(result) == 0 and _enabled: + return True + + return option in result