Mercurial > public > mercurial-scm > hg-stable
diff hgext/inotify/server.py @ 7351:5ab0abf27dd9
Backed out changeset c5dbe86b0fee (issue1375)
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 12 Nov 2008 09:08:43 +0100 |
parents | c5dbe86b0fee |
children | b4ac1e2cd38c |
line wrap: on
line diff
--- a/hgext/inotify/server.py Tue Nov 11 23:16:59 2008 +0100 +++ b/hgext/inotify/server.py Wed Nov 12 09:08:43 2008 +0100 @@ -19,9 +19,6 @@ class AlreadyStartedException(Exception): pass -class statusdict(dict): - status = None - def join(a, b): if a: if a[-1] == '/': @@ -225,7 +222,7 @@ def dir(self, tree, path): if path: for name in path.split('/'): - tree.setdefault(name, statusdict()) + tree.setdefault(name, {}) tree = tree[name] return tree @@ -235,11 +232,9 @@ for name in path.split('/'): tree = tree[name] except KeyError: - tree = statusdict() - tree.status = 'x' + return 'x' except TypeError: - tree = statusdict() - tree.status = 'd' + return 'd' return tree def split(self, path): @@ -277,7 +272,7 @@ self.statcache.pop(wfn, None) root, fn = self.split(wfn) d = self.dir(self.tree, root) - oldstatus = d.setdefault(fn, statusdict()).status + oldstatus = d.get(fn) isdir = False if oldstatus: try: @@ -302,11 +297,11 @@ (wfn, oldstatus, status)) if not isdir: if status and status != 'i': - d[fn].status = status + d[fn] = status if status in self.statuskeys: dd = self.dir(self.statustrees[status], root) if oldstatus != status or fn not in dd: - dd.setdefault(fn, statusdict()).status = status + dd[fn] = status else: d.pop(fn, None) @@ -368,10 +363,12 @@ for name, val in tree.iteritems(): path = join(prefix, name) - if val.status is not None and val.status in states: - yield path, val - for p in self.walk(states, val, path): - yield p + try: + if val in states: + yield path, val + except TypeError: + for p in self.walk(states, val, path): + yield p def update_hgignore(self): # An update of the ignore file can potentially change the @@ -622,10 +619,12 @@ def genresult(states, tree): for fn in names: l = self.watcher.lookup(fn, tree) - if l.status is not None and l.status in states: - yield fn - for f, s in self.watcher.walk(states, l, fn): - yield f + try: + if l in states: + yield fn + except TypeError: + for f, s in self.watcher.walk(states, l, fn): + yield f results = ['\0'.join(r) for r in [ genresult('l', self.watcher.statustrees['l']),