{"action":"created","comment":{"url":"https://api.github.com/repos/hercules-team/augeas/pulls/comments/69377495","id":69377495,"diff_hunk":"@@ -822,12 +822,17 @@ int transform_load(struct augeas *aug, struct tree *xfm) {\n         // FIXME: Record an error and return 0\n         return -1;\n     }\n+\n     r = filter_generate(xfm, aug->root, &nmatches, &matches);\n     if (r == -1)\n         return -1;\n     for (int i=0; i < nmatches; i++) {\n         const char *filename = matches[i] + strlen(aug->root) - 1;\n         struct tree *finfo = file_info(aug, filename);\n+\n+        if (file != NULL && STREQ(filename, file) != 0)","path":"src/transform.c","position":30,"original_position":30,"commit_id":"af75289040964dc6e0458fcc92abe4cdce81bb2d","original_commit_id":"af75289040964dc6e0458fcc92abe4cdce81bb2d","user":{"login":"raphink","id":650430,"avatar_url":"https://avatars.githubusercontent.com/u/650430?v=3","gravatar_id":"","url":"https://api.github.com/users/raphink","html_url":"https://github.com/raphink","followers_url":"https://api.github.com/users/raphink/followers","following_url":"https://api.github.com/users/raphink/following{/other_user}","gists_url":"https://api.github.com/users/raphink/gists{/gist_id}","starred_url":"https://api.github.com/users/raphink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphink/subscriptions","organizations_url":"https://api.github.com/users/raphink/orgs","repos_url":"https://api.github.com/users/raphink/repos","events_url":"https://api.github.com/users/raphink/events{/privacy}","received_events_url":"https://api.github.com/users/raphink/received_events","type":"User","site_admin":false},"body":"Makes sense indeed. This is also why loading `/etc/fstab` resulted in `/etc/mtab` being loaded…","created_at":"2016-07-02T12:28:27Z","updated_at":"2016-07-02T12:28:27Z","html_url":"https://github.com/hercules-team/augeas/pull/135#discussion_r69377495","pull_request_url":"https://api.github.com/repos/hercules-team/augeas/pulls/135","_links":{"self":{"href":"https://api.github.com/repos/hercules-team/augeas/pulls/comments/69377495"},"html":{"href":"https://github.com/hercules-team/augeas/pull/135#discussion_r69377495"},"pull_request":{"href":"https://api.github.com/repos/hercules-team/augeas/pulls/135"}}},"pull_request":{"url":"https://api.github.com/repos/hercules-team/augeas/pulls/135","id":17109255,"html_url":"https://github.com/hercules-team/augeas/pull/135","diff_url":"https://github.com/hercules-team/augeas/pull/135.diff","patch_url":"https://github.com/hercules-team/augeas/pull/135.patch","issue_url":"https://api.github.com/repos/hercules-team/augeas/issues/135","number":135,"state":"open","locked":false,"title":"Add aug_filter_file, cmd_filter_file and --filter-file","user":{"login":"raphink","id":650430,"avatar_url":"https://avatars.githubusercontent.com/u/650430?v=3","gravatar_id":"","url":"https://api.github.com/users/raphink","html_url":"https://github.com/raphink","followers_url":"https://api.github.com/users/raphink/followers","following_url":"https://api.github.com/users/raphink/following{/other_user}","gists_url":"https://api.github.com/users/raphink/gists{/gist_id}","starred_url":"https://api.github.com/users/raphink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphink/subscriptions","organizations_url":"https://api.github.com/users/raphink/orgs","repos_url":"https://api.github.com/users/raphink/repos","events_url":"https://api.github.com/users/raphink/events{/privacy}","received_events_url":"https://api.github.com/users/raphink/received_events","type":"User","site_admin":false},"body":"This PR adds a new `-F|--filter-file` option to `augtool` which allows to choose which lens to load based on the desired files. It loads `augtool` with `--noload` and filters the lenses dynamically.\r\n\r\nThe result is faster than loading all lenses, but still definitely slower than loading with a specific lens (since it still needs to load all the lenses in order to determine which ones to keep).\r\n\r\nSample usage:\r\n\r\n    $ augtool -F /etc/fstab -F /etc/hosts\r\n    augtool> ls /files/etc/\r\n    mtab/ = (none)\r\n    fstab/ = (none)\r\n    hosts/ = (none)\r\n\r\nThe PR exposes a new public API call `aug_filter_file`:\r\n\r\n```c\r\n/*\r\n * Function: aug_filter_file\r\n *\r\n * Load a specific FILE, using autoload statements.\r\n * You need to call aug_load after this action.\r\n *\r\n * Returns:\r\n * 1 on success, -1 on failure\r\n */\r\nint aug_filter_file(augeas *aug, const char *file);\r\n```\r\n\r\nIt also exposes a `filter-file` command to add more mappings:\r\n\r\n```\r\naugtool> help filter-file\r\n  COMMAND\r\n    filter-file - load a specific file\r\n\r\n  SYNOPSIS\r\n    filter-file <FILE>\r\n\r\n  DESCRIPTION\r\n    Load a specific FILE, using autoload statements.\r\n   You need to call load after this action.\r\n   \r\n\r\n  OPTIONS\r\n     <FILE>    the file to filter\r\n\r\n```\r\n\r\n","created_at":"2014-06-13T13:34:12Z","updated_at":"2016-07-02T12:28:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a1049960aebe6d5e1e8f641b5b9bd30f4dcfe7ea","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hercules-team/augeas/pulls/135/commits","review_comments_url":"https://api.github.com/repos/hercules-team/augeas/pulls/135/comments","review_comment_url":"https://api.github.com/repos/hercules-team/augeas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hercules-team/augeas/issues/135/comments","statuses_url":"https://api.github.com/repos/hercules-team/augeas/statuses/af75289040964dc6e0458fcc92abe4cdce81bb2d","head":{"label":"raphink:dev/load_only","ref":"dev/load_only","sha":"af75289040964dc6e0458fcc92abe4cdce81bb2d","user":{"login":"raphink","id":650430,"avatar_url":"https://avatars.githubusercontent.com/u/650430?v=3","gravatar_id":"","url":"https://api.github.com/users/raphink","html_url":"https://github.com/raphink","followers_url":"https://api.github.com/users/raphink/followers","following_url":"https://api.github.com/users/raphink/following{/other_user}","gists_url":"https://api.github.com/users/raphink/gists{/gist_id}","starred_url":"https://api.github.com/users/raphink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphink/subscriptions","organizations_url":"https://api.github.com/users/raphink/orgs","repos_url":"https://api.github.com/users/raphink/repos","events_url":"https://api.github.com/users/raphink/events{/privacy}","received_events_url":"https://api.github.com/users/raphink/received_events","type":"User","site_admin":false},"repo":{"id":2836641,"name":"augeas","full_name":"raphink/augeas","owner":{"login":"raphink","id":650430,"avatar_url":"https://avatars.githubusercontent.com/u/650430?v=3","gravatar_id":"","url":"https://api.github.com/users/raphink","html_url":"https://github.com/raphink","followers_url":"https://api.github.com/users/raphink/followers","following_url":"https://api.github.com/users/raphink/following{/other_user}","gists_url":"https://api.github.com/users/raphink/gists{/gist_id}","starred_url":"https://api.github.com/users/raphink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphink/subscriptions","organizations_url":"https://api.github.com/users/raphink/orgs","repos_url":"https://api.github.com/users/raphink/repos","events_url":"https://api.github.com/users/raphink/events{/privacy}","received_events_url":"https://api.github.com/users/raphink/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/raphink/augeas","description":"A configuration editing tool and API","fork":true,"url":"https://api.github.com/repos/raphink/augeas","forks_url":"https://api.github.com/repos/raphink/augeas/forks","keys_url":"https://api.github.com/repos/raphink/augeas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/raphink/augeas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/raphink/augeas/teams","hooks_url":"https://api.github.com/repos/raphink/augeas/hooks","issue_events_url":"https://api.github.com/repos/raphink/augeas/issues/events{/number}","events_url":"https://api.github.com/repos/raphink/augeas/events","assignees_url":"https://api.github.com/repos/raphink/augeas/assignees{/user}","branches_url":"https://api.github.com/repos/raphink/augeas/branches{/branch}","tags_url":"https://api.github.com/repos/raphink/augeas/tags","blobs_url":"https://api.github.com/repos/raphink/augeas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/raphink/augeas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/raphink/augeas/git/refs{/sha}","trees_url":"https://api.github.com/repos/raphink/augeas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/raphink/augeas/statuses/{sha}","languages_url":"https://api.github.com/repos/raphink/augeas/languages","stargazers_url":"https://api.github.com/repos/raphink/augeas/stargazers","contributors_url":"https://api.github.com/repos/raphink/augeas/contributors","subscribers_url":"https://api.github.com/repos/raphink/augeas/subscribers","subscription_url":"https://api.github.com/repos/raphink/augeas/subscription","commits_url":"https://api.github.com/repos/raphink/augeas/commits{/sha}","git_commits_url":"https://api.github.com/repos/raphink/augeas/git/commits{/sha}","comments_url":"https://api.github.com/repos/raphink/augeas/comments{/number}","issue_comment_url":"https://api.github.com/repos/raphink/augeas/issues/comments{/number}","contents_url":"https://api.github.com/repos/raphink/augeas/contents/{+path}","compare_url":"https://api.github.com/repos/raphink/augeas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/raphink/augeas/merges","archive_url":"https://api.github.com/repos/raphink/augeas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/raphink/augeas/downloads","issues_url":"https://api.github.com/repos/raphink/augeas/issues{/number}","pulls_url":"https://api.github.com/repos/raphink/augeas/pulls{/number}","milestones_url":"https://api.github.com/repos/raphink/augeas/milestones{/number}","notifications_url":"https://api.github.com/repos/raphink/augeas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/raphink/augeas/labels{/name}","releases_url":"https://api.github.com/repos/raphink/augeas/releases{/id}","deployments_url":"https://api.github.com/repos/raphink/augeas/deployments","created_at":"2011-11-23T15:27:55Z","updated_at":"2016-03-20T13:19:47Z","pushed_at":"2016-07-01T20:46:00Z","git_url":"git://github.com/raphink/augeas.git","ssh_url":"git@github.com:raphink/augeas.git","clone_url":"https://github.com/raphink/augeas.git","svn_url":"https://github.com/raphink/augeas","homepage":"http://augeas.net/","size":7855,"stargazers_count":1,"watchers_count":1,"language":"Augeas","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"hercules-team:master","ref":"master","sha":"413b69eb4de6e25b07bb412a6093d629f9891c4f","user":{"login":"hercules-team","id":2223281,"avatar_url":"https://avatars.githubusercontent.com/u/2223281?v=3","gravatar_id":"","url":"https://api.github.com/users/hercules-team","html_url":"https://github.com/hercules-team","followers_url":"https://api.github.com/users/hercules-team/followers","following_url":"https://api.github.com/users/hercules-team/following{/other_user}","gists_url":"https://api.github.com/users/hercules-team/gists{/gist_id}","starred_url":"https://api.github.com/users/hercules-team/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hercules-team/subscriptions","organizations_url":"https://api.github.com/users/hercules-team/orgs","repos_url":"https://api.github.com/users/hercules-team/repos","events_url":"https://api.github.com/users/hercules-team/events{/privacy}","received_events_url":"https://api.github.com/users/hercules-team/received_events","type":"Organization","site_admin":false},"repo":{"id":59056,"name":"augeas","full_name":"hercules-team/augeas","owner":{"login":"hercules-team","id":2223281,"avatar_url":"https://avatars.githubusercontent.com/u/2223281?v=3","gravatar_id":"","url":"https://api.github.com/users/hercules-team","html_url":"https://github.com/hercules-team","followers_url":"https://api.github.com/users/hercules-team/followers","following_url":"https://api.github.com/users/hercules-team/following{/other_user}","gists_url":"https://api.github.com/users/hercules-team/gists{/gist_id}","starred_url":"https://api.github.com/users/hercules-team/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hercules-team/subscriptions","organizations_url":"https://api.github.com/users/hercules-team/orgs","repos_url":"https://api.github.com/users/hercules-team/repos","events_url":"https://api.github.com/users/hercules-team/events{/privacy}","received_events_url":"https://api.github.com/users/hercules-team/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hercules-team/augeas","description":"A configuration editing tool and API","fork":false,"url":"https://api.github.com/repos/hercules-team/augeas","forks_url":"https://api.github.com/repos/hercules-team/augeas/forks","keys_url":"https://api.github.com/repos/hercules-team/augeas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hercules-team/augeas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hercules-team/augeas/teams","hooks_url":"https://api.github.com/repos/hercules-team/augeas/hooks","issue_events_url":"https://api.github.com/repos/hercules-team/augeas/issues/events{/number}","events_url":"https://api.github.com/repos/hercules-team/augeas/events","assignees_url":"https://api.github.com/repos/hercules-team/augeas/assignees{/user}","branches_url":"https://api.github.com/repos/hercules-team/augeas/branches{/branch}","tags_url":"https://api.github.com/repos/hercules-team/augeas/tags","blobs_url":"https://api.github.com/repos/hercules-team/augeas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hercules-team/augeas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hercules-team/augeas/git/refs{/sha}","trees_url":"https://api.github.com/repos/hercules-team/augeas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hercules-team/augeas/statuses/{sha}","languages_url":"https://api.github.com/repos/hercules-team/augeas/languages","stargazers_url":"https://api.github.com/repos/hercules-team/augeas/stargazers","contributors_url":"https://api.github.com/repos/hercules-team/augeas/contributors","subscribers_url":"https://api.github.com/repos/hercules-team/augeas/subscribers","subscription_url":"https://api.github.com/repos/hercules-team/augeas/subscription","commits_url":"https://api.github.com/repos/hercules-team/augeas/commits{/sha}","git_commits_url":"https://api.github.com/repos/hercules-team/augeas/git/commits{/sha}","comments_url":"https://api.github.com/repos/hercules-team/augeas/comments{/number}","issue_comment_url":"https://api.github.com/repos/hercules-team/augeas/issues/comments{/number}","contents_url":"https://api.github.com/repos/hercules-team/augeas/contents/{+path}","compare_url":"https://api.github.com/repos/hercules-team/augeas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hercules-team/augeas/merges","archive_url":"https://api.github.com/repos/hercules-team/augeas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hercules-team/augeas/downloads","issues_url":"https://api.github.com/repos/hercules-team/augeas/issues{/number}","pulls_url":"https://api.github.com/repos/hercules-team/augeas/pulls{/number}","milestones_url":"https://api.github.com/repos/hercules-team/augeas/milestones{/number}","notifications_url":"https://api.github.com/repos/hercules-team/augeas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hercules-team/augeas/labels{/name}","releases_url":"https://api.github.com/repos/hercules-team/augeas/releases{/id}","deployments_url":"https://api.github.com/repos/hercules-team/augeas/deployments","created_at":"2008-10-03T01:27:06Z","updated_at":"2016-06-16T12:22:13Z","pushed_at":"2016-07-01T20:46:00Z","git_url":"git://github.com/hercules-team/augeas.git","ssh_url":"git@github.com:hercules-team/augeas.git","clone_url":"https://github.com/hercules-team/augeas.git","svn_url":"https://github.com/hercules-team/augeas","homepage":"http://augeas.net/","size":9279,"stargazers_count":222,"watchers_count":222,"language":"Augeas","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":126,"mirror_url":null,"open_issues_count":77,"forks":126,"open_issues":77,"watchers":222,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hercules-team/augeas/pulls/135"},"html":{"href":"https://github.com/hercules-team/augeas/pull/135"},"issue":{"href":"https://api.github.com/repos/hercules-team/augeas/issues/135"},"comments":{"href":"https://api.github.com/repos/hercules-team/augeas/issues/135/comments"},"review_comments":{"href":"https://api.github.com/repos/hercules-team/augeas/pulls/135/comments"},"review_comment":{"href":"https://api.github.com/repos/hercules-team/augeas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hercules-team/augeas/pulls/135/commits"},"statuses":{"href":"https://api.github.com/repos/hercules-team/augeas/statuses/af75289040964dc6e0458fcc92abe4cdce81bb2d"}}}}
{"actor":{"display_login":"raphink"}}