watchman: I am missing file deletions happening before subscription

放肆的年华 提交于 2019-12-02 08:37:50

The issue is that you're using a since expression term rather than informing watchman to use the since generator (the recency index).

What's the difference? You can think of this as the difference between the FROM and WHERE clauses in SQL. The expression field is similar in intent to the WHERE clause: it applies to the matched results and filters them down, but what you wanted to do is specify the FROM clause by setting the since field in the query spec. This is admittedly a subtle difference.

The solution is to remove the expression term and add the generator term like this:

q = w.query('subscribe', '/tmp/z', 'Buffy', 
            {"since": clock,
             "fields": ["name", "exists", "oclock",
                        "ctime_ns", "new", "mode"]})

While we don't have really any documentation on the use of the pywatchman API, you can borrow the concepts from the slightly better documented nodejs API; here's a relevant snippet:

https://facebook.github.io/watchman/docs/nodejs.html#subscribing-only-to-changed-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!