# HG changeset patch # User Benoit Boissinot # Date 1244911288 -7200 # Node ID 23730a47536318841add5a7a3822b880948f9154 # Parent 72af80052bd99421b824019bc4c7e6347189720a inotify.server: the decorator eventaction() shouldn't be a method of repowatcher diff -r 72af80052bd9 -r 23730a475363 hgext/inotify/server.py --- a/hgext/inotify/server.py Sat Jun 13 18:14:50 2009 +0200 +++ b/hgext/inotify/server.py Sat Jun 13 18:41:28 2009 +0200 @@ -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':