{"action":"created","comment":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/64601757","id":64601757,"diff_hunk":"@@ -191,4 +200,100 @@ defmodule Mix.Tasks.Xref do\n   defp excluded?(module, func, arity, excludes) do\n     MapSet.member?(excludes, module) or MapSet.member?(excludes, {module, func, arity})\n   end\n+\n+  ## Callers\n+\n+  defp do_callers(filter) do\n+    each_source_entries(&source_calls_for_filter(&1, filter), &print_calls/2)\n+  end\n+\n+  defp source_calls_for_filter(source, filter) do\n+    runtime_dispatches = source(source, :runtime_dispatches)\n+    compile_dispatches = source(source, :compile_dispatches)\n+    dispatches = merge_dispatches(runtime_dispatches, compile_dispatches)","path":"lib/mix/lib/mix/tasks/xref.ex","position":101,"original_position":101,"commit_id":"45590590edcdd38df57798df20d4f882cfb2a6ee","original_commit_id":"45590590edcdd38df57798df20d4f882cfb2a6ee","user":{"login":"antipax","id":56482,"avatar_url":"https://avatars.githubusercontent.com/u/56482?v=3","gravatar_id":"","url":"https://api.github.com/users/antipax","html_url":"https://github.com/antipax","followers_url":"https://api.github.com/users/antipax/followers","following_url":"https://api.github.com/users/antipax/following{/other_user}","gists_url":"https://api.github.com/users/antipax/gists{/gist_id}","starred_url":"https://api.github.com/users/antipax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antipax/subscriptions","organizations_url":"https://api.github.com/users/antipax/orgs","repos_url":"https://api.github.com/users/antipax/repos","events_url":"https://api.github.com/users/antipax/events{/privacy}","received_events_url":"https://api.github.com/users/antipax/received_events","type":"User","site_admin":false},"body":"This could be improved by merging dispatches after filtering them, I suppose. Let me know if I should make the change.","created_at":"2016-05-25T16:07:05Z","updated_at":"2016-05-25T16:07:05Z","html_url":"https://github.com/elixir-lang/elixir/pull/4683#discussion_r64601757","pull_request_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4683","_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/64601757"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/4683#discussion_r64601757"},"pull_request":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4683"}}},"pull_request":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4683","id":71340098,"html_url":"https://github.com/elixir-lang/elixir/pull/4683","diff_url":"https://github.com/elixir-lang/elixir/pull/4683.diff","patch_url":"https://github.com/elixir-lang/elixir/pull/4683.patch","issue_url":"https://api.github.com/repos/elixir-lang/elixir/issues/4683","number":4683,"state":"open","locked":false,"title":"Add `mix xref --callers M.f/a`","user":{"login":"antipax","id":56482,"avatar_url":"https://avatars.githubusercontent.com/u/56482?v=3","gravatar_id":"","url":"https://api.github.com/users/antipax","html_url":"https://github.com/antipax","followers_url":"https://api.github.com/users/antipax/followers","following_url":"https://api.github.com/users/antipax/following{/other_user}","gists_url":"https://api.github.com/users/antipax/gists{/gist_id}","starred_url":"https://api.github.com/users/antipax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antipax/subscriptions","organizations_url":"https://api.github.com/users/antipax/orgs","repos_url":"https://api.github.com/users/antipax/repos","events_url":"https://api.github.com/users/antipax/events{/privacy}","received_events_url":"https://api.github.com/users/antipax/received_events","type":"User","site_admin":false},"body":"Related: #4656.\r\n\r\n`mix xref --callers` accepts a `Module`, `Module.function`, or `Module.function/arity`.\r\n\r\nOutput looks like:\r\n\r\n```\r\nfile: lib/a.ex\r\n  A.a/0:2,3\r\n```\r\n\r\nI chose this format because:\r\n  * it looks good if you are simply manually using the task\r\n  * file paths can have all kinds of weird characters in them (like `:` and `\"` and `,`) and this should hopefully simplify parsing for libraries that will rely on the output of this task without having to define any kind of escaping\r\n\r\nThe task also returns data like:\r\n```elixir\r\n[{\"lib/a.ex\", [{A, :a, 0, [3, 2]}]}]\r\n```\r\nfrom `run`, so if you use it from within Elixir itself you don't have to parse anything.\r\n\r\nDo we need any additional switches, like maybe `--silent` (for use from Elixir apps that will simply use the return value of `run`)?\r\n\r\nI also added some missing `record_remote`s to get all of our compile dispatches in, and also fixed a bug where xref was not checking captured remotes.\r\n\r\n/cc @josevalim ","created_at":"2016-05-25T07:07:43Z","updated_at":"2016-05-25T16:07:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c80daf19955101a4a42fef692dd0ee409a32d0c6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4683/commits","review_comments_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4683/comments","review_comment_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/4683/comments","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/45590590edcdd38df57798df20d4f882cfb2a6ee","head":{"label":"antipax:add-mix-xref-callers","ref":"add-mix-xref-callers","sha":"45590590edcdd38df57798df20d4f882cfb2a6ee","user":{"login":"antipax","id":56482,"avatar_url":"https://avatars.githubusercontent.com/u/56482?v=3","gravatar_id":"","url":"https://api.github.com/users/antipax","html_url":"https://github.com/antipax","followers_url":"https://api.github.com/users/antipax/followers","following_url":"https://api.github.com/users/antipax/following{/other_user}","gists_url":"https://api.github.com/users/antipax/gists{/gist_id}","starred_url":"https://api.github.com/users/antipax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antipax/subscriptions","organizations_url":"https://api.github.com/users/antipax/orgs","repos_url":"https://api.github.com/users/antipax/repos","events_url":"https://api.github.com/users/antipax/events{/privacy}","received_events_url":"https://api.github.com/users/antipax/received_events","type":"User","site_admin":false},"repo":{"id":33321987,"name":"elixir","full_name":"antipax/elixir","owner":{"login":"antipax","id":56482,"avatar_url":"https://avatars.githubusercontent.com/u/56482?v=3","gravatar_id":"","url":"https://api.github.com/users/antipax","html_url":"https://github.com/antipax","followers_url":"https://api.github.com/users/antipax/followers","following_url":"https://api.github.com/users/antipax/following{/other_user}","gists_url":"https://api.github.com/users/antipax/gists{/gist_id}","starred_url":"https://api.github.com/users/antipax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antipax/subscriptions","organizations_url":"https://api.github.com/users/antipax/orgs","repos_url":"https://api.github.com/users/antipax/repos","events_url":"https://api.github.com/users/antipax/events{/privacy}","received_events_url":"https://api.github.com/users/antipax/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/antipax/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":true,"url":"https://api.github.com/repos/antipax/elixir","forks_url":"https://api.github.com/repos/antipax/elixir/forks","keys_url":"https://api.github.com/repos/antipax/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/antipax/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/antipax/elixir/teams","hooks_url":"https://api.github.com/repos/antipax/elixir/hooks","issue_events_url":"https://api.github.com/repos/antipax/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/antipax/elixir/events","assignees_url":"https://api.github.com/repos/antipax/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/antipax/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/antipax/elixir/tags","blobs_url":"https://api.github.com/repos/antipax/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/antipax/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/antipax/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/antipax/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/antipax/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/antipax/elixir/languages","stargazers_url":"https://api.github.com/repos/antipax/elixir/stargazers","contributors_url":"https://api.github.com/repos/antipax/elixir/contributors","subscribers_url":"https://api.github.com/repos/antipax/elixir/subscribers","subscription_url":"https://api.github.com/repos/antipax/elixir/subscription","commits_url":"https://api.github.com/repos/antipax/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/antipax/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/antipax/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/antipax/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/antipax/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/antipax/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/antipax/elixir/merges","archive_url":"https://api.github.com/repos/antipax/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/antipax/elixir/downloads","issues_url":"https://api.github.com/repos/antipax/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/antipax/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/antipax/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/antipax/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/antipax/elixir/labels{/name}","releases_url":"https://api.github.com/repos/antipax/elixir/releases{/id}","deployments_url":"https://api.github.com/repos/antipax/elixir/deployments","created_at":"2015-04-02T17:23:06Z","updated_at":"2015-04-02T17:23:08Z","pushed_at":"2016-05-25T16:05:04Z","git_url":"git://github.com/antipax/elixir.git","ssh_url":"git@github.com:antipax/elixir.git","clone_url":"https://github.com/antipax/elixir.git","svn_url":"https://github.com/antipax/elixir","homepage":"http://elixir-lang.org/","size":35174,"stargazers_count":0,"watchers_count":0,"language":"Elixir","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":"elixir-lang:master","ref":"master","sha":"dd29c4ef31e902316e2d63543f016461e6f0bb5e","user":{"login":"elixir-lang","id":1481354,"avatar_url":"https://avatars.githubusercontent.com/u/1481354?v=3","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":1234714,"name":"elixir","full_name":"elixir-lang/elixir","owner":{"login":"elixir-lang","id":1481354,"avatar_url":"https://avatars.githubusercontent.com/u/1481354?v=3","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elixir-lang/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":false,"url":"https://api.github.com/repos/elixir-lang/elixir","forks_url":"https://api.github.com/repos/elixir-lang/elixir/forks","keys_url":"https://api.github.com/repos/elixir-lang/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elixir-lang/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elixir-lang/elixir/teams","hooks_url":"https://api.github.com/repos/elixir-lang/elixir/hooks","issue_events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/elixir-lang/elixir/events","assignees_url":"https://api.github.com/repos/elixir-lang/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/elixir-lang/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/elixir-lang/elixir/tags","blobs_url":"https://api.github.com/repos/elixir-lang/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elixir-lang/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elixir-lang/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/elixir-lang/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/elixir-lang/elixir/languages","stargazers_url":"https://api.github.com/repos/elixir-lang/elixir/stargazers","contributors_url":"https://api.github.com/repos/elixir-lang/elixir/contributors","subscribers_url":"https://api.github.com/repos/elixir-lang/elixir/subscribers","subscription_url":"https://api.github.com/repos/elixir-lang/elixir/subscription","commits_url":"https://api.github.com/repos/elixir-lang/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/elixir-lang/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/elixir-lang/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/elixir-lang/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elixir-lang/elixir/merges","archive_url":"https://api.github.com/repos/elixir-lang/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elixir-lang/elixir/downloads","issues_url":"https://api.github.com/repos/elixir-lang/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/elixir-lang/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/elixir-lang/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/elixir-lang/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elixir-lang/elixir/labels{/name}","releases_url":"https://api.github.com/repos/elixir-lang/elixir/releases{/id}","deployments_url":"https://api.github.com/repos/elixir-lang/elixir/deployments","created_at":"2011-01-09T08:43:57Z","updated_at":"2016-05-25T15:26:07Z","pushed_at":"2016-05-25T16:05:05Z","git_url":"git://github.com/elixir-lang/elixir.git","ssh_url":"git@github.com:elixir-lang/elixir.git","clone_url":"https://github.com/elixir-lang/elixir.git","svn_url":"https://github.com/elixir-lang/elixir","homepage":"http://elixir-lang.org/","size":43558,"stargazers_count":7034,"watchers_count":7034,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":977,"mirror_url":null,"open_issues_count":25,"forks":977,"open_issues":25,"watchers":7034,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4683"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/4683"},"issue":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/4683"},"comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/4683/comments"},"review_comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4683/comments"},"review_comment":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4683/commits"},"statuses":{"href":"https://api.github.com/repos/elixir-lang/elixir/statuses/45590590edcdd38df57798df20d4f882cfb2a6ee"}}}}
{"actor":{"display_login":"antipax"}}