mercurial/exthelper.py
changeset 41057 f7863606d4ff
parent 41056 41cd64a81dd9
child 41060 7250cbaabde0
equal deleted inserted replaced
41056:41cd64a81dd9 41057:f7863606d4ff
   244         """Decorated function is to be added to the container
   244         """Decorated function is to be added to the container
   245 
   245 
   246         This function takes two arguments, the container and the name of the
   246         This function takes two arguments, the container and the name of the
   247         function to wrap. The wrapping is performed during `uisetup`.
   247         function to wrap. The wrapping is performed during `uisetup`.
   248 
   248 
       
   249         Adding attributes to a container like this is discouraged, because the
       
   250         container modification is visible even in repositories that do not
       
   251         have the extension loaded.  Therefore, care must be taken that the
       
   252         function doesn't make assumptions that the extension was loaded for the
       
   253         current repository.  For `ui` and `repo` instances, a better option is
       
   254         to subclass the instance in `uipopulate` and `reposetup` respectively.
       
   255 
       
   256         https://www.mercurial-scm.org/wiki/WritingExtensions
       
   257 
   249         example::
   258         example::
   250 
   259 
   251             @eh.addattr(context.changectx, 'babar')
   260             @eh.addattr(context.changectx, 'babar')
   252             def babar(ctx):
   261             def babar(ctx):
   253                 return 'babar' in ctx.description
   262                 return 'babar' in ctx.description