--- 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']),
--- a/tests/test-inotify Tue Nov 11 23:16:59 2008 +0100
+++ b/tests/test-inotify Wed Nov 12 09:08:43 2008 +0100
@@ -13,9 +13,6 @@
echo "[extensions]" >> $HGRCPATH
echo "inotify=" >> $HGRCPATH
-echo "[inotify]" >> $HGRCPATH
-echo "debug=1" >> $HGRCPATH
-echo "log=/tmp/inot.log" >> $HGRCPATH
echo % inserve
hg inserve -d --pid-file=hg.pid
@@ -30,28 +27,4 @@
echo % all
hg status -A
-#issue 1375
-#Testing that we can remove a folder and then add a file with the same name
-
-mkdir h f g
-echo h > h/h
-echo f > f/f
-echo g > g/g
-
-hg ci -Am t
-sleep 1
-hg rm h
-hg rm f
-sleep 1
-echo h >h
-ln -s g f
-
-hg add h
-sleep 1
-hg add f
-
-hg status
-hg ci -m0
-hg status
kill `cat hg.pid`
-
--- a/tests/test-inotify-issue1371 Tue Nov 11 23:16:59 2008 +0100
+++ b/tests/test-inotify-issue1371 Wed Nov 12 09:08:43 2008 +0100
@@ -8,8 +8,6 @@
echo "[extensions]" >> $HGRCPATH
echo "inotify=" >> $HGRCPATH
-echo "[inotify]" >> $HGRCPATH
-echo "debug = 1" >> $HGRCPATH
echo inserv1
echo % inserve
@@ -29,7 +27,6 @@
touch g
hg add g
hg mv e h
-sleep 1
hg status
sleep 1
--- a/tests/test-inotify.out Tue Nov 11 23:16:59 2008 +0100
+++ b/tests/test-inotify.out Wed Nov 12 09:08:43 2008 +0100
@@ -27,13 +27,3 @@
C dir/x
C dir/y
C e
-adding f/f
-adding g/g
-adding h/h
-adding hg.pid
-removing h/h
-removing f/f
-A f
-A h
-R f/f
-R h/h