Issue884

Title [inotify] Build products not ignored until .hgignore touched
Priority bug Status chatting
Superseder Nosy List jglick, kirr, kupfer, tonfa
Assigned To Topics inotify, patch

Created on 2007-12-19.21:22:12 by jglick, last changed 2008-09-10.05:21:11 by tonfa.

Messages
msg7046 (view) Author: tonfa Date: 2008-09-10.05:21:09
On Tue, Sep 09, 2008 at 09:07:08PM -0000, Jesse Glick wrote:
>
> Jesse Glick <jesse.glick@sun.com> added the comment:
>
> Update: it looks like I was not really testing anything, because apparently the
> inotify extension no longer does anything unless you explicitly 'hg inserve'.
> (It used to automatically start the daemon on demand but it seems this is no
> longer true?)

It probably means I changed (corrected?) the behaviour, it now depends
on ui.configbool('inotify', 'autostart').
msg7043 (view) Author: tonfa Date: 2008-09-09.22:46:02
It breaks some other stuff, sorry.
msg7041 (view) Author: tonfa Date: 2008-09-09.22:13:03
diff --git a/hgext/inotify/server.py b/hgext/inotify/server.py
--- a/hgext/inotify/server.py
+++ b/hgext/inotify/server.py
@@ -265,10 +265,7 @@
         return type_
 
     def updatestatus(self, wfn, st=None, status=None, oldstatus=None):
-        if st:
-            status = self.filestatus(wfn, st)
-        else:
-            self.statcache.pop(wfn, None)
+        status = self.filestatus(wfn, st)
         root, fn = self.split(wfn)
         d = self.dir(self.tree, root)
         if oldstatus is None:
@@ -380,9 +377,13 @@
         # But it's easier to do nothing than to open that can of
         # worms.
 
-        if self.repo.dirstate.ignorefunc is not None:
-            self.repo.dirstate.ignorefunc = None
+        try:
+            del self.repo.dirstate._ignore
+        except AttributeError:
+            pass
+        else:
             self.ui.note(_('rescanning due to .hgignore change\n'))
+            self.statustrees['?'].clear()
             self.scan()
 
     def getstat(self, wpath):
msg7040 (view) Author: tonfa Date: 2008-09-09.21:15:57
Too bad there were no tests for inotify before :/ that would have avoided this
breakage. I'll look into it.
msg7038 (view) Author: jglick Date: 2008-09-09.21:07:07
Update: it looks like I was not really testing anything, because apparently the
inotify extension no longer does anything unless you explicitly 'hg inserve'.
(It used to automatically start the daemon on demand but it seems this is no
longer true?) When I update the test case accordingly, I get the original bug,
plus an error:


#!/bin/sh
cd /tmp
killall hg
rm -rf hg-inotify-test
hg init hg-inotify-test
cd hg-inotify-test
hg inserve &
echo '^build$' > .hgignore
hg ci -m ignorelist -A
mkdir build
touch build/x
touch build/y
echo 'stat #1'
hg stat
touch .hgignore
echo 'stat #2'
hg stat


hg: no process killed
adding .hgignore
stat #1
M .hgignore
? build/x
? build/y
stat #2
** unknown exception encountered, details follow
** report bug details to http://www.selenic.com/mercurial/bts
** or mercurial@selenic.com
** Mercurial Distributed SCM (version 1.0.2)
Traceback (most recent call last):
  File "/home/jglick/bin/hg", line 20, in <module>
    mercurial.dispatch.run()
  File "/home/jglick/lib/python/mercurial/dispatch.py", line 20, in run
    sys.exit(dispatch(sys.argv[1:]))
  File "/home/jglick/lib/python/mercurial/dispatch.py", line 29, in dispatch
    return _runcatch(u, args)
  File "/home/jglick/lib/python/mercurial/dispatch.py", line 45, in _runcatch
    return _dispatch(ui, args)
  File "/home/jglick/lib/python/mercurial/dispatch.py", line 364, in _dispatch
    ret = _runcommand(ui, options, cmd, d)
  File "/home/jglick/lib/python/mercurial/dispatch.py", line 417, in _runcommand
    return checkargs()
  File "/home/jglick/lib/python/mercurial/dispatch.py", line 373, in checkargs
    return cmdfunc()
  File "/home/jglick/lib/python/mercurial/dispatch.py", line 356, in <lambda>
    d = lambda: func(ui, repo, *args, **cmdoptions)
  File "/home/jglick/lib/python/hgext/inotify/__init__.py", line 36, in serve
    cmdutil.service(opts, initfn=service.init, runfn=service.run)
  File "/home/jglick/lib/python/mercurial/cmdutil.py", line 561, in service
    return runfn()
  File "/home/jglick/lib/python/hgext/inotify/__init__.py", line 31, in run
    self.master.run()
  File "/home/jglick/lib/python/hgext/inotify/server.py", line 686, in run
    self.table[fd].handle_event(fd, event)
  File "/home/jglick/lib/python/hgext/inotify/server.py", line 595, in handle_event
    self.watcher.handle_timeout()
  File "/home/jglick/lib/python/hgext/inotify/server.py", line 541, in
handle_timeout
    self.deferred_event(wpath, evt)
  File "/home/jglick/lib/python/hgext/inotify/server.py", line 454, in
deferred_event
    self.modified(wpath)
  File "/home/jglick/lib/python/hgext/inotify/server.py", line 420, in modified
    self.update_hgignore()
  File "/home/jglick/lib/python/hgext/inotify/server.py", line 383, in
update_hgignore
    if self.repo.dirstate.ignorefunc is not None:
  File "/home/jglick/lib/python/mercurial/dirstate.py", line 70, in __getattr__
    raise AttributeError, name
AttributeError: ignorefunc
msg7033 (view) Author: jglick Date: 2008-09-09.20:37:47
I cannot reproduce in Hg 1.0 or 1.0.2.
msg6974 (view) Author: tonfa Date: 2008-09-06.19:31:09
I can't reproduce, can you add more info or test with a more recent mercurial ?
msg4650 (view) Author: jglick Date: 2007-12-19.21:22:12
Using the INotify extension (539db616abeb), there is a bit of a problem with
ignore lists. Newly created ignored files (common during a build) are listed as
unknown until you make some change to .hgignore. Test case:

$ hg init hg-inotify-test
$ cd hg-inotify-test
$ echo '^build$' > .hgignore
$ hg ci -m ignorelist -A
adding .hgignore
$ mkdir build
$ touch build/x
$ touch build/y
$ hg stat
? build/x
? build/y
$ touch .hgignore
$ hg stat
$
History
Date User Action Args
2008-09-10 05:21:11tonfasetnosy: tonfa, kupfer, jglick, kirr
messages: + msg7046
2008-09-09 22:46:02tonfasetnosy: tonfa, kupfer, jglick, kirr
messages: + msg7043
2008-09-09 22:13:04tonfasettopic: + patch
nosy: tonfa, kupfer, jglick, kirr
messages: + msg7041
2008-09-09 21:15:58tonfasetnosy: tonfa, kupfer, jglick, kirr
messages: + msg7040
2008-09-09 21:07:08jglicksetstatus: resolved -> chatting
nosy: tonfa, kupfer, jglick, kirr
messages: + msg7038
2008-09-09 20:37:47jglicksetstatus: chatting -> resolved
nosy: tonfa, kupfer, jglick, kirr
messages: + msg7033
2008-09-06 19:31:09tonfasettopic: + inotify
nosy: + tonfa
status: unread -> chatting
messages: + msg6974
2008-06-29 11:55:51kirrsetnosy: + kirr
2008-02-05 21:39:58kupfersetnosy: + kupfer
2007-12-19 21:22:12jglickcreate