{"action":"created","comment":{"url":"https://api.github.com/repos/evansde77/cirrus/pulls/comments/45125838","id":45125838,"diff_hunk":"@@ -503,6 +539,98 @@ def upload_release(opts):\n     return\n \n \n+def merge_release(opts):\n+    \"\"\"\n+    _merge_release_\n+\n+    Merge a release branch git flow style into master and develop\n+    branches (or those configured for this package) and tag\n+    master.\n+\n+    \"\"\"\n+    config = load_configuration()\n+    release_config = {\n+        'wait_on_ci': False,\n+        'wait_on_ci_timeout': 600,\n+        'wait_on_ci_interval': 2\n+    }\n+    if 'release' in config:\n+        release_config['wait_on_ci'] = config.get_param(\n+            'release', 'wait_on_ci', False\n+        )\n+        release_config['wait_on_ci_timeout'] = int(config.get_param(\n+            'release', 'wait_on_ci_timeout', 600)\n+        )\n+        release_config['wait_on_ci_interval'] = int(config.get_param(\n+            'release', 'wait_on_ci_interval', 2)\n+        )\n+\n+\n+\n+    repo_dir = os.getcwd()\n+    with GitHubContext(repo_dir) as ghc:\n+\n+        curr_branch = ghc.active_branch_name\n+        expected_branch = release_branch_name(config)\n+\n+        if curr_branch.name != expected_branch:\n+            msg = (\n+                \"Not on the expected release branch according \"\n+                \"to cirrus.conf\\n Expected:{0} but on {1}\"\n+            ).format(expected_branch, curr_branch)\n+            LOGGER.error(msg)\n+            raise RuntimeError(msg)\n+        # merge in release branches and tag, push to remote\n+        tag = config.package_version()\n+        master = config.gitflow_master_name()\n+        develop = config.gitflow_branch_name()\n+\n+        # merge release branch into master\n+        LOGGER.info(\"Tagging and pushing {0}\".format(tag))\n+        checkout_and_pull(repo_dir, master)\n+        merge(repo_dir, master, expected_branch)\n+\n+        if not opts.test:\n+            LOGGER.info(\"pushing to remote...\")\n+            if release_config['wait_on_ci']:\n+                # if wait_on_ci is set and we have gotten to this point,\n+                # tests pass on the release branch, so we can tell the\n+                # remote the good news.\n+                ghc.set_branch_state('success')\n+            push(repo_dir)\n+        do_push = not opts.test\n+        tag_release(repo_dir, tag, master, push=do_push)\n+\n+        # Merge release branch back to develop\n+        # push to develop\n+        LOGGER.info(\"Merging back to develop...\")\n+        checkout_and_pull(repo_dir, develop)\n+        if release_config['wait_on_ci']:\n+            # @HACK If we are doing CI, our branch will be \"out of date\",\n+            # so we update it by merging from master (not gitflow, I\n+            # know), and then waiting for CI status on the remote.\n+            merge(repo_dir, develop, master)\n+            ghc.wait_on_gh_status(\n+                develop,\n+                timeout=release_config['wait_on_ci_timeout'],\n+                interval=release_config['wait_on_ci_interval']\n+            )\n+        else:\n+            merge(repo_dir, develop, expected_branch)\n+\n+        if not opts.test:\n+            LOGGER.info(\"pushing to remote...\")\n+            if release_config['wait_on_ci']:\n+                # if wait_on_ci is set and we have gotten to this point,\n+                # tests pass on the release branch, so we can tell the\n+                # remote the good news.\n+                ghc.set_branch_state('success')","path":"src/cirrus/release.py","position":139,"original_position":139,"commit_id":"0e5d81699fa6c8e1e176a3ed28c38e92c2b8489a","original_commit_id":"0e5d81699fa6c8e1e176a3ed28c38e92c2b8489a","user":{"login":"petevg","id":183694,"avatar_url":"https://avatars.githubusercontent.com/u/183694?v=3","gravatar_id":"","url":"https://api.github.com/users/petevg","html_url":"https://github.com/petevg","followers_url":"https://api.github.com/users/petevg/followers","following_url":"https://api.github.com/users/petevg/following{/other_user}","gists_url":"https://api.github.com/users/petevg/gists{/gist_id}","starred_url":"https://api.github.com/users/petevg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petevg/subscriptions","organizations_url":"https://api.github.com/users/petevg/orgs","repos_url":"https://api.github.com/users/petevg/repos","events_url":"https://api.github.com/users/petevg/events{/privacy}","received_events_url":"https://api.github.com/users/petevg/received_events","type":"User","site_admin":false},"body":"Maybe add another wait_on_gh_status here? Or maybe just move up the wait above to here?","created_at":"2015-11-17T21:44:00Z","updated_at":"2015-11-17T21:44:00Z","html_url":"https://github.com/evansde77/cirrus/pull/81#discussion_r45125838","pull_request_url":"https://api.github.com/repos/evansde77/cirrus/pulls/81","_links":{"self":{"href":"https://api.github.com/repos/evansde77/cirrus/pulls/comments/45125838"},"html":{"href":"https://github.com/evansde77/cirrus/pull/81#discussion_r45125838"},"pull_request":{"href":"https://api.github.com/repos/evansde77/cirrus/pulls/81"}}},"pull_request":{"url":"https://api.github.com/repos/evansde77/cirrus/pulls/81","id":50830540,"html_url":"https://github.com/evansde77/cirrus/pull/81","diff_url":"https://github.com/evansde77/cirrus/pull/81.diff","patch_url":"https://github.com/evansde77/cirrus/pull/81.patch","issue_url":"https://api.github.com/repos/evansde77/cirrus/issues/81","number":81,"state":"open","locked":false,"title":"release merge command with optional sha commit comments","user":{"login":"evansde77","id":342380,"avatar_url":"https://avatars.githubusercontent.com/u/342380?v=3","gravatar_id":"","url":"https://api.github.com/users/evansde77","html_url":"https://github.com/evansde77","followers_url":"https://api.github.com/users/evansde77/followers","following_url":"https://api.github.com/users/evansde77/following{/other_user}","gists_url":"https://api.github.com/users/evansde77/gists{/gist_id}","starred_url":"https://api.github.com/users/evansde77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evansde77/subscriptions","organizations_url":"https://api.github.com/users/evansde77/orgs","repos_url":"https://api.github.com/users/evansde77/repos","events_url":"https://api.github.com/users/evansde77/events{/privacy}","received_events_url":"https://api.github.com/users/evansde77/received_events","type":"User","site_admin":false},"body":"@petevg @shudgston @appeltel \r\n\r\nJet Lag Code. Probably same as WIP or something. \r\n\r\nIn this PR:\r\n - add new release merge subcommand parser and method\r\n - clone the merge logic from upload into the new command\r\n - add support for attaching comments to a commit on merge \r\n\r\nToDo (more for my benefit): \r\n  - live testing\r\n  - tweak the file path in the comment to come via cirrus.conf \r\n  - add branch cleanup on successful merge \r\n  - clean merge code out of upload command when working\r\n","created_at":"2015-11-16T16:17:02Z","updated_at":"2015-11-17T21:44:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9af59fb62134618f6639c67c7b251ee45c1e56d8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/evansde77/cirrus/pulls/81/commits","review_comments_url":"https://api.github.com/repos/evansde77/cirrus/pulls/81/comments","review_comment_url":"https://api.github.com/repos/evansde77/cirrus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/evansde77/cirrus/issues/81/comments","statuses_url":"https://api.github.com/repos/evansde77/cirrus/statuses/0e5d81699fa6c8e1e176a3ed28c38e92c2b8489a","head":{"label":"evansde77:feature/split-release","ref":"feature/split-release","sha":"0e5d81699fa6c8e1e176a3ed28c38e92c2b8489a","user":{"login":"evansde77","id":342380,"avatar_url":"https://avatars.githubusercontent.com/u/342380?v=3","gravatar_id":"","url":"https://api.github.com/users/evansde77","html_url":"https://github.com/evansde77","followers_url":"https://api.github.com/users/evansde77/followers","following_url":"https://api.github.com/users/evansde77/following{/other_user}","gists_url":"https://api.github.com/users/evansde77/gists{/gist_id}","starred_url":"https://api.github.com/users/evansde77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evansde77/subscriptions","organizations_url":"https://api.github.com/users/evansde77/orgs","repos_url":"https://api.github.com/users/evansde77/repos","events_url":"https://api.github.com/users/evansde77/events{/privacy}","received_events_url":"https://api.github.com/users/evansde77/received_events","type":"User","site_admin":false},"repo":{"id":17570751,"name":"cirrus","full_name":"evansde77/cirrus","owner":{"login":"evansde77","id":342380,"avatar_url":"https://avatars.githubusercontent.com/u/342380?v=3","gravatar_id":"","url":"https://api.github.com/users/evansde77","html_url":"https://github.com/evansde77","followers_url":"https://api.github.com/users/evansde77/followers","following_url":"https://api.github.com/users/evansde77/following{/other_user}","gists_url":"https://api.github.com/users/evansde77/gists{/gist_id}","starred_url":"https://api.github.com/users/evansde77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evansde77/subscriptions","organizations_url":"https://api.github.com/users/evansde77/orgs","repos_url":"https://api.github.com/users/evansde77/repos","events_url":"https://api.github.com/users/evansde77/events{/privacy}","received_events_url":"https://api.github.com/users/evansde77/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/evansde77/cirrus","description":"python library build, test and devop like things assistant","fork":false,"url":"https://api.github.com/repos/evansde77/cirrus","forks_url":"https://api.github.com/repos/evansde77/cirrus/forks","keys_url":"https://api.github.com/repos/evansde77/cirrus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/evansde77/cirrus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/evansde77/cirrus/teams","hooks_url":"https://api.github.com/repos/evansde77/cirrus/hooks","issue_events_url":"https://api.github.com/repos/evansde77/cirrus/issues/events{/number}","events_url":"https://api.github.com/repos/evansde77/cirrus/events","assignees_url":"https://api.github.com/repos/evansde77/cirrus/assignees{/user}","branches_url":"https://api.github.com/repos/evansde77/cirrus/branches{/branch}","tags_url":"https://api.github.com/repos/evansde77/cirrus/tags","blobs_url":"https://api.github.com/repos/evansde77/cirrus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/evansde77/cirrus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/evansde77/cirrus/git/refs{/sha}","trees_url":"https://api.github.com/repos/evansde77/cirrus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/evansde77/cirrus/statuses/{sha}","languages_url":"https://api.github.com/repos/evansde77/cirrus/languages","stargazers_url":"https://api.github.com/repos/evansde77/cirrus/stargazers","contributors_url":"https://api.github.com/repos/evansde77/cirrus/contributors","subscribers_url":"https://api.github.com/repos/evansde77/cirrus/subscribers","subscription_url":"https://api.github.com/repos/evansde77/cirrus/subscription","commits_url":"https://api.github.com/repos/evansde77/cirrus/commits{/sha}","git_commits_url":"https://api.github.com/repos/evansde77/cirrus/git/commits{/sha}","comments_url":"https://api.github.com/repos/evansde77/cirrus/comments{/number}","issue_comment_url":"https://api.github.com/repos/evansde77/cirrus/issues/comments{/number}","contents_url":"https://api.github.com/repos/evansde77/cirrus/contents/{+path}","compare_url":"https://api.github.com/repos/evansde77/cirrus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/evansde77/cirrus/merges","archive_url":"https://api.github.com/repos/evansde77/cirrus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/evansde77/cirrus/downloads","issues_url":"https://api.github.com/repos/evansde77/cirrus/issues{/number}","pulls_url":"https://api.github.com/repos/evansde77/cirrus/pulls{/number}","milestones_url":"https://api.github.com/repos/evansde77/cirrus/milestones{/number}","notifications_url":"https://api.github.com/repos/evansde77/cirrus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/evansde77/cirrus/labels{/name}","releases_url":"https://api.github.com/repos/evansde77/cirrus/releases{/id}","created_at":"2014-03-09T18:35:33Z","updated_at":"2015-04-09T15:15:49Z","pushed_at":"2015-11-17T21:33:32Z","git_url":"git://github.com/evansde77/cirrus.git","ssh_url":"git@github.com:evansde77/cirrus.git","clone_url":"https://github.com/evansde77/cirrus.git","svn_url":"https://github.com/evansde77/cirrus","homepage":null,"size":3202,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":1,"default_branch":"develop"}},"base":{"label":"evansde77:develop","ref":"develop","sha":"58c88a1d860f15cd261e714283262673512945a4","user":{"login":"evansde77","id":342380,"avatar_url":"https://avatars.githubusercontent.com/u/342380?v=3","gravatar_id":"","url":"https://api.github.com/users/evansde77","html_url":"https://github.com/evansde77","followers_url":"https://api.github.com/users/evansde77/followers","following_url":"https://api.github.com/users/evansde77/following{/other_user}","gists_url":"https://api.github.com/users/evansde77/gists{/gist_id}","starred_url":"https://api.github.com/users/evansde77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evansde77/subscriptions","organizations_url":"https://api.github.com/users/evansde77/orgs","repos_url":"https://api.github.com/users/evansde77/repos","events_url":"https://api.github.com/users/evansde77/events{/privacy}","received_events_url":"https://api.github.com/users/evansde77/received_events","type":"User","site_admin":false},"repo":{"id":17570751,"name":"cirrus","full_name":"evansde77/cirrus","owner":{"login":"evansde77","id":342380,"avatar_url":"https://avatars.githubusercontent.com/u/342380?v=3","gravatar_id":"","url":"https://api.github.com/users/evansde77","html_url":"https://github.com/evansde77","followers_url":"https://api.github.com/users/evansde77/followers","following_url":"https://api.github.com/users/evansde77/following{/other_user}","gists_url":"https://api.github.com/users/evansde77/gists{/gist_id}","starred_url":"https://api.github.com/users/evansde77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evansde77/subscriptions","organizations_url":"https://api.github.com/users/evansde77/orgs","repos_url":"https://api.github.com/users/evansde77/repos","events_url":"https://api.github.com/users/evansde77/events{/privacy}","received_events_url":"https://api.github.com/users/evansde77/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/evansde77/cirrus","description":"python library build, test and devop like things assistant","fork":false,"url":"https://api.github.com/repos/evansde77/cirrus","forks_url":"https://api.github.com/repos/evansde77/cirrus/forks","keys_url":"https://api.github.com/repos/evansde77/cirrus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/evansde77/cirrus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/evansde77/cirrus/teams","hooks_url":"https://api.github.com/repos/evansde77/cirrus/hooks","issue_events_url":"https://api.github.com/repos/evansde77/cirrus/issues/events{/number}","events_url":"https://api.github.com/repos/evansde77/cirrus/events","assignees_url":"https://api.github.com/repos/evansde77/cirrus/assignees{/user}","branches_url":"https://api.github.com/repos/evansde77/cirrus/branches{/branch}","tags_url":"https://api.github.com/repos/evansde77/cirrus/tags","blobs_url":"https://api.github.com/repos/evansde77/cirrus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/evansde77/cirrus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/evansde77/cirrus/git/refs{/sha}","trees_url":"https://api.github.com/repos/evansde77/cirrus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/evansde77/cirrus/statuses/{sha}","languages_url":"https://api.github.com/repos/evansde77/cirrus/languages","stargazers_url":"https://api.github.com/repos/evansde77/cirrus/stargazers","contributors_url":"https://api.github.com/repos/evansde77/cirrus/contributors","subscribers_url":"https://api.github.com/repos/evansde77/cirrus/subscribers","subscription_url":"https://api.github.com/repos/evansde77/cirrus/subscription","commits_url":"https://api.github.com/repos/evansde77/cirrus/commits{/sha}","git_commits_url":"https://api.github.com/repos/evansde77/cirrus/git/commits{/sha}","comments_url":"https://api.github.com/repos/evansde77/cirrus/comments{/number}","issue_comment_url":"https://api.github.com/repos/evansde77/cirrus/issues/comments{/number}","contents_url":"https://api.github.com/repos/evansde77/cirrus/contents/{+path}","compare_url":"https://api.github.com/repos/evansde77/cirrus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/evansde77/cirrus/merges","archive_url":"https://api.github.com/repos/evansde77/cirrus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/evansde77/cirrus/downloads","issues_url":"https://api.github.com/repos/evansde77/cirrus/issues{/number}","pulls_url":"https://api.github.com/repos/evansde77/cirrus/pulls{/number}","milestones_url":"https://api.github.com/repos/evansde77/cirrus/milestones{/number}","notifications_url":"https://api.github.com/repos/evansde77/cirrus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/evansde77/cirrus/labels{/name}","releases_url":"https://api.github.com/repos/evansde77/cirrus/releases{/id}","created_at":"2014-03-09T18:35:33Z","updated_at":"2015-04-09T15:15:49Z","pushed_at":"2015-11-17T21:33:32Z","git_url":"git://github.com/evansde77/cirrus.git","ssh_url":"git@github.com:evansde77/cirrus.git","clone_url":"https://github.com/evansde77/cirrus.git","svn_url":"https://github.com/evansde77/cirrus","homepage":null,"size":3202,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/evansde77/cirrus/pulls/81"},"html":{"href":"https://github.com/evansde77/cirrus/pull/81"},"issue":{"href":"https://api.github.com/repos/evansde77/cirrus/issues/81"},"comments":{"href":"https://api.github.com/repos/evansde77/cirrus/issues/81/comments"},"review_comments":{"href":"https://api.github.com/repos/evansde77/cirrus/pulls/81/comments"},"review_comment":{"href":"https://api.github.com/repos/evansde77/cirrus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/evansde77/cirrus/pulls/81/commits"},"statuses":{"href":"https://api.github.com/repos/evansde77/cirrus/statuses/0e5d81699fa6c8e1e176a3ed28c38e92c2b8489a"}}}}