{"action":"created","comment":{"url":"https://api.github.com/repos/prestodb/presto-admin/pulls/comments/73893073","id":73893073,"diff_hunk":"@@ -0,0 +1,440 @@\n+import json\n+import os\n+import re\n+import subprocess\n+\n+try:\n+    from setuptools import Command\n+except ImportError:\n+    from distutils.core import Command\n+\n+REPOSITORY_API = 'https://api.github.com/repos/zachyee/presto-admin'\n+CURRENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))\n+RELEASE_LIST_DOC_PATH = os.path.join(CURRENT_DIRECTORY, 'docs/release.rst')\n+RELEASE_DOCS_DIRECTORY = os.path.join(CURRENT_DIRECTORY, 'docs/release/')\n+\n+\n+class release(Command):\n+    description = 'create source release to github and/or pypi'\n+\n+    user_options = [('github', None,\n+                     'boolean flag indicating if a release should be created for github'),\n+                    ('pypi', None,\n+                     'boolean flag indicating if a release should be created for pypi'),\n+                    ('all', None,\n+                     'boolean flag indicating if a release should be created for github and pypi')]\n+\n+    @staticmethod\n+    def get_latest_release():\n+        latest_release = subprocess.check_output(['curl', '--silent', REPOSITORY_API + '/releases/latest'])\n+        return json.loads(latest_release)\n+\n+    @staticmethod\n+    def get_remote_branches():\n+        branches = subprocess.check_output(['curl', '--silent', REPOSITORY_API + '/branches'])\n+        return json.loads(branches)\n+\n+    @staticmethod\n+    def check_branch_remote_exists(local_branch):\n+        for remote_branch in release.get_remote_branches():\n+            if local_branch == remote_branch['name']:\n+                print 'Local branch %s exists remotely' % local_branch\n+                return\n+        exit('Local branch %s does not exist remotely.' % local_branch)\n+\n+    @staticmethod\n+    def check_branch_up_to_date(local_branch):\n+        status = subprocess.check_output(['git', 'status'])","path":"release.py","position":47,"original_position":47,"commit_id":"53a3b9b2a5edc1d0ab2209258056ebe493c15c93","original_commit_id":"53a3b9b2a5edc1d0ab2209258056ebe493c15c93","user":{"login":"ebd2","id":12751788,"avatar_url":"https://avatars.githubusercontent.com/u/12751788?v=3","gravatar_id":"","url":"https://api.github.com/users/ebd2","html_url":"https://github.com/ebd2","followers_url":"https://api.github.com/users/ebd2/followers","following_url":"https://api.github.com/users/ebd2/following{/other_user}","gists_url":"https://api.github.com/users/ebd2/gists{/gist_id}","starred_url":"https://api.github.com/users/ebd2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebd2/subscriptions","organizations_url":"https://api.github.com/users/ebd2/orgs","repos_url":"https://api.github.com/users/ebd2/repos","events_url":"https://api.github.com/users/ebd2/events{/privacy}","received_events_url":"https://api.github.com/users/ebd2/received_events","type":"User","site_admin":false},"body":"Same question but for the git module","created_at":"2016-08-08T15:11:16Z","updated_at":"2016-08-08T15:11:16Z","html_url":"https://github.com/prestodb/presto-admin/pull/218#discussion_r73893073","pull_request_url":"https://api.github.com/repos/prestodb/presto-admin/pulls/218","_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto-admin/pulls/comments/73893073"},"html":{"href":"https://github.com/prestodb/presto-admin/pull/218#discussion_r73893073"},"pull_request":{"href":"https://api.github.com/repos/prestodb/presto-admin/pulls/218"}}},"pull_request":{"url":"https://api.github.com/repos/prestodb/presto-admin/pulls/218","id":79821509,"html_url":"https://github.com/prestodb/presto-admin/pull/218","diff_url":"https://github.com/prestodb/presto-admin/pull/218.diff","patch_url":"https://github.com/prestodb/presto-admin/pull/218.patch","issue_url":"https://api.github.com/repos/prestodb/presto-admin/issues/218","number":218,"state":"open","locked":false,"title":"Add release command to setup.py","user":{"login":"zachyee","id":7135060,"avatar_url":"https://avatars.githubusercontent.com/u/7135060?v=3","gravatar_id":"","url":"https://api.github.com/users/zachyee","html_url":"https://github.com/zachyee","followers_url":"https://api.github.com/users/zachyee/followers","following_url":"https://api.github.com/users/zachyee/following{/other_user}","gists_url":"https://api.github.com/users/zachyee/gists{/gist_id}","starred_url":"https://api.github.com/users/zachyee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zachyee/subscriptions","organizations_url":"https://api.github.com/users/zachyee/orgs","repos_url":"https://api.github.com/users/zachyee/repos","events_url":"https://api.github.com/users/zachyee/events{/privacy}","received_events_url":"https://api.github.com/users/zachyee/received_events","type":"User","site_admin":false},"body":"In order to automate releasing to github and pypi\r\n\r\nCurrently uses basic authentication (username/password) to release to github. An alternative would be to use OAuth tokens: https://developer.github.com/v3/oauth/\r\n\r\nIt also currently can only release to pypitest, but adding pypi to `.pypirc` will allow it to release to pypi.\r\nIt uploads a source distribution (default for unix is .tar.gz).","created_at":"2016-08-02T22:41:02Z","updated_at":"2016-08-08T15:11:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b88d8cfb4a83821f8bbc2a3c8eb82c0666608fef","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/prestodb/presto-admin/pulls/218/commits","review_comments_url":"https://api.github.com/repos/prestodb/presto-admin/pulls/218/comments","review_comment_url":"https://api.github.com/repos/prestodb/presto-admin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prestodb/presto-admin/issues/218/comments","statuses_url":"https://api.github.com/repos/prestodb/presto-admin/statuses/53a3b9b2a5edc1d0ab2209258056ebe493c15c93","head":{"label":"zachyee:master","ref":"master","sha":"53a3b9b2a5edc1d0ab2209258056ebe493c15c93","user":{"login":"zachyee","id":7135060,"avatar_url":"https://avatars.githubusercontent.com/u/7135060?v=3","gravatar_id":"","url":"https://api.github.com/users/zachyee","html_url":"https://github.com/zachyee","followers_url":"https://api.github.com/users/zachyee/followers","following_url":"https://api.github.com/users/zachyee/following{/other_user}","gists_url":"https://api.github.com/users/zachyee/gists{/gist_id}","starred_url":"https://api.github.com/users/zachyee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zachyee/subscriptions","organizations_url":"https://api.github.com/users/zachyee/orgs","repos_url":"https://api.github.com/users/zachyee/repos","events_url":"https://api.github.com/users/zachyee/events{/privacy}","received_events_url":"https://api.github.com/users/zachyee/received_events","type":"User","site_admin":false},"repo":{"id":63806079,"name":"presto-admin","full_name":"zachyee/presto-admin","owner":{"login":"zachyee","id":7135060,"avatar_url":"https://avatars.githubusercontent.com/u/7135060?v=3","gravatar_id":"","url":"https://api.github.com/users/zachyee","html_url":"https://github.com/zachyee","followers_url":"https://api.github.com/users/zachyee/followers","following_url":"https://api.github.com/users/zachyee/following{/other_user}","gists_url":"https://api.github.com/users/zachyee/gists{/gist_id}","starred_url":"https://api.github.com/users/zachyee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zachyee/subscriptions","organizations_url":"https://api.github.com/users/zachyee/orgs","repos_url":"https://api.github.com/users/zachyee/repos","events_url":"https://api.github.com/users/zachyee/events{/privacy}","received_events_url":"https://api.github.com/users/zachyee/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zachyee/presto-admin","description":"A tool to install, configure and manage Presto installations","fork":true,"url":"https://api.github.com/repos/zachyee/presto-admin","forks_url":"https://api.github.com/repos/zachyee/presto-admin/forks","keys_url":"https://api.github.com/repos/zachyee/presto-admin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zachyee/presto-admin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zachyee/presto-admin/teams","hooks_url":"https://api.github.com/repos/zachyee/presto-admin/hooks","issue_events_url":"https://api.github.com/repos/zachyee/presto-admin/issues/events{/number}","events_url":"https://api.github.com/repos/zachyee/presto-admin/events","assignees_url":"https://api.github.com/repos/zachyee/presto-admin/assignees{/user}","branches_url":"https://api.github.com/repos/zachyee/presto-admin/branches{/branch}","tags_url":"https://api.github.com/repos/zachyee/presto-admin/tags","blobs_url":"https://api.github.com/repos/zachyee/presto-admin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zachyee/presto-admin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zachyee/presto-admin/git/refs{/sha}","trees_url":"https://api.github.com/repos/zachyee/presto-admin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zachyee/presto-admin/statuses/{sha}","languages_url":"https://api.github.com/repos/zachyee/presto-admin/languages","stargazers_url":"https://api.github.com/repos/zachyee/presto-admin/stargazers","contributors_url":"https://api.github.com/repos/zachyee/presto-admin/contributors","subscribers_url":"https://api.github.com/repos/zachyee/presto-admin/subscribers","subscription_url":"https://api.github.com/repos/zachyee/presto-admin/subscription","commits_url":"https://api.github.com/repos/zachyee/presto-admin/commits{/sha}","git_commits_url":"https://api.github.com/repos/zachyee/presto-admin/git/commits{/sha}","comments_url":"https://api.github.com/repos/zachyee/presto-admin/comments{/number}","issue_comment_url":"https://api.github.com/repos/zachyee/presto-admin/issues/comments{/number}","contents_url":"https://api.github.com/repos/zachyee/presto-admin/contents/{+path}","compare_url":"https://api.github.com/repos/zachyee/presto-admin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zachyee/presto-admin/merges","archive_url":"https://api.github.com/repos/zachyee/presto-admin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zachyee/presto-admin/downloads","issues_url":"https://api.github.com/repos/zachyee/presto-admin/issues{/number}","pulls_url":"https://api.github.com/repos/zachyee/presto-admin/pulls{/number}","milestones_url":"https://api.github.com/repos/zachyee/presto-admin/milestones{/number}","notifications_url":"https://api.github.com/repos/zachyee/presto-admin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zachyee/presto-admin/labels{/name}","releases_url":"https://api.github.com/repos/zachyee/presto-admin/releases{/id}","deployments_url":"https://api.github.com/repos/zachyee/presto-admin/deployments","created_at":"2016-07-20T18:50:18Z","updated_at":"2016-07-20T18:50:19Z","pushed_at":"2016-08-05T23:39:00Z","git_url":"git://github.com/zachyee/presto-admin.git","ssh_url":"git@github.com:zachyee/presto-admin.git","clone_url":"https://github.com/zachyee/presto-admin.git","svn_url":"https://github.com/zachyee/presto-admin","homepage":"http://prestodb.github.io/presto-admin/","size":39701,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"prestodb:master","ref":"master","sha":"458b004014d4b6bffab342e33fa9f7e31d520400","user":{"login":"prestodb","id":6882181,"avatar_url":"https://avatars.githubusercontent.com/u/6882181?v=3","gravatar_id":"","url":"https://api.github.com/users/prestodb","html_url":"https://github.com/prestodb","followers_url":"https://api.github.com/users/prestodb/followers","following_url":"https://api.github.com/users/prestodb/following{/other_user}","gists_url":"https://api.github.com/users/prestodb/gists{/gist_id}","starred_url":"https://api.github.com/users/prestodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prestodb/subscriptions","organizations_url":"https://api.github.com/users/prestodb/orgs","repos_url":"https://api.github.com/users/prestodb/repos","events_url":"https://api.github.com/users/prestodb/events{/privacy}","received_events_url":"https://api.github.com/users/prestodb/received_events","type":"Organization","site_admin":false},"repo":{"id":36050721,"name":"presto-admin","full_name":"prestodb/presto-admin","owner":{"login":"prestodb","id":6882181,"avatar_url":"https://avatars.githubusercontent.com/u/6882181?v=3","gravatar_id":"","url":"https://api.github.com/users/prestodb","html_url":"https://github.com/prestodb","followers_url":"https://api.github.com/users/prestodb/followers","following_url":"https://api.github.com/users/prestodb/following{/other_user}","gists_url":"https://api.github.com/users/prestodb/gists{/gist_id}","starred_url":"https://api.github.com/users/prestodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prestodb/subscriptions","organizations_url":"https://api.github.com/users/prestodb/orgs","repos_url":"https://api.github.com/users/prestodb/repos","events_url":"https://api.github.com/users/prestodb/events{/privacy}","received_events_url":"https://api.github.com/users/prestodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prestodb/presto-admin","description":"A tool to install, configure and manage Presto installations","fork":false,"url":"https://api.github.com/repos/prestodb/presto-admin","forks_url":"https://api.github.com/repos/prestodb/presto-admin/forks","keys_url":"https://api.github.com/repos/prestodb/presto-admin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prestodb/presto-admin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prestodb/presto-admin/teams","hooks_url":"https://api.github.com/repos/prestodb/presto-admin/hooks","issue_events_url":"https://api.github.com/repos/prestodb/presto-admin/issues/events{/number}","events_url":"https://api.github.com/repos/prestodb/presto-admin/events","assignees_url":"https://api.github.com/repos/prestodb/presto-admin/assignees{/user}","branches_url":"https://api.github.com/repos/prestodb/presto-admin/branches{/branch}","tags_url":"https://api.github.com/repos/prestodb/presto-admin/tags","blobs_url":"https://api.github.com/repos/prestodb/presto-admin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prestodb/presto-admin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prestodb/presto-admin/git/refs{/sha}","trees_url":"https://api.github.com/repos/prestodb/presto-admin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prestodb/presto-admin/statuses/{sha}","languages_url":"https://api.github.com/repos/prestodb/presto-admin/languages","stargazers_url":"https://api.github.com/repos/prestodb/presto-admin/stargazers","contributors_url":"https://api.github.com/repos/prestodb/presto-admin/contributors","subscribers_url":"https://api.github.com/repos/prestodb/presto-admin/subscribers","subscription_url":"https://api.github.com/repos/prestodb/presto-admin/subscription","commits_url":"https://api.github.com/repos/prestodb/presto-admin/commits{/sha}","git_commits_url":"https://api.github.com/repos/prestodb/presto-admin/git/commits{/sha}","comments_url":"https://api.github.com/repos/prestodb/presto-admin/comments{/number}","issue_comment_url":"https://api.github.com/repos/prestodb/presto-admin/issues/comments{/number}","contents_url":"https://api.github.com/repos/prestodb/presto-admin/contents/{+path}","compare_url":"https://api.github.com/repos/prestodb/presto-admin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prestodb/presto-admin/merges","archive_url":"https://api.github.com/repos/prestodb/presto-admin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prestodb/presto-admin/downloads","issues_url":"https://api.github.com/repos/prestodb/presto-admin/issues{/number}","pulls_url":"https://api.github.com/repos/prestodb/presto-admin/pulls{/number}","milestones_url":"https://api.github.com/repos/prestodb/presto-admin/milestones{/number}","notifications_url":"https://api.github.com/repos/prestodb/presto-admin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prestodb/presto-admin/labels{/name}","releases_url":"https://api.github.com/repos/prestodb/presto-admin/releases{/id}","deployments_url":"https://api.github.com/repos/prestodb/presto-admin/deployments","created_at":"2015-05-22T03:40:42Z","updated_at":"2016-07-29T11:29:52Z","pushed_at":"2016-08-05T23:39:00Z","git_url":"git://github.com/prestodb/presto-admin.git","ssh_url":"git@github.com:prestodb/presto-admin.git","clone_url":"https://github.com/prestodb/presto-admin.git","svn_url":"https://github.com/prestodb/presto-admin","homepage":"http://prestodb.github.io/presto-admin/","size":39808,"stargazers_count":49,"watchers_count":49,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":17,"mirror_url":null,"open_issues_count":23,"forks":17,"open_issues":23,"watchers":49,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto-admin/pulls/218"},"html":{"href":"https://github.com/prestodb/presto-admin/pull/218"},"issue":{"href":"https://api.github.com/repos/prestodb/presto-admin/issues/218"},"comments":{"href":"https://api.github.com/repos/prestodb/presto-admin/issues/218/comments"},"review_comments":{"href":"https://api.github.com/repos/prestodb/presto-admin/pulls/218/comments"},"review_comment":{"href":"https://api.github.com/repos/prestodb/presto-admin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prestodb/presto-admin/pulls/218/commits"},"statuses":{"href":"https://api.github.com/repos/prestodb/presto-admin/statuses/53a3b9b2a5edc1d0ab2209258056ebe493c15c93"}}}}
{"actor":{"display_login":"ebd2"}}