{"action":"created","comment":{"url":"https://api.github.com/repos/hadley/devtools/pulls/comments/38550252","id":38550252,"diff_hunk":"@@ -67,3 +67,15 @@ github_pat <- function() {\n   message(\"Using github PAT from envvar GITHUB_PAT\")\n   pat\n }\n+\n+github_DESCRIPTION <- function(username, repo, ref = \"master\") {\n+  response <- github_GET(\n+    file.path(\"repos\", username, repo, \"contents\", \"DESCRIPTION\"),\n+    httr::write_memory())","path":"R/github.R","position":8,"original_position":8,"commit_id":"ba5998b916f9cbcaf3f25309f296ace2bed6f0a1","original_commit_id":"ba5998b916f9cbcaf3f25309f296ace2bed6f0a1","user":{"login":"hadley","id":4196,"avatar_url":"https://avatars.githubusercontent.com/u/4196?v=3","gravatar_id":"","url":"https://api.github.com/users/hadley","html_url":"https://github.com/hadley","followers_url":"https://api.github.com/users/hadley/followers","following_url":"https://api.github.com/users/hadley/following{/other_user}","gists_url":"https://api.github.com/users/hadley/gists{/gist_id}","starred_url":"https://api.github.com/users/hadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadley/subscriptions","organizations_url":"https://api.github.com/users/hadley/orgs","repos_url":"https://api.github.com/users/hadley/repos","events_url":"https://api.github.com/users/hadley/events{/privacy}","received_events_url":"https://api.github.com/users/hadley/received_events","type":"User","site_admin":false},"body":"Isn't that the default?","created_at":"2015-09-02T16:00:02Z","updated_at":"2015-09-02T16:00:02Z","html_url":"https://github.com/hadley/devtools/pull/903#discussion_r38550252","pull_request_url":"https://api.github.com/repos/hadley/devtools/pulls/903","_links":{"self":{"href":"https://api.github.com/repos/hadley/devtools/pulls/comments/38550252"},"html":{"href":"https://github.com/hadley/devtools/pull/903#discussion_r38550252"},"pull_request":{"href":"https://api.github.com/repos/hadley/devtools/pulls/903"}}},"pull_request":{"url":"https://api.github.com/repos/hadley/devtools/pulls/903","id":43339706,"html_url":"https://github.com/hadley/devtools/pull/903","diff_url":"https://github.com/hadley/devtools/pull/903.diff","patch_url":"https://github.com/hadley/devtools/pull/903.patch","issue_url":"https://api.github.com/repos/hadley/devtools/issues/903","number":903,"state":"open","locked":false,"title":"Only install from if a different sha from current","user":{"login":"jimhester","id":205275,"avatar_url":"https://avatars.githubusercontent.com/u/205275?v=3","gravatar_id":"","url":"https://api.github.com/users/jimhester","html_url":"https://github.com/jimhester","followers_url":"https://api.github.com/users/jimhester/followers","following_url":"https://api.github.com/users/jimhester/following{/other_user}","gists_url":"https://api.github.com/users/jimhester/gists{/gist_id}","starred_url":"https://api.github.com/users/jimhester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimhester/subscriptions","organizations_url":"https://api.github.com/users/jimhester/orgs","repos_url":"https://api.github.com/users/jimhester/repos","events_url":"https://api.github.com/users/jimhester/events{/privacy}","received_events_url":"https://api.github.com/users/jimhester/received_events","type":"User","site_admin":false},"body":"This modifies the behavior of `install_github` to only download and install a package if the sha has changed from the currently installed version.\r\n\r\nIt needs to do two requests from the GitHub API\r\n\r\n1. To get the sha of the 'ref' commit ('master' by default)\r\n2. To retrieve the package DESCRIPTION (so we can disambiguate if a repository name is different than the package name)\r\n\r\nIt then looks up the existing package DESCRIPTION (which will have a `RemoteSha` if it was previously installed using `install_github()`) and compares it to the GitHub version.\r\n\r\nIf the installed DESCRIPTION does not have a `RemoteSha` or they are different, `install_github` proceeds as normal, otherwise nothing happens.\r\n\r\nThis works well with #902, especially if a given package has a lot of heavy dependencies that take a while to compile.\r\n\r\nA couple of places I wanted input\r\n\r\n1. I named the parameter `skip_same`, but this feels awkward, perhaps there is a better name?\r\n2. Personally I would prefer this was the default behavior so `skip_same = TRUE`, but maybe you would prefer it to default to `FALSE`.\r\n3. If we assume that all packages have the same repository name as the package name we can cut down the number of requests to just the sha.  This is probably valid ~90% or more of the time, but not always.\r\n4. We can probably do analogous things with the other remote types, if you find this beneficial I can make pull requests for them as well.\r\n5. This has no tests yet, I wanted to settle on an implementation before doing so, but I can add them before it is accepted.","created_at":"2015-08-25T21:34:53Z","updated_at":"2015-09-02T16:00:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a2a6d5dc0a8c8720551000a99465cdb8cbc24995","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hadley/devtools/pulls/903/commits","review_comments_url":"https://api.github.com/repos/hadley/devtools/pulls/903/comments","review_comment_url":"https://api.github.com/repos/hadley/devtools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hadley/devtools/issues/903/comments","statuses_url":"https://api.github.com/repos/hadley/devtools/statuses/ba5998b916f9cbcaf3f25309f296ace2bed6f0a1","head":{"label":"jimhester:github_new","ref":"github_new","sha":"ba5998b916f9cbcaf3f25309f296ace2bed6f0a1","user":{"login":"jimhester","id":205275,"avatar_url":"https://avatars.githubusercontent.com/u/205275?v=3","gravatar_id":"","url":"https://api.github.com/users/jimhester","html_url":"https://github.com/jimhester","followers_url":"https://api.github.com/users/jimhester/followers","following_url":"https://api.github.com/users/jimhester/following{/other_user}","gists_url":"https://api.github.com/users/jimhester/gists{/gist_id}","starred_url":"https://api.github.com/users/jimhester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimhester/subscriptions","organizations_url":"https://api.github.com/users/jimhester/orgs","repos_url":"https://api.github.com/users/jimhester/repos","events_url":"https://api.github.com/users/jimhester/events{/privacy}","received_events_url":"https://api.github.com/users/jimhester/received_events","type":"User","site_admin":false},"repo":{"id":25137194,"name":"devtools","full_name":"jimhester/devtools","owner":{"login":"jimhester","id":205275,"avatar_url":"https://avatars.githubusercontent.com/u/205275?v=3","gravatar_id":"","url":"https://api.github.com/users/jimhester","html_url":"https://github.com/jimhester","followers_url":"https://api.github.com/users/jimhester/followers","following_url":"https://api.github.com/users/jimhester/following{/other_user}","gists_url":"https://api.github.com/users/jimhester/gists{/gist_id}","starred_url":"https://api.github.com/users/jimhester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimhester/subscriptions","organizations_url":"https://api.github.com/users/jimhester/orgs","repos_url":"https://api.github.com/users/jimhester/repos","events_url":"https://api.github.com/users/jimhester/events{/privacy}","received_events_url":"https://api.github.com/users/jimhester/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jimhester/devtools","description":"Tools to make an R developer's life easier","fork":true,"url":"https://api.github.com/repos/jimhester/devtools","forks_url":"https://api.github.com/repos/jimhester/devtools/forks","keys_url":"https://api.github.com/repos/jimhester/devtools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jimhester/devtools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jimhester/devtools/teams","hooks_url":"https://api.github.com/repos/jimhester/devtools/hooks","issue_events_url":"https://api.github.com/repos/jimhester/devtools/issues/events{/number}","events_url":"https://api.github.com/repos/jimhester/devtools/events","assignees_url":"https://api.github.com/repos/jimhester/devtools/assignees{/user}","branches_url":"https://api.github.com/repos/jimhester/devtools/branches{/branch}","tags_url":"https://api.github.com/repos/jimhester/devtools/tags","blobs_url":"https://api.github.com/repos/jimhester/devtools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jimhester/devtools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jimhester/devtools/git/refs{/sha}","trees_url":"https://api.github.com/repos/jimhester/devtools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jimhester/devtools/statuses/{sha}","languages_url":"https://api.github.com/repos/jimhester/devtools/languages","stargazers_url":"https://api.github.com/repos/jimhester/devtools/stargazers","contributors_url":"https://api.github.com/repos/jimhester/devtools/contributors","subscribers_url":"https://api.github.com/repos/jimhester/devtools/subscribers","subscription_url":"https://api.github.com/repos/jimhester/devtools/subscription","commits_url":"https://api.github.com/repos/jimhester/devtools/commits{/sha}","git_commits_url":"https://api.github.com/repos/jimhester/devtools/git/commits{/sha}","comments_url":"https://api.github.com/repos/jimhester/devtools/comments{/number}","issue_comment_url":"https://api.github.com/repos/jimhester/devtools/issues/comments{/number}","contents_url":"https://api.github.com/repos/jimhester/devtools/contents/{+path}","compare_url":"https://api.github.com/repos/jimhester/devtools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jimhester/devtools/merges","archive_url":"https://api.github.com/repos/jimhester/devtools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jimhester/devtools/downloads","issues_url":"https://api.github.com/repos/jimhester/devtools/issues{/number}","pulls_url":"https://api.github.com/repos/jimhester/devtools/pulls{/number}","milestones_url":"https://api.github.com/repos/jimhester/devtools/milestones{/number}","notifications_url":"https://api.github.com/repos/jimhester/devtools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jimhester/devtools/labels{/name}","releases_url":"https://api.github.com/repos/jimhester/devtools/releases{/id}","created_at":"2014-10-13T00:56:25Z","updated_at":"2015-01-15T19:20:47Z","pushed_at":"2015-08-31T17:04:30Z","git_url":"git://github.com/jimhester/devtools.git","ssh_url":"git@github.com:jimhester/devtools.git","clone_url":"https://github.com/jimhester/devtools.git","svn_url":"https://github.com/jimhester/devtools","homepage":"","size":3417,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hadley:master","ref":"master","sha":"76ada1dffd4335611adb78b9cf0c233d5127c6a7","user":{"login":"hadley","id":4196,"avatar_url":"https://avatars.githubusercontent.com/u/4196?v=3","gravatar_id":"","url":"https://api.github.com/users/hadley","html_url":"https://github.com/hadley","followers_url":"https://api.github.com/users/hadley/followers","following_url":"https://api.github.com/users/hadley/following{/other_user}","gists_url":"https://api.github.com/users/hadley/gists{/gist_id}","starred_url":"https://api.github.com/users/hadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadley/subscriptions","organizations_url":"https://api.github.com/users/hadley/orgs","repos_url":"https://api.github.com/users/hadley/repos","events_url":"https://api.github.com/users/hadley/events{/privacy}","received_events_url":"https://api.github.com/users/hadley/received_events","type":"User","site_admin":false},"repo":{"id":643909,"name":"devtools","full_name":"hadley/devtools","owner":{"login":"hadley","id":4196,"avatar_url":"https://avatars.githubusercontent.com/u/4196?v=3","gravatar_id":"","url":"https://api.github.com/users/hadley","html_url":"https://github.com/hadley","followers_url":"https://api.github.com/users/hadley/followers","following_url":"https://api.github.com/users/hadley/following{/other_user}","gists_url":"https://api.github.com/users/hadley/gists{/gist_id}","starred_url":"https://api.github.com/users/hadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadley/subscriptions","organizations_url":"https://api.github.com/users/hadley/orgs","repos_url":"https://api.github.com/users/hadley/repos","events_url":"https://api.github.com/users/hadley/events{/privacy}","received_events_url":"https://api.github.com/users/hadley/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hadley/devtools","description":"Tools to make an R developer's life easier","fork":false,"url":"https://api.github.com/repos/hadley/devtools","forks_url":"https://api.github.com/repos/hadley/devtools/forks","keys_url":"https://api.github.com/repos/hadley/devtools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hadley/devtools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hadley/devtools/teams","hooks_url":"https://api.github.com/repos/hadley/devtools/hooks","issue_events_url":"https://api.github.com/repos/hadley/devtools/issues/events{/number}","events_url":"https://api.github.com/repos/hadley/devtools/events","assignees_url":"https://api.github.com/repos/hadley/devtools/assignees{/user}","branches_url":"https://api.github.com/repos/hadley/devtools/branches{/branch}","tags_url":"https://api.github.com/repos/hadley/devtools/tags","blobs_url":"https://api.github.com/repos/hadley/devtools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hadley/devtools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hadley/devtools/git/refs{/sha}","trees_url":"https://api.github.com/repos/hadley/devtools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hadley/devtools/statuses/{sha}","languages_url":"https://api.github.com/repos/hadley/devtools/languages","stargazers_url":"https://api.github.com/repos/hadley/devtools/stargazers","contributors_url":"https://api.github.com/repos/hadley/devtools/contributors","subscribers_url":"https://api.github.com/repos/hadley/devtools/subscribers","subscription_url":"https://api.github.com/repos/hadley/devtools/subscription","commits_url":"https://api.github.com/repos/hadley/devtools/commits{/sha}","git_commits_url":"https://api.github.com/repos/hadley/devtools/git/commits{/sha}","comments_url":"https://api.github.com/repos/hadley/devtools/comments{/number}","issue_comment_url":"https://api.github.com/repos/hadley/devtools/issues/comments{/number}","contents_url":"https://api.github.com/repos/hadley/devtools/contents/{+path}","compare_url":"https://api.github.com/repos/hadley/devtools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hadley/devtools/merges","archive_url":"https://api.github.com/repos/hadley/devtools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hadley/devtools/downloads","issues_url":"https://api.github.com/repos/hadley/devtools/issues{/number}","pulls_url":"https://api.github.com/repos/hadley/devtools/pulls{/number}","milestones_url":"https://api.github.com/repos/hadley/devtools/milestones{/number}","notifications_url":"https://api.github.com/repos/hadley/devtools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hadley/devtools/labels{/name}","releases_url":"https://api.github.com/repos/hadley/devtools/releases{/id}","created_at":"2010-05-03T04:08:49Z","updated_at":"2015-09-01T18:09:32Z","pushed_at":"2015-09-02T15:56:03Z","git_url":"git://github.com/hadley/devtools.git","ssh_url":"git@github.com:hadley/devtools.git","clone_url":"https://github.com/hadley/devtools.git","svn_url":"https://github.com/hadley/devtools","homepage":"","size":8979,"stargazers_count":1092,"watchers_count":1092,"language":"R","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":327,"mirror_url":null,"open_issues_count":51,"forks":327,"open_issues":51,"watchers":1092,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hadley/devtools/pulls/903"},"html":{"href":"https://github.com/hadley/devtools/pull/903"},"issue":{"href":"https://api.github.com/repos/hadley/devtools/issues/903"},"comments":{"href":"https://api.github.com/repos/hadley/devtools/issues/903/comments"},"review_comments":{"href":"https://api.github.com/repos/hadley/devtools/pulls/903/comments"},"review_comment":{"href":"https://api.github.com/repos/hadley/devtools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hadley/devtools/pulls/903/commits"},"statuses":{"href":"https://api.github.com/repos/hadley/devtools/statuses/ba5998b916f9cbcaf3f25309f296ace2bed6f0a1"}}}}