{"action":"created","comment":{"url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/comments/60594798","id":60594798,"diff_hunk":"@@ -0,0 +1,163 @@\n+\n+from watchdog.observers import Observer\n+from watchdog.events import FileSystemEventHandler, FileSystemMovedEvent, FileModifiedEvent, DirModifiedEvent, FileCreatedEvent, FileDeletedEvent, DirCreatedEvent, DirDeletedEvent\n+\n+from twisted.internet import reactor\n+from twisted.python.filepath import FilePath\n+#from twisted.python.filepath import InsecurePath\n+\n+from allmydata.util.pollmixin import PollMixin\n+from allmydata.util.assertutil import _assert, precondition\n+from allmydata.util import log\n+from allmydata.util.encodingutil import unicode_from_filepath\n+from allmydata.util.fake_inotify import humanReadableMask, \\\n+    IN_WATCH_MASK, IN_ACCESS, IN_MODIFY, IN_ATTRIB, IN_CLOSE_NOWRITE, IN_CLOSE_WRITE, \\\n+    IN_OPEN, IN_MOVED_FROM, IN_MOVED_TO, IN_CREATE, IN_DELETE, IN_DELETE_SELF, \\\n+    IN_MOVE_SELF, IN_UNMOUNT, IN_Q_OVERFLOW, IN_IGNORED, IN_ONLYDIR, IN_DONT_FOLLOW, \\\n+    IN_MASK_ADD, IN_ISDIR, IN_ONESHOT, IN_CLOSE, IN_MOVED, IN_CHANGED\n+[humanReadableMask, \\\n+    IN_WATCH_MASK, IN_ACCESS, IN_MODIFY, IN_ATTRIB, IN_CLOSE_NOWRITE, IN_CLOSE_WRITE, \\\n+    IN_OPEN, IN_MOVED_FROM, IN_MOVED_TO, IN_CREATE, IN_DELETE, IN_DELETE_SELF, \\\n+    IN_MOVE_SELF, IN_UNMOUNT, IN_Q_OVERFLOW, IN_IGNORED, IN_ONLYDIR, IN_DONT_FOLLOW, \\\n+    IN_MASK_ADD, IN_ISDIR, IN_ONESHOT, IN_CLOSE, IN_MOVED, IN_CHANGED]\n+\n+\n+TRUE  = 0\n+FALSE = 1\n+\n+NOT_STARTED = \"NOT_STARTED\"\n+STARTED     = \"STARTED\"\n+STOPPING    = \"STOPPING\"\n+STOPPED     = \"STOPPED\"\n+\n+class INotifyEventHandler(FileSystemEventHandler):\n+\n+    def __init__(self, path, mask, callbacks, pending_delay):\n+        print \"init INotifyEventHandler\"\n+        FileSystemEventHandler.__init__(self)\n+        self._path = path\n+        self._mask = mask\n+        self._callbacks = callbacks\n+        self._pending_delay = pending_delay\n+        self._pending = set()\n+\n+    def is_masked(self, event):\n+        if isinstance(event, FileSystemMovedEvent) and self._mask & (IN_MOVED_TO | IN_MOVED_FROM):\n+            return True\n+        if (isinstance(event, FileModifiedEvent) or isinstance(event, DirModifiedEvent)) and self._mask & (IN_CLOSE_WRITE | IN_CHANGED):\n+            return True\n+        if (isinstance(event, FileCreatedEvent) or isinstance(event, DirCreatedEvent)) and self._mask & IN_CREATE:\n+            return True\n+        if (isinstance(event, FileDeletedEvent) or isinstance(event, DirDeletedEvent)) and self._mask & IN_DELETE:\n+            return True\n+        return False\n+\n+    def get_event_mask(self, event):\n+        if event.is_directory:\n+            mask = IN_ISDIR\n+        else:\n+            mask = 0 # XXX\n+        if isinstance(event, FileModifiedEvent) or isinstance(event, DirModifiedEvent):\n+            mask = IN_CHANGED\n+        if isinstance(event, FileDeletedEvent) or isinstance(event, DirDeletedEvent):\n+            mask = IN_DELETE\n+        if isinstance(event, FileCreatedEvent) or isinstance(event, DirCreatedEvent):\n+            mask = IN_CREATE\n+        return mask\n+\n+    def process(self, event):\n+        event_filepath_u = event.src_path.decode('utf-8')\n+        if event_filepath_u == unicode_from_filepath(self._path):\n+            # ignore events for parent directory\n+            return\n+        #if not self.is_masked(event):\n+        #    return","path":"src/allmydata/bsd/inotify.py","position":74,"original_position":74,"commit_id":"8939fbf16baa2cbd9ede7b23037b61dfbe323cdd","original_commit_id":"8939fbf16baa2cbd9ede7b23037b61dfbe323cdd","user":{"login":"daira","id":643204,"avatar_url":"https://avatars.githubusercontent.com/u/643204?v=3","gravatar_id":"","url":"https://api.github.com/users/daira","html_url":"https://github.com/daira","followers_url":"https://api.github.com/users/daira/followers","following_url":"https://api.github.com/users/daira/following{/other_user}","gists_url":"https://api.github.com/users/daira/gists{/gist_id}","starred_url":"https://api.github.com/users/daira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daira/subscriptions","organizations_url":"https://api.github.com/users/daira/orgs","repos_url":"https://api.github.com/users/daira/repos","events_url":"https://api.github.com/users/daira/events{/privacy}","received_events_url":"https://api.github.com/users/daira/received_events","type":"User","site_admin":false},"body":"Either reenable this or delete ``is_masked``.","created_at":"2016-04-21T14:54:36Z","updated_at":"2016-04-21T14:54:36Z","html_url":"https://github.com/tahoe-lafs/tahoe-lafs/pull/263#discussion_r60594798","pull_request_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/263","_links":{"self":{"href":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/comments/60594798"},"html":{"href":"https://github.com/tahoe-lafs/tahoe-lafs/pull/263#discussion_r60594798"},"pull_request":{"href":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/263"}}},"pull_request":{"url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/263","id":67360165,"html_url":"https://github.com/tahoe-lafs/tahoe-lafs/pull/263","diff_url":"https://github.com/tahoe-lafs/tahoe-lafs/pull/263.diff","patch_url":"https://github.com/tahoe-lafs/tahoe-lafs/pull/263.patch","issue_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/263","number":263,"state":"open","locked":false,"title":"1432.osx watchdog.0","user":{"login":"daira","id":643204,"avatar_url":"https://avatars.githubusercontent.com/u/643204?v=3","gravatar_id":"","url":"https://api.github.com/users/daira","html_url":"https://github.com/daira","followers_url":"https://api.github.com/users/daira/followers","following_url":"https://api.github.com/users/daira/following{/other_user}","gists_url":"https://api.github.com/users/daira/gists{/gist_id}","starred_url":"https://api.github.com/users/daira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daira/subscriptions","organizations_url":"https://api.github.com/users/daira/orgs","repos_url":"https://api.github.com/users/daira/repos","events_url":"https://api.github.com/users/daira/events{/privacy}","received_events_url":"https://api.github.com/users/daira/received_events","type":"User","site_admin":false},"body":"OSX watchdog changes. refs #1432","created_at":"2016-04-21T14:09:05Z","updated_at":"2016-04-21T14:54:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ec07f0ea6211dc3118f737ec2ec61e085e25d6a1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/263/commits","review_comments_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/263/comments","review_comment_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/263/comments","statuses_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/statuses/8939fbf16baa2cbd9ede7b23037b61dfbe323cdd","head":{"label":"david415:1432.osx-watchdog.0","ref":"1432.osx-watchdog.0","sha":"8939fbf16baa2cbd9ede7b23037b61dfbe323cdd","user":{"login":"david415","id":50611,"avatar_url":"https://avatars.githubusercontent.com/u/50611?v=3","gravatar_id":"","url":"https://api.github.com/users/david415","html_url":"https://github.com/david415","followers_url":"https://api.github.com/users/david415/followers","following_url":"https://api.github.com/users/david415/following{/other_user}","gists_url":"https://api.github.com/users/david415/gists{/gist_id}","starred_url":"https://api.github.com/users/david415/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david415/subscriptions","organizations_url":"https://api.github.com/users/david415/orgs","repos_url":"https://api.github.com/users/david415/repos","events_url":"https://api.github.com/users/david415/events{/privacy}","received_events_url":"https://api.github.com/users/david415/received_events","type":"User","site_admin":false},"repo":{"id":15762988,"name":"tahoe-lafs","full_name":"david415/tahoe-lafs","owner":{"login":"david415","id":50611,"avatar_url":"https://avatars.githubusercontent.com/u/50611?v=3","gravatar_id":"","url":"https://api.github.com/users/david415","html_url":"https://github.com/david415","followers_url":"https://api.github.com/users/david415/followers","following_url":"https://api.github.com/users/david415/following{/other_user}","gists_url":"https://api.github.com/users/david415/gists{/gist_id}","starred_url":"https://api.github.com/users/david415/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david415/subscriptions","organizations_url":"https://api.github.com/users/david415/orgs","repos_url":"https://api.github.com/users/david415/repos","events_url":"https://api.github.com/users/david415/events{/privacy}","received_events_url":"https://api.github.com/users/david415/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/david415/tahoe-lafs","description":"The Tahoe-LAFS decentralized secure filesystem.","fork":true,"url":"https://api.github.com/repos/david415/tahoe-lafs","forks_url":"https://api.github.com/repos/david415/tahoe-lafs/forks","keys_url":"https://api.github.com/repos/david415/tahoe-lafs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/david415/tahoe-lafs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/david415/tahoe-lafs/teams","hooks_url":"https://api.github.com/repos/david415/tahoe-lafs/hooks","issue_events_url":"https://api.github.com/repos/david415/tahoe-lafs/issues/events{/number}","events_url":"https://api.github.com/repos/david415/tahoe-lafs/events","assignees_url":"https://api.github.com/repos/david415/tahoe-lafs/assignees{/user}","branches_url":"https://api.github.com/repos/david415/tahoe-lafs/branches{/branch}","tags_url":"https://api.github.com/repos/david415/tahoe-lafs/tags","blobs_url":"https://api.github.com/repos/david415/tahoe-lafs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/david415/tahoe-lafs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/david415/tahoe-lafs/git/refs{/sha}","trees_url":"https://api.github.com/repos/david415/tahoe-lafs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/david415/tahoe-lafs/statuses/{sha}","languages_url":"https://api.github.com/repos/david415/tahoe-lafs/languages","stargazers_url":"https://api.github.com/repos/david415/tahoe-lafs/stargazers","contributors_url":"https://api.github.com/repos/david415/tahoe-lafs/contributors","subscribers_url":"https://api.github.com/repos/david415/tahoe-lafs/subscribers","subscription_url":"https://api.github.com/repos/david415/tahoe-lafs/subscription","commits_url":"https://api.github.com/repos/david415/tahoe-lafs/commits{/sha}","git_commits_url":"https://api.github.com/repos/david415/tahoe-lafs/git/commits{/sha}","comments_url":"https://api.github.com/repos/david415/tahoe-lafs/comments{/number}","issue_comment_url":"https://api.github.com/repos/david415/tahoe-lafs/issues/comments{/number}","contents_url":"https://api.github.com/repos/david415/tahoe-lafs/contents/{+path}","compare_url":"https://api.github.com/repos/david415/tahoe-lafs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/david415/tahoe-lafs/merges","archive_url":"https://api.github.com/repos/david415/tahoe-lafs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/david415/tahoe-lafs/downloads","issues_url":"https://api.github.com/repos/david415/tahoe-lafs/issues{/number}","pulls_url":"https://api.github.com/repos/david415/tahoe-lafs/pulls{/number}","milestones_url":"https://api.github.com/repos/david415/tahoe-lafs/milestones{/number}","notifications_url":"https://api.github.com/repos/david415/tahoe-lafs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/david415/tahoe-lafs/labels{/name}","releases_url":"https://api.github.com/repos/david415/tahoe-lafs/releases{/id}","deployments_url":"https://api.github.com/repos/david415/tahoe-lafs/deployments","created_at":"2014-01-09T09:57:23Z","updated_at":"2015-04-17T16:27:09Z","pushed_at":"2016-04-20T14:07:35Z","git_url":"git://github.com/david415/tahoe-lafs.git","ssh_url":"git@github.com:david415/tahoe-lafs.git","clone_url":"https://github.com/david415/tahoe-lafs.git","svn_url":"https://github.com/david415/tahoe-lafs","homepage":"https://tahoe-lafs.org/","size":65638,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":3,"default_branch":"517.add-client-plugin-config.0"}},"base":{"label":"tahoe-lafs:2438.magic-folder-stable.13","ref":"2438.magic-folder-stable.13","sha":"d5b494b618854eddda8f9452912a8693ae3adab9","user":{"login":"tahoe-lafs","id":1156454,"avatar_url":"https://avatars.githubusercontent.com/u/1156454?v=3","gravatar_id":"","url":"https://api.github.com/users/tahoe-lafs","html_url":"https://github.com/tahoe-lafs","followers_url":"https://api.github.com/users/tahoe-lafs/followers","following_url":"https://api.github.com/users/tahoe-lafs/following{/other_user}","gists_url":"https://api.github.com/users/tahoe-lafs/gists{/gist_id}","starred_url":"https://api.github.com/users/tahoe-lafs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tahoe-lafs/subscriptions","organizations_url":"https://api.github.com/users/tahoe-lafs/orgs","repos_url":"https://api.github.com/users/tahoe-lafs/repos","events_url":"https://api.github.com/users/tahoe-lafs/events{/privacy}","received_events_url":"https://api.github.com/users/tahoe-lafs/received_events","type":"Organization","site_admin":false},"repo":{"id":3007569,"name":"tahoe-lafs","full_name":"tahoe-lafs/tahoe-lafs","owner":{"login":"tahoe-lafs","id":1156454,"avatar_url":"https://avatars.githubusercontent.com/u/1156454?v=3","gravatar_id":"","url":"https://api.github.com/users/tahoe-lafs","html_url":"https://github.com/tahoe-lafs","followers_url":"https://api.github.com/users/tahoe-lafs/followers","following_url":"https://api.github.com/users/tahoe-lafs/following{/other_user}","gists_url":"https://api.github.com/users/tahoe-lafs/gists{/gist_id}","starred_url":"https://api.github.com/users/tahoe-lafs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tahoe-lafs/subscriptions","organizations_url":"https://api.github.com/users/tahoe-lafs/orgs","repos_url":"https://api.github.com/users/tahoe-lafs/repos","events_url":"https://api.github.com/users/tahoe-lafs/events{/privacy}","received_events_url":"https://api.github.com/users/tahoe-lafs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tahoe-lafs/tahoe-lafs","description":"The Tahoe-LAFS decentralized secure filesystem.","fork":false,"url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs","forks_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/forks","keys_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/teams","hooks_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/hooks","issue_events_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/events{/number}","events_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/events","assignees_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/assignees{/user}","branches_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/branches{/branch}","tags_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/tags","blobs_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/refs{/sha}","trees_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/statuses/{sha}","languages_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/languages","stargazers_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/stargazers","contributors_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/contributors","subscribers_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/subscribers","subscription_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/subscription","commits_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/commits{/sha}","git_commits_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/commits{/sha}","comments_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/comments{/number}","issue_comment_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/comments{/number}","contents_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/contents/{+path}","compare_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/merges","archive_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/downloads","issues_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues{/number}","pulls_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls{/number}","milestones_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/milestones{/number}","notifications_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/labels{/name}","releases_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/releases{/id}","deployments_url":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/deployments","created_at":"2011-12-18T19:33:55Z","updated_at":"2016-04-16T19:30:49Z","pushed_at":"2016-04-21T14:25:42Z","git_url":"git://github.com/tahoe-lafs/tahoe-lafs.git","ssh_url":"git@github.com:tahoe-lafs/tahoe-lafs.git","clone_url":"https://github.com/tahoe-lafs/tahoe-lafs.git","svn_url":"https://github.com/tahoe-lafs/tahoe-lafs","homepage":"https://tahoe-lafs.org/","size":72520,"stargazers_count":470,"watchers_count":470,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":137,"mirror_url":null,"open_issues_count":30,"forks":137,"open_issues":30,"watchers":470,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/263"},"html":{"href":"https://github.com/tahoe-lafs/tahoe-lafs/pull/263"},"issue":{"href":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/263"},"comments":{"href":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/263/comments"},"review_comments":{"href":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/263/comments"},"review_comment":{"href":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/263/commits"},"statuses":{"href":"https://api.github.com/repos/tahoe-lafs/tahoe-lafs/statuses/8939fbf16baa2cbd9ede7b23037b61dfbe323cdd"}}}}