inotify: proper fix for issue1542 (partially reverting 67e59a9886d5)
issue1542 description:
Unknown files (?) placed in a directory are still marked as present and unknown
when the containing directory is moved out of the repository scope.
Why 67e59a9886d5 was bad:
* When the problem we're addressing only deals with unknown files, the fix to
updatestatus applies for all statuses
* The only reason to move the call schedule_work(wpath, 'd') seems to be that
it allowed an updatestatus call on the deleted directory, in deleted(). But
deleted() should not be called on directories in the first place.
* After fixing an independant issue (1371), test-inotify-issue1542 was failing
Fix:
When processing a deletion of a directory, walk the tree of the unknown files
and remove the entries from repowatcher.
This step does not need to be added in the generic scan() routine: it is only
necessary on a directory deletion.
#!/bin/sh
mkdir t
cd t
hg init
echo "added file1" > file1
echo "another line of text" >> file1
echo "added file2" > file2
hg add file1 file2
hg commit -m "added file1 and file2" -d "1000000 0" -u user
echo "changed file1" >> file1
hg commit -m "changed file1" -d "1000000 0" -u user
hg -q log
hg id
hg update -C 0
hg id
echo "changed file1" >> file1
hg id
hg revert --no-backup --all
hg diff
hg status
hg id
hg update
hg diff
hg status
hg id
hg update -C 0
echo "changed file1 different" >> file1
hg update
hg diff --nodates
hg status
hg id
hg revert --no-backup --all
hg diff
hg status
hg id
hg revert -r tip --no-backup --all
hg diff
hg status
hg id
hg update -C
hg diff
hg status
hg id