mercurial/obsolete.py
changeset 32333 566cfe9cbbb9
parent 32327 3546a771e376
child 32354 f432897a9f49
equal deleted inserted replaced
32332:7aa4a4cf0dde 32333:566cfe9cbbb9
    92 
    92 
    93 # Options for obsolescence
    93 # Options for obsolescence
    94 createmarkersopt = 'createmarkers'
    94 createmarkersopt = 'createmarkers'
    95 allowunstableopt = 'allowunstable'
    95 allowunstableopt = 'allowunstable'
    96 exchangeopt = 'exchange'
    96 exchangeopt = 'exchange'
       
    97 
       
    98 def isenabled(repo, option):
       
    99     """Returns True if the given repository has the given obsolete option
       
   100     enabled.
       
   101     """
       
   102     result = set(repo.ui.configlist('experimental', 'evolution'))
       
   103     if 'all' in result:
       
   104         return True
       
   105 
       
   106     # For migration purposes, temporarily return true if the config hasn't been
       
   107     # set but _enabled is true.
       
   108     if len(result) == 0 and _enabled:
       
   109         return True
       
   110 
       
   111     # createmarkers must be enabled if other options are enabled
       
   112     if ((allowunstableopt in result or exchangeopt in result) and
       
   113         not createmarkersopt in result):
       
   114         raise error.Abort(_("'createmarkers' obsolete option must be enabled "
       
   115                            "if other obsolete options are enabled"))
       
   116 
       
   117     return option in result
    97 
   118 
    98 ### obsolescence marker flag
   119 ### obsolescence marker flag
    99 
   120 
   100 ## bumpedfix flag
   121 ## bumpedfix flag
   101 #
   122 #
  1262                                  date=date, metadata=localmetadata)
  1283                                  date=date, metadata=localmetadata)
  1263             repo.filteredrevcache.clear()
  1284             repo.filteredrevcache.clear()
  1264         tr.close()
  1285         tr.close()
  1265     finally:
  1286     finally:
  1266         tr.release()
  1287         tr.release()
  1267 
       
  1268 def isenabled(repo, option):
       
  1269     """Returns True if the given repository has the given obsolete option
       
  1270     enabled.
       
  1271     """
       
  1272     result = set(repo.ui.configlist('experimental', 'evolution'))
       
  1273     if 'all' in result:
       
  1274         return True
       
  1275 
       
  1276     # For migration purposes, temporarily return true if the config hasn't been
       
  1277     # set but _enabled is true.
       
  1278     if len(result) == 0 and _enabled:
       
  1279         return True
       
  1280 
       
  1281     # createmarkers must be enabled if other options are enabled
       
  1282     if ((allowunstableopt in result or exchangeopt in result) and
       
  1283         not createmarkersopt in result):
       
  1284         raise error.Abort(_("'createmarkers' obsolete option must be enabled "
       
  1285                            "if other obsolete options are enabled"))
       
  1286 
       
  1287     return option in result