{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/watchman/pulls/comments/64628766","id":64628766,"diff_hunk":"@@ -0,0 +1,137 @@\n+# vim:ts=4:sw=4:et:\n+# Copyright 2016-present Facebook, Inc.\n+# Licensed under the Apache License, Version 2.0\n+import WatchmanTestCase\n+import tempfile\n+import os\n+import os.path\n+import sys\n+import unittest\n+\n+\n+class TestSymlink(WatchmanTestCase.WatchmanTestCase):\n+\n+    # test to see that valid symbolic link\n+    # updates are picked up by the symlink_target field\n+    @unittest.skipIf(os.name == 'nt', 'win')\n+    def test_symlink(self):\n+        root = self.mkdtemp()\n+        self.touchRelative(root, '222')\n+        self.touchRelative(root, '333')\n+        os.symlink(os.path.join(root, '222'), os.path.join(root, '111'))\n+\n+        self.watchmanCommand('watch', root)\n+        self.assertFileList(root, ['111', '222', '333'])\n+\n+        expr = {\n+            \"expression\": [\"name\", \"111\"],\n+            \"fields\": [\"name\", \"symlink_target\"]\n+        }\n+\n+        res1 = self.watchmanCommand('query', root, expr)\n+\n+        files1 = res1['files']\n+        self.assertTrue(files1 and os.path.basename(files1[0]['symlink_target']) == '222')","path":"tests/integration/test_symlink.py","position":34,"original_position":34,"commit_id":"60589583324173648c0b631f0803924c7c1b9eca","original_commit_id":"60589583324173648c0b631f0803924c7c1b9eca","user":{"login":"wez","id":117777,"avatar_url":"https://avatars.githubusercontent.com/u/117777?v=3","gravatar_id":"","url":"https://api.github.com/users/wez","html_url":"https://github.com/wez","followers_url":"https://api.github.com/users/wez/followers","following_url":"https://api.github.com/users/wez/following{/other_user}","gists_url":"https://api.github.com/users/wez/gists{/gist_id}","starred_url":"https://api.github.com/users/wez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wez/subscriptions","organizations_url":"https://api.github.com/users/wez/orgs","repos_url":"https://api.github.com/users/wez/repos","events_url":"https://api.github.com/users/wez/events{/privacy}","received_events_url":"https://api.github.com/users/wez/received_events","type":"User","site_admin":false},"body":"I would just use `files['files'][0]` here rather than a local named `files1`, or do:\r\n\r\n```\r\nfiles = files['files']\r\n```\r\n","created_at":"2016-05-25T18:39:20Z","updated_at":"2016-05-25T18:39:20Z","html_url":"https://github.com/facebook/watchman/pull/253#discussion_r64628766","pull_request_url":"https://api.github.com/repos/facebook/watchman/pulls/253","_links":{"self":{"href":"https://api.github.com/repos/facebook/watchman/pulls/comments/64628766"},"html":{"href":"https://github.com/facebook/watchman/pull/253#discussion_r64628766"},"pull_request":{"href":"https://api.github.com/repos/facebook/watchman/pulls/253"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/watchman/pulls/253","id":71432587,"html_url":"https://github.com/facebook/watchman/pull/253","diff_url":"https://github.com/facebook/watchman/pull/253.diff","patch_url":"https://github.com/facebook/watchman/pull/253.patch","issue_url":"https://api.github.com/repos/facebook/watchman/issues/253","number":253,"state":"open","locked":false,"title":"Support for symbolic link target handling","user":{"login":"anirbanr-fb","id":19419823,"avatar_url":"https://avatars.githubusercontent.com/u/19419823?v=3","gravatar_id":"","url":"https://api.github.com/users/anirbanr-fb","html_url":"https://github.com/anirbanr-fb","followers_url":"https://api.github.com/users/anirbanr-fb/followers","following_url":"https://api.github.com/users/anirbanr-fb/following{/other_user}","gists_url":"https://api.github.com/users/anirbanr-fb/gists{/gist_id}","starred_url":"https://api.github.com/users/anirbanr-fb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anirbanr-fb/subscriptions","organizations_url":"https://api.github.com/users/anirbanr-fb/orgs","repos_url":"https://api.github.com/users/anirbanr-fb/repos","events_url":"https://api.github.com/users/anirbanr-fb/events{/privacy}","received_events_url":"https://api.github.com/users/anirbanr-fb/received_events","type":"User","site_admin":false},"body":"Summary: Add a field for symlink_target in watchman file.\r\nAdd a query field to return the symlink_target for the file.\r\n\r\nWhen symbolic link changes, update the target metadata.\r\n\r\nTest Plan: Added tests for symlink. Some of these tests are\r\nnot run on Darwin and NT, because of platform specific behavior.\r\n\r\n1. test for basic symlink targets.\r\n2. invalid symlinks.\r\n3. deletion of symlinks.\r\n4. transition of symlink to regular file or directory\r\n\r\nReviewers: wez\r\n\r\nSubscribers:\r\n\r\nTasks:\r\n\r\nBlame Revision:","created_at":"2016-05-25T17:37:13Z","updated_at":"2016-05-25T18:39:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e3c7e17cf7f22c815518fb3e1c8c06bf35f866cb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/facebook/watchman/pulls/253/commits","review_comments_url":"https://api.github.com/repos/facebook/watchman/pulls/253/comments","review_comment_url":"https://api.github.com/repos/facebook/watchman/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/watchman/issues/253/comments","statuses_url":"https://api.github.com/repos/facebook/watchman/statuses/60589583324173648c0b631f0803924c7c1b9eca","head":{"label":"anirbanr-fb:symlink_metadata","ref":"symlink_metadata","sha":"60589583324173648c0b631f0803924c7c1b9eca","user":{"login":"anirbanr-fb","id":19419823,"avatar_url":"https://avatars.githubusercontent.com/u/19419823?v=3","gravatar_id":"","url":"https://api.github.com/users/anirbanr-fb","html_url":"https://github.com/anirbanr-fb","followers_url":"https://api.github.com/users/anirbanr-fb/followers","following_url":"https://api.github.com/users/anirbanr-fb/following{/other_user}","gists_url":"https://api.github.com/users/anirbanr-fb/gists{/gist_id}","starred_url":"https://api.github.com/users/anirbanr-fb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anirbanr-fb/subscriptions","organizations_url":"https://api.github.com/users/anirbanr-fb/orgs","repos_url":"https://api.github.com/users/anirbanr-fb/repos","events_url":"https://api.github.com/users/anirbanr-fb/events{/privacy}","received_events_url":"https://api.github.com/users/anirbanr-fb/received_events","type":"User","site_admin":false},"repo":{"id":59683147,"name":"watchman","full_name":"anirbanr-fb/watchman","owner":{"login":"anirbanr-fb","id":19419823,"avatar_url":"https://avatars.githubusercontent.com/u/19419823?v=3","gravatar_id":"","url":"https://api.github.com/users/anirbanr-fb","html_url":"https://github.com/anirbanr-fb","followers_url":"https://api.github.com/users/anirbanr-fb/followers","following_url":"https://api.github.com/users/anirbanr-fb/following{/other_user}","gists_url":"https://api.github.com/users/anirbanr-fb/gists{/gist_id}","starred_url":"https://api.github.com/users/anirbanr-fb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anirbanr-fb/subscriptions","organizations_url":"https://api.github.com/users/anirbanr-fb/orgs","repos_url":"https://api.github.com/users/anirbanr-fb/repos","events_url":"https://api.github.com/users/anirbanr-fb/events{/privacy}","received_events_url":"https://api.github.com/users/anirbanr-fb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/anirbanr-fb/watchman","description":"Watches files and records, or triggers actions, when they change. ","fork":true,"url":"https://api.github.com/repos/anirbanr-fb/watchman","forks_url":"https://api.github.com/repos/anirbanr-fb/watchman/forks","keys_url":"https://api.github.com/repos/anirbanr-fb/watchman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/anirbanr-fb/watchman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/anirbanr-fb/watchman/teams","hooks_url":"https://api.github.com/repos/anirbanr-fb/watchman/hooks","issue_events_url":"https://api.github.com/repos/anirbanr-fb/watchman/issues/events{/number}","events_url":"https://api.github.com/repos/anirbanr-fb/watchman/events","assignees_url":"https://api.github.com/repos/anirbanr-fb/watchman/assignees{/user}","branches_url":"https://api.github.com/repos/anirbanr-fb/watchman/branches{/branch}","tags_url":"https://api.github.com/repos/anirbanr-fb/watchman/tags","blobs_url":"https://api.github.com/repos/anirbanr-fb/watchman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/anirbanr-fb/watchman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/anirbanr-fb/watchman/git/refs{/sha}","trees_url":"https://api.github.com/repos/anirbanr-fb/watchman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/anirbanr-fb/watchman/statuses/{sha}","languages_url":"https://api.github.com/repos/anirbanr-fb/watchman/languages","stargazers_url":"https://api.github.com/repos/anirbanr-fb/watchman/stargazers","contributors_url":"https://api.github.com/repos/anirbanr-fb/watchman/contributors","subscribers_url":"https://api.github.com/repos/anirbanr-fb/watchman/subscribers","subscription_url":"https://api.github.com/repos/anirbanr-fb/watchman/subscription","commits_url":"https://api.github.com/repos/anirbanr-fb/watchman/commits{/sha}","git_commits_url":"https://api.github.com/repos/anirbanr-fb/watchman/git/commits{/sha}","comments_url":"https://api.github.com/repos/anirbanr-fb/watchman/comments{/number}","issue_comment_url":"https://api.github.com/repos/anirbanr-fb/watchman/issues/comments{/number}","contents_url":"https://api.github.com/repos/anirbanr-fb/watchman/contents/{+path}","compare_url":"https://api.github.com/repos/anirbanr-fb/watchman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/anirbanr-fb/watchman/merges","archive_url":"https://api.github.com/repos/anirbanr-fb/watchman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/anirbanr-fb/watchman/downloads","issues_url":"https://api.github.com/repos/anirbanr-fb/watchman/issues{/number}","pulls_url":"https://api.github.com/repos/anirbanr-fb/watchman/pulls{/number}","milestones_url":"https://api.github.com/repos/anirbanr-fb/watchman/milestones{/number}","notifications_url":"https://api.github.com/repos/anirbanr-fb/watchman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/anirbanr-fb/watchman/labels{/name}","releases_url":"https://api.github.com/repos/anirbanr-fb/watchman/releases{/id}","deployments_url":"https://api.github.com/repos/anirbanr-fb/watchman/deployments","created_at":"2016-05-25T17:21:46Z","updated_at":"2016-05-25T17:21:48Z","pushed_at":"2016-05-25T17:57:55Z","git_url":"git://github.com/anirbanr-fb/watchman.git","ssh_url":"git@github.com:anirbanr-fb/watchman.git","clone_url":"https://github.com/anirbanr-fb/watchman.git","svn_url":"https://github.com/anirbanr-fb/watchman","homepage":"https://facebook.github.io/watchman/","size":3344,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"256b5d7c38c8c38e45e83bbd53b1d64774042072","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":6930489,"name":"watchman","full_name":"facebook/watchman","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/watchman","description":"Watches files and records, or triggers actions, when they change. ","fork":false,"url":"https://api.github.com/repos/facebook/watchman","forks_url":"https://api.github.com/repos/facebook/watchman/forks","keys_url":"https://api.github.com/repos/facebook/watchman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/watchman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/watchman/teams","hooks_url":"https://api.github.com/repos/facebook/watchman/hooks","issue_events_url":"https://api.github.com/repos/facebook/watchman/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/watchman/events","assignees_url":"https://api.github.com/repos/facebook/watchman/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/watchman/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/watchman/tags","blobs_url":"https://api.github.com/repos/facebook/watchman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/watchman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/watchman/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/watchman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/watchman/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/watchman/languages","stargazers_url":"https://api.github.com/repos/facebook/watchman/stargazers","contributors_url":"https://api.github.com/repos/facebook/watchman/contributors","subscribers_url":"https://api.github.com/repos/facebook/watchman/subscribers","subscription_url":"https://api.github.com/repos/facebook/watchman/subscription","commits_url":"https://api.github.com/repos/facebook/watchman/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/watchman/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/watchman/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/watchman/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/watchman/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/watchman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/watchman/merges","archive_url":"https://api.github.com/repos/facebook/watchman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/watchman/downloads","issues_url":"https://api.github.com/repos/facebook/watchman/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/watchman/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/watchman/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/watchman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/watchman/labels{/name}","releases_url":"https://api.github.com/repos/facebook/watchman/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/watchman/deployments","created_at":"2012-11-29T23:35:52Z","updated_at":"2016-05-25T16:57:32Z","pushed_at":"2016-05-25T17:57:55Z","git_url":"git://github.com/facebook/watchman.git","ssh_url":"git@github.com:facebook/watchman.git","clone_url":"https://github.com/facebook/watchman.git","svn_url":"https://github.com/facebook/watchman","homepage":"https://facebook.github.io/watchman/","size":6657,"stargazers_count":4122,"watchers_count":4122,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":323,"mirror_url":null,"open_issues_count":21,"forks":323,"open_issues":21,"watchers":4122,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/watchman/pulls/253"},"html":{"href":"https://github.com/facebook/watchman/pull/253"},"issue":{"href":"https://api.github.com/repos/facebook/watchman/issues/253"},"comments":{"href":"https://api.github.com/repos/facebook/watchman/issues/253/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/watchman/pulls/253/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/watchman/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/watchman/pulls/253/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/watchman/statuses/60589583324173648c0b631f0803924c7c1b9eca"}}}}
{"actor":{"display_login":"wez"}}