Show More
@@ -142,6 +142,24 b' class pollable(object):' | |||
|
142 | 142 | def shutdown(self): |
|
143 | 143 | raise NotImplementedError |
|
144 | 144 | |
|
145 | def eventaction(code): | |
|
146 | """ | |
|
147 | Decorator to help handle events in repowatcher | |
|
148 | """ | |
|
149 | def decorator(f): | |
|
150 | def wrapper(self, wpath): | |
|
151 | if code == 'm' and wpath in self.lastevent and \ | |
|
152 | self.lastevent[wpath] in 'cm': | |
|
153 | return | |
|
154 | self.lastevent[wpath] = code | |
|
155 | self.timeout = 250 | |
|
156 | ||
|
157 | f(self, wpath) | |
|
158 | ||
|
159 | wrapper.func_name = f.func_name | |
|
160 | return wrapper | |
|
161 | return decorator | |
|
162 | ||
|
145 | 163 | class repowatcher(pollable): |
|
146 | 164 | """ |
|
147 | 165 | Watches inotify events |
@@ -439,21 +457,6 b' class repowatcher(pollable):' | |||
|
439 | 457 | self.statcache.pop(wpath, None) |
|
440 | 458 | raise |
|
441 | 459 | |
|
442 | def eventaction(code): | |
|
443 | def decorator(f): | |
|
444 | def wrapper(self, wpath): | |
|
445 | if code == 'm' and wpath in self.lastevent and \ | |
|
446 | self.lastevent[wpath] in 'cm': | |
|
447 | return | |
|
448 | self.lastevent[wpath] = code | |
|
449 | self.timeout = 250 | |
|
450 | ||
|
451 | f(self, wpath) | |
|
452 | ||
|
453 | wrapper.func_name = f.func_name | |
|
454 | return wrapper | |
|
455 | return decorator | |
|
456 | ||
|
457 | 460 | @eventaction('c') |
|
458 | 461 | def created(self, wpath): |
|
459 | 462 | if wpath == '.hgignore': |
General Comments 0
You need to be logged in to leave comments.
Login now