def acquire_lock(func):
@wraps(func)<EOL>def wrapper(self, *args, **kwargs):<EOL><INDENT>with self.locker as r:<EOL><INDENT>acquired, code, _  = r<EOL>if acquired:<EOL><INDENT>try:<EOL><INDENT>r = func(self, *args, **kwargs)<EOL><DEDENT>except Exception as err:<EOL><INDENT>e = str(err)<EOL><DEDENT>else:<EOL><INDENT>e = None<EOL><DEDENT><DEDENT>else:<EOL><INDENT>warnings.warn("<STR_LIT>"%(code,func.__name__) )<EOL>e = None<EOL>r = None<EOL><DEDENT><DEDENT>if e is not None:<EOL><INDENT>traceback.print_stack()<EOL>raise Exception(e)<EOL><DEDENT>return r<EOL><DEDENT>return wrapper<EOL>
Decorate methods when locking repository is required.