{"action":"created","comment":{"url":"https://api.github.com/repos/git-cola/git-cola/pulls/comments/60825225","id":60825225,"diff_hunk":"@@ -111,6 +111,12 @@ def reset_branch_head(self):\n     def reset_worktree(self):\n         self.with_oid(lambda oid: cmds.do(cmds.ResetWorktree, ref=oid))\n \n+    def reset_to_commit(self, reset_type):\n+        sha1 = self.selected_sha1()\n+        if sha1 is None:\n+            return\n+        cmds.do(cmds.ResetToCommit, reset_type=reset_type, ref=sha1)","path":"cola/widgets/dag.py","position":8,"original_position":8,"commit_id":"759284c3f8aa592ba20cd7e54eb0c3ab8f04edb0","original_commit_id":"759284c3f8aa592ba20cd7e54eb0c3ab8f04edb0","user":{"login":"davvid","id":13196,"avatar_url":"https://avatars.githubusercontent.com/u/13196?v=3","gravatar_id":"","url":"https://api.github.com/users/davvid","html_url":"https://github.com/davvid","followers_url":"https://api.github.com/users/davvid/followers","following_url":"https://api.github.com/users/davvid/following{/other_user}","gists_url":"https://api.github.com/users/davvid/gists{/gist_id}","starred_url":"https://api.github.com/users/davvid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davvid/subscriptions","organizations_url":"https://api.github.com/users/davvid/orgs","repos_url":"https://api.github.com/users/davvid/repos","events_url":"https://api.github.com/users/davvid/events{/privacy}","received_events_url":"https://api.github.com/users/davvid/received_events","type":"User","site_admin":false},"body":"The constructor requires these two arguments (they don't have default values) so it probably makes sense to reorder these and pass them as `cmds.do(cmds.ResetToCommit, sha1, reset_type)`\r\n\r\nAlso, the logic is pretty similar to the other \"needs an object id\" actions here, so it probably makes sense to reuse the `if sha1 is None` logic in the `with_oid()` helper.\r\n\r\n```python\r\nself.with_oid(lambda  oid: cmds.do(cmds.ResetToCommit, oid, reset_type))\r\n```","created_at":"2016-04-23T08:29:21Z","updated_at":"2016-04-23T08:29:21Z","html_url":"https://github.com/git-cola/git-cola/pull/567#discussion_r60825225","pull_request_url":"https://api.github.com/repos/git-cola/git-cola/pulls/567","_links":{"self":{"href":"https://api.github.com/repos/git-cola/git-cola/pulls/comments/60825225"},"html":{"href":"https://github.com/git-cola/git-cola/pull/567#discussion_r60825225"},"pull_request":{"href":"https://api.github.com/repos/git-cola/git-cola/pulls/567"}}},"pull_request":{"url":"https://api.github.com/repos/git-cola/git-cola/pulls/567","id":67188439,"html_url":"https://github.com/git-cola/git-cola/pull/567","diff_url":"https://github.com/git-cola/git-cola/pull/567.diff","patch_url":"https://github.com/git-cola/git-cola/pull/567.patch","issue_url":"https://api.github.com/repos/git-cola/git-cola/issues/567","number":567,"state":"open","locked":false,"title":"dag: add menu to reset to commit","user":{"login":"AndiDog","id":1376043,"avatar_url":"https://avatars.githubusercontent.com/u/1376043?v=3","gravatar_id":"","url":"https://api.github.com/users/AndiDog","html_url":"https://github.com/AndiDog","followers_url":"https://api.github.com/users/AndiDog/followers","following_url":"https://api.github.com/users/AndiDog/following{/other_user}","gists_url":"https://api.github.com/users/AndiDog/gists{/gist_id}","starred_url":"https://api.github.com/users/AndiDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndiDog/subscriptions","organizations_url":"https://api.github.com/users/AndiDog/orgs","repos_url":"https://api.github.com/users/AndiDog/repos","events_url":"https://api.github.com/users/AndiDog/events{/privacy}","received_events_url":"https://api.github.com/users/AndiDog/received_events","type":"User","site_admin":false},"body":"Add menu for reset (soft, mixed, hard)","created_at":"2016-04-20T13:41:05Z","updated_at":"2016-04-23T08:29:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3167f6d2991f5f7f5a5b5f70d7e559a235c1ef86","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/git-cola/git-cola/pulls/567/commits","review_comments_url":"https://api.github.com/repos/git-cola/git-cola/pulls/567/comments","review_comment_url":"https://api.github.com/repos/git-cola/git-cola/pulls/comments{/number}","comments_url":"https://api.github.com/repos/git-cola/git-cola/issues/567/comments","statuses_url":"https://api.github.com/repos/git-cola/git-cola/statuses/759284c3f8aa592ba20cd7e54eb0c3ab8f04edb0","head":{"label":"AndiDog:feature/dag-reset-menu","ref":"feature/dag-reset-menu","sha":"759284c3f8aa592ba20cd7e54eb0c3ab8f04edb0","user":{"login":"AndiDog","id":1376043,"avatar_url":"https://avatars.githubusercontent.com/u/1376043?v=3","gravatar_id":"","url":"https://api.github.com/users/AndiDog","html_url":"https://github.com/AndiDog","followers_url":"https://api.github.com/users/AndiDog/followers","following_url":"https://api.github.com/users/AndiDog/following{/other_user}","gists_url":"https://api.github.com/users/AndiDog/gists{/gist_id}","starred_url":"https://api.github.com/users/AndiDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndiDog/subscriptions","organizations_url":"https://api.github.com/users/AndiDog/orgs","repos_url":"https://api.github.com/users/AndiDog/repos","events_url":"https://api.github.com/users/AndiDog/events{/privacy}","received_events_url":"https://api.github.com/users/AndiDog/received_events","type":"User","site_admin":false},"repo":{"id":39020693,"name":"git-cola","full_name":"AndiDog/git-cola","owner":{"login":"AndiDog","id":1376043,"avatar_url":"https://avatars.githubusercontent.com/u/1376043?v=3","gravatar_id":"","url":"https://api.github.com/users/AndiDog","html_url":"https://github.com/AndiDog","followers_url":"https://api.github.com/users/AndiDog/followers","following_url":"https://api.github.com/users/AndiDog/following{/other_user}","gists_url":"https://api.github.com/users/AndiDog/gists{/gist_id}","starred_url":"https://api.github.com/users/AndiDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndiDog/subscriptions","organizations_url":"https://api.github.com/users/AndiDog/orgs","repos_url":"https://api.github.com/users/AndiDog/repos","events_url":"https://api.github.com/users/AndiDog/events{/privacy}","received_events_url":"https://api.github.com/users/AndiDog/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AndiDog/git-cola","description":"git-cola: The highly caffeinated Git GUI","fork":true,"url":"https://api.github.com/repos/AndiDog/git-cola","forks_url":"https://api.github.com/repos/AndiDog/git-cola/forks","keys_url":"https://api.github.com/repos/AndiDog/git-cola/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AndiDog/git-cola/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AndiDog/git-cola/teams","hooks_url":"https://api.github.com/repos/AndiDog/git-cola/hooks","issue_events_url":"https://api.github.com/repos/AndiDog/git-cola/issues/events{/number}","events_url":"https://api.github.com/repos/AndiDog/git-cola/events","assignees_url":"https://api.github.com/repos/AndiDog/git-cola/assignees{/user}","branches_url":"https://api.github.com/repos/AndiDog/git-cola/branches{/branch}","tags_url":"https://api.github.com/repos/AndiDog/git-cola/tags","blobs_url":"https://api.github.com/repos/AndiDog/git-cola/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AndiDog/git-cola/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AndiDog/git-cola/git/refs{/sha}","trees_url":"https://api.github.com/repos/AndiDog/git-cola/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AndiDog/git-cola/statuses/{sha}","languages_url":"https://api.github.com/repos/AndiDog/git-cola/languages","stargazers_url":"https://api.github.com/repos/AndiDog/git-cola/stargazers","contributors_url":"https://api.github.com/repos/AndiDog/git-cola/contributors","subscribers_url":"https://api.github.com/repos/AndiDog/git-cola/subscribers","subscription_url":"https://api.github.com/repos/AndiDog/git-cola/subscription","commits_url":"https://api.github.com/repos/AndiDog/git-cola/commits{/sha}","git_commits_url":"https://api.github.com/repos/AndiDog/git-cola/git/commits{/sha}","comments_url":"https://api.github.com/repos/AndiDog/git-cola/comments{/number}","issue_comment_url":"https://api.github.com/repos/AndiDog/git-cola/issues/comments{/number}","contents_url":"https://api.github.com/repos/AndiDog/git-cola/contents/{+path}","compare_url":"https://api.github.com/repos/AndiDog/git-cola/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AndiDog/git-cola/merges","archive_url":"https://api.github.com/repos/AndiDog/git-cola/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AndiDog/git-cola/downloads","issues_url":"https://api.github.com/repos/AndiDog/git-cola/issues{/number}","pulls_url":"https://api.github.com/repos/AndiDog/git-cola/pulls{/number}","milestones_url":"https://api.github.com/repos/AndiDog/git-cola/milestones{/number}","notifications_url":"https://api.github.com/repos/AndiDog/git-cola/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AndiDog/git-cola/labels{/name}","releases_url":"https://api.github.com/repos/AndiDog/git-cola/releases{/id}","deployments_url":"https://api.github.com/repos/AndiDog/git-cola/deployments","created_at":"2015-07-13T15:31:07Z","updated_at":"2016-01-12T13:27:46Z","pushed_at":"2016-04-20T13:40:50Z","git_url":"git://github.com/AndiDog/git-cola.git","ssh_url":"git@github.com:AndiDog/git-cola.git","clone_url":"https://github.com/AndiDog/git-cola.git","svn_url":"https://github.com/AndiDog/git-cola","homepage":"https://git-cola.github.io/","size":13534,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"git-cola:master","ref":"master","sha":"4c8075c90bbf930626d99d9941617e6f34de334e","user":{"login":"git-cola","id":1091817,"avatar_url":"https://avatars.githubusercontent.com/u/1091817?v=3","gravatar_id":"","url":"https://api.github.com/users/git-cola","html_url":"https://github.com/git-cola","followers_url":"https://api.github.com/users/git-cola/followers","following_url":"https://api.github.com/users/git-cola/following{/other_user}","gists_url":"https://api.github.com/users/git-cola/gists{/gist_id}","starred_url":"https://api.github.com/users/git-cola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/git-cola/subscriptions","organizations_url":"https://api.github.com/users/git-cola/orgs","repos_url":"https://api.github.com/users/git-cola/repos","events_url":"https://api.github.com/users/git-cola/events{/privacy}","received_events_url":"https://api.github.com/users/git-cola/received_events","type":"Organization","site_admin":false},"repo":{"id":23916,"name":"git-cola","full_name":"git-cola/git-cola","owner":{"login":"git-cola","id":1091817,"avatar_url":"https://avatars.githubusercontent.com/u/1091817?v=3","gravatar_id":"","url":"https://api.github.com/users/git-cola","html_url":"https://github.com/git-cola","followers_url":"https://api.github.com/users/git-cola/followers","following_url":"https://api.github.com/users/git-cola/following{/other_user}","gists_url":"https://api.github.com/users/git-cola/gists{/gist_id}","starred_url":"https://api.github.com/users/git-cola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/git-cola/subscriptions","organizations_url":"https://api.github.com/users/git-cola/orgs","repos_url":"https://api.github.com/users/git-cola/repos","events_url":"https://api.github.com/users/git-cola/events{/privacy}","received_events_url":"https://api.github.com/users/git-cola/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/git-cola/git-cola","description":"git-cola: The highly caffeinated Git GUI","fork":false,"url":"https://api.github.com/repos/git-cola/git-cola","forks_url":"https://api.github.com/repos/git-cola/git-cola/forks","keys_url":"https://api.github.com/repos/git-cola/git-cola/keys{/key_id}","collaborators_url":"https://api.github.com/repos/git-cola/git-cola/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/git-cola/git-cola/teams","hooks_url":"https://api.github.com/repos/git-cola/git-cola/hooks","issue_events_url":"https://api.github.com/repos/git-cola/git-cola/issues/events{/number}","events_url":"https://api.github.com/repos/git-cola/git-cola/events","assignees_url":"https://api.github.com/repos/git-cola/git-cola/assignees{/user}","branches_url":"https://api.github.com/repos/git-cola/git-cola/branches{/branch}","tags_url":"https://api.github.com/repos/git-cola/git-cola/tags","blobs_url":"https://api.github.com/repos/git-cola/git-cola/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/git-cola/git-cola/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/git-cola/git-cola/git/refs{/sha}","trees_url":"https://api.github.com/repos/git-cola/git-cola/git/trees{/sha}","statuses_url":"https://api.github.com/repos/git-cola/git-cola/statuses/{sha}","languages_url":"https://api.github.com/repos/git-cola/git-cola/languages","stargazers_url":"https://api.github.com/repos/git-cola/git-cola/stargazers","contributors_url":"https://api.github.com/repos/git-cola/git-cola/contributors","subscribers_url":"https://api.github.com/repos/git-cola/git-cola/subscribers","subscription_url":"https://api.github.com/repos/git-cola/git-cola/subscription","commits_url":"https://api.github.com/repos/git-cola/git-cola/commits{/sha}","git_commits_url":"https://api.github.com/repos/git-cola/git-cola/git/commits{/sha}","comments_url":"https://api.github.com/repos/git-cola/git-cola/comments{/number}","issue_comment_url":"https://api.github.com/repos/git-cola/git-cola/issues/comments{/number}","contents_url":"https://api.github.com/repos/git-cola/git-cola/contents/{+path}","compare_url":"https://api.github.com/repos/git-cola/git-cola/compare/{base}...{head}","merges_url":"https://api.github.com/repos/git-cola/git-cola/merges","archive_url":"https://api.github.com/repos/git-cola/git-cola/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/git-cola/git-cola/downloads","issues_url":"https://api.github.com/repos/git-cola/git-cola/issues{/number}","pulls_url":"https://api.github.com/repos/git-cola/git-cola/pulls{/number}","milestones_url":"https://api.github.com/repos/git-cola/git-cola/milestones{/number}","notifications_url":"https://api.github.com/repos/git-cola/git-cola/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/git-cola/git-cola/labels{/name}","releases_url":"https://api.github.com/repos/git-cola/git-cola/releases{/id}","deployments_url":"https://api.github.com/repos/git-cola/git-cola/deployments","created_at":"2008-06-10T09:26:14Z","updated_at":"2016-04-22T05:36:05Z","pushed_at":"2016-04-20T13:41:05Z","git_url":"git://github.com/git-cola/git-cola.git","ssh_url":"git@github.com:git-cola/git-cola.git","clone_url":"https://github.com/git-cola/git-cola.git","svn_url":"https://github.com/git-cola/git-cola","homepage":"https://git-cola.github.io/","size":13797,"stargazers_count":787,"watchers_count":787,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":218,"mirror_url":null,"open_issues_count":65,"forks":218,"open_issues":65,"watchers":787,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/git-cola/git-cola/pulls/567"},"html":{"href":"https://github.com/git-cola/git-cola/pull/567"},"issue":{"href":"https://api.github.com/repos/git-cola/git-cola/issues/567"},"comments":{"href":"https://api.github.com/repos/git-cola/git-cola/issues/567/comments"},"review_comments":{"href":"https://api.github.com/repos/git-cola/git-cola/pulls/567/comments"},"review_comment":{"href":"https://api.github.com/repos/git-cola/git-cola/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/git-cola/git-cola/pulls/567/commits"},"statuses":{"href":"https://api.github.com/repos/git-cola/git-cola/statuses/759284c3f8aa592ba20cd7e54eb0c3ab8f04edb0"}}}}