Skip to content
Snippets Groups Projects
Commit 23730a47 authored by Benoit Boissinot's avatar Benoit Boissinot
Browse files

inotify.server: the decorator eventaction() shouldn't be a method of repowatcher

parent 72af8005
No related branches found
No related tags found
No related merge requests found
......@@ -142,6 +142,24 @@
def shutdown(self):
raise NotImplementedError
def eventaction(code):
"""
Decorator to help handle events in repowatcher
"""
def decorator(f):
def wrapper(self, wpath):
if code == 'm' and wpath in self.lastevent and \
self.lastevent[wpath] in 'cm':
return
self.lastevent[wpath] = code
self.timeout = 250
f(self, wpath)
wrapper.func_name = f.func_name
return wrapper
return decorator
class repowatcher(pollable):
"""
Watches inotify events
......@@ -439,21 +457,6 @@
self.statcache.pop(wpath, None)
raise
def eventaction(code):
def decorator(f):
def wrapper(self, wpath):
if code == 'm' and wpath in self.lastevent and \
self.lastevent[wpath] in 'cm':
return
self.lastevent[wpath] = code
self.timeout = 250
f(self, wpath)
wrapper.func_name = f.func_name
return wrapper
return decorator
@eventaction('c')
def created(self, wpath):
if wpath == '.hgignore':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment