{"action":"created","comment":{"url":"https://api.github.com/repos/edx/tubular/pulls/comments/93507493","pull_request_review_id":14036911,"id":93507493,"diff_hunk":"@@ -0,0 +1,129 @@\n+\"\"\"\n+Command-line script to create a release candidate for an application\n+\"\"\"\n+from __future__ import unicode_literals\n+\n+from os import path\n+import sys\n+import logging\n+import click\n+import yaml\n+\n+# Add top-level module path to sys.path before importing tubular code.\n+sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))\n+\n+from tubular.release import GitRelease, NoValidCommitsError  # pylint: disable=wrong-import-position\n+from github.GithubException import GithubException  # pylint: disable=wrong-import-position\n+\n+logging.basicConfig(stream=sys.stdout, level=logging.INFO)\n+LOG = logging.getLogger(__name__)\n+\n+\n+@click.command()\n+@click.option(\n+    '--org',\n+    help='Org from the GitHub repository URL of https://github.com/<org>/<repo>',\n+    default='edx'\n+)\n+@click.option(\n+    '--repo',\n+    help='Repo name from the GitHub repository URL of https://github.com/<org>/<repo>'\n+)\n+@click.option(\n+    '--source_branch',\n+    help='Source branch whose HEAD is used to create the target branch',\n+    default='master'\n+)\n+@click.option(\n+    '--target_branch',\n+    help='Name of the branch to be created',\n+    default='release-candidate'\n+)\n+@click.option(\n+    '--token',\n+    envvar='GIT_TOKEN',\n+    help='The github access token, see https://help.github.com/articles/creating-an-access-token-for-command-line-use/'\n+)\n+@click.option(\n+    '--output_file',\n+    help=\"File in which to write the script's YAML output\",\n+    default='target/pull_request.yml'\n+)\n+def create_release_candidate(org,\n+                             repo,\n+                             source_branch,\n+                             target_branch,\n+                             token,\n+                             output_file):\n+    \"\"\"\n+    Creates a target \"release-candidate\" branch\n+\n+    Args:\n+        org (str):\n+        repo (str):\n+        source_branch (str):\n+        target_branch (str):\n+        token (str):\n+        output_file (str):\n+\n+    Outputs a yaml file with information about the newly created branch.\n+    e.g.\n+     ---\n+    repo_name: edx-platform\n+    org_name: edx\n+    source_branch_name: master\n+    target_branch_name: release-candidate\n+    sha: af538da6b229cf1dfa33d0171e75fbff6de4c283\n+    \"\"\"\n+    LOG.info(\"Getting GitHub token...\")\n+    github_api = GitRelease(org, repo, token)\n+\n+    LOG.info(\"Fetching commits...\")\n+    try:\n+        commit = github_api.most_recent_good_commit(source_branch)\n+        commit_hash = commit.sha\n+        commit_message = GitRelease.extract_message_summary(commit.commit.message)\n+\n+    except NoValidCommitsError:\n+        LOG.error(\n+            \"Couldn't find a recent commit without test failures. Aborting\"\n+        )\n+        raise\n+\n+    LOG.info(\n+        \"Branching {rc} off {sha}. ({msg})\".format(\n+            rc=target_branch,\n+            sha=commit_hash,\n+            msg=commit_message\n+        )\n+    )\n+    try:\n+        github_api.delete_branch(target_branch)\n+    except GithubException:\n+        LOG.error(\"Unable to delete branch {branch_name}. \" +\n+                  \"Will attempt to recreate\"","path":"scripts/cut_branch.py","position":104,"original_position":104,"commit_id":"b28feadf39a346bbe3e05abd9748a587ead0daf5","original_commit_id":"b28feadf39a346bbe3e05abd9748a587ead0daf5","user":{"login":"macdiesel","id":67862,"avatar_url":"https://avatars.githubusercontent.com/u/67862?v=3","gravatar_id":"","url":"https://api.github.com/users/macdiesel","html_url":"https://github.com/macdiesel","followers_url":"https://api.github.com/users/macdiesel/followers","following_url":"https://api.github.com/users/macdiesel/following{/other_user}","gists_url":"https://api.github.com/users/macdiesel/gists{/gist_id}","starred_url":"https://api.github.com/users/macdiesel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macdiesel/subscriptions","organizations_url":"https://api.github.com/users/macdiesel/orgs","repos_url":"https://api.github.com/users/macdiesel/repos","events_url":"https://api.github.com/users/macdiesel/events{/privacy}","received_events_url":"https://api.github.com/users/macdiesel/received_events","type":"User","site_admin":false},"body":"We can, but again could we defer this work to a subsequent PR.","created_at":"2016-12-21T19:50:34Z","updated_at":"2016-12-21T19:50:34Z","html_url":"https://github.com/edx/tubular/pull/83#discussion_r93507493","pull_request_url":"https://api.github.com/repos/edx/tubular/pulls/83","_links":{"self":{"href":"https://api.github.com/repos/edx/tubular/pulls/comments/93507493"},"html":{"href":"https://github.com/edx/tubular/pull/83#discussion_r93507493"},"pull_request":{"href":"https://api.github.com/repos/edx/tubular/pulls/83"}}},"pull_request":{"url":"https://api.github.com/repos/edx/tubular/pulls/83","id":98979840,"html_url":"https://github.com/edx/tubular/pull/83","diff_url":"https://github.com/edx/tubular/pull/83.diff","patch_url":"https://github.com/edx/tubular/pull/83.patch","issue_url":"https://api.github.com/repos/edx/tubular/issues/83","number":83,"state":"open","locked":false,"title":"script that will create a branch on a github repository","user":{"login":"macdiesel","id":67862,"avatar_url":"https://avatars.githubusercontent.com/u/67862?v=3","gravatar_id":"","url":"https://api.github.com/users/macdiesel","html_url":"https://github.com/macdiesel","followers_url":"https://api.github.com/users/macdiesel/followers","following_url":"https://api.github.com/users/macdiesel/following{/other_user}","gists_url":"https://api.github.com/users/macdiesel/gists{/gist_id}","starred_url":"https://api.github.com/users/macdiesel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macdiesel/subscriptions","organizations_url":"https://api.github.com/users/macdiesel/orgs","repos_url":"https://api.github.com/users/macdiesel/repos","events_url":"https://api.github.com/users/macdiesel/events{/privacy}","received_events_url":"https://api.github.com/users/macdiesel/received_events","type":"User","site_admin":false},"body":"@edx/pipeline-team PTAL.","created_at":"2016-12-21T18:12:56Z","updated_at":"2016-12-21T19:50:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe4352e788d7d76ff862353475f3522c6faf8efc","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/edx/tubular/pulls/83/commits","review_comments_url":"https://api.github.com/repos/edx/tubular/pulls/83/comments","review_comment_url":"https://api.github.com/repos/edx/tubular/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/tubular/issues/83/comments","statuses_url":"https://api.github.com/repos/edx/tubular/statuses/b28feadf39a346bbe3e05abd9748a587ead0daf5","head":{"label":"edx:bbeggs/create_branch","ref":"bbeggs/create_branch","sha":"b28feadf39a346bbe3e05abd9748a587ead0daf5","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":49446584,"name":"tubular","full_name":"edx/tubular","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/tubular","description":"A repo for edx pipeline related scripts.","fork":false,"url":"https://api.github.com/repos/edx/tubular","forks_url":"https://api.github.com/repos/edx/tubular/forks","keys_url":"https://api.github.com/repos/edx/tubular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/tubular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/tubular/teams","hooks_url":"https://api.github.com/repos/edx/tubular/hooks","issue_events_url":"https://api.github.com/repos/edx/tubular/issues/events{/number}","events_url":"https://api.github.com/repos/edx/tubular/events","assignees_url":"https://api.github.com/repos/edx/tubular/assignees{/user}","branches_url":"https://api.github.com/repos/edx/tubular/branches{/branch}","tags_url":"https://api.github.com/repos/edx/tubular/tags","blobs_url":"https://api.github.com/repos/edx/tubular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/tubular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/tubular/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/tubular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/tubular/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/tubular/languages","stargazers_url":"https://api.github.com/repos/edx/tubular/stargazers","contributors_url":"https://api.github.com/repos/edx/tubular/contributors","subscribers_url":"https://api.github.com/repos/edx/tubular/subscribers","subscription_url":"https://api.github.com/repos/edx/tubular/subscription","commits_url":"https://api.github.com/repos/edx/tubular/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/tubular/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/tubular/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/tubular/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/tubular/contents/{+path}","compare_url":"https://api.github.com/repos/edx/tubular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/tubular/merges","archive_url":"https://api.github.com/repos/edx/tubular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/tubular/downloads","issues_url":"https://api.github.com/repos/edx/tubular/issues{/number}","pulls_url":"https://api.github.com/repos/edx/tubular/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/tubular/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/tubular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/tubular/labels{/name}","releases_url":"https://api.github.com/repos/edx/tubular/releases{/id}","deployments_url":"https://api.github.com/repos/edx/tubular/deployments","created_at":"2016-01-11T18:47:32Z","updated_at":"2016-01-14T21:51:30Z","pushed_at":"2016-12-21T18:12:57Z","git_url":"git://github.com/edx/tubular.git","ssh_url":"git@github.com:edx/tubular.git","clone_url":"https://github.com/edx/tubular.git","svn_url":"https://github.com/edx/tubular","homepage":null,"size":211,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"edx:bbeggs/TE-1734","ref":"bbeggs/TE-1734","sha":"df16f88d0b78d4eeeae05dcc6e614faf85392d91","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":49446584,"name":"tubular","full_name":"edx/tubular","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/tubular","description":"A repo for edx pipeline related scripts.","fork":false,"url":"https://api.github.com/repos/edx/tubular","forks_url":"https://api.github.com/repos/edx/tubular/forks","keys_url":"https://api.github.com/repos/edx/tubular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/tubular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/tubular/teams","hooks_url":"https://api.github.com/repos/edx/tubular/hooks","issue_events_url":"https://api.github.com/repos/edx/tubular/issues/events{/number}","events_url":"https://api.github.com/repos/edx/tubular/events","assignees_url":"https://api.github.com/repos/edx/tubular/assignees{/user}","branches_url":"https://api.github.com/repos/edx/tubular/branches{/branch}","tags_url":"https://api.github.com/repos/edx/tubular/tags","blobs_url":"https://api.github.com/repos/edx/tubular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/tubular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/tubular/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/tubular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/tubular/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/tubular/languages","stargazers_url":"https://api.github.com/repos/edx/tubular/stargazers","contributors_url":"https://api.github.com/repos/edx/tubular/contributors","subscribers_url":"https://api.github.com/repos/edx/tubular/subscribers","subscription_url":"https://api.github.com/repos/edx/tubular/subscription","commits_url":"https://api.github.com/repos/edx/tubular/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/tubular/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/tubular/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/tubular/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/tubular/contents/{+path}","compare_url":"https://api.github.com/repos/edx/tubular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/tubular/merges","archive_url":"https://api.github.com/repos/edx/tubular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/tubular/downloads","issues_url":"https://api.github.com/repos/edx/tubular/issues{/number}","pulls_url":"https://api.github.com/repos/edx/tubular/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/tubular/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/tubular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/tubular/labels{/name}","releases_url":"https://api.github.com/repos/edx/tubular/releases{/id}","deployments_url":"https://api.github.com/repos/edx/tubular/deployments","created_at":"2016-01-11T18:47:32Z","updated_at":"2016-01-14T21:51:30Z","pushed_at":"2016-12-21T18:12:57Z","git_url":"git://github.com/edx/tubular.git","ssh_url":"git@github.com:edx/tubular.git","clone_url":"https://github.com/edx/tubular.git","svn_url":"https://github.com/edx/tubular","homepage":null,"size":211,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/tubular/pulls/83"},"html":{"href":"https://github.com/edx/tubular/pull/83"},"issue":{"href":"https://api.github.com/repos/edx/tubular/issues/83"},"comments":{"href":"https://api.github.com/repos/edx/tubular/issues/83/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/tubular/pulls/83/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/tubular/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/tubular/pulls/83/commits"},"statuses":{"href":"https://api.github.com/repos/edx/tubular/statuses/b28feadf39a346bbe3e05abd9748a587ead0daf5"}}}}
{"actor":{"display_login":"macdiesel"}}