{"action":"created","comment":{"url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/28337894","id":28337894,"diff_hunk":"@@ -1412,3 +1418,164 @@ def get_dispatcher(self):\n         self.assertTrue(\n             expected_files.issubset(set(files_on_s3)),\n             \"Metadata files for the packages were not created.\")\n+\n+\n+class CreateReleaseBranchOptionsTests(TestCase):\n+    \"\"\"\n+    Tests for :class:`CreateReleaseBranchOptions`.\n+    \"\"\"\n+\n+    def test_flocker_version_required(self):\n+          \"\"\"\n+          The ``--flocker-version`` option is required.\n+          \"\"\"\n+          options = CreateReleaseBranchOptions()\n+          self.assertRaises(\n+              UsageError,\n+              options.parseOptions, [])\n+\n+class CreateReleaseBranchTests(TestCase):\n+    \"\"\"\n+    Tests for :func:`create_release_branch`.\n+    \"\"\"\n+\n+    def setUp(self):\n+        repo_directory = FilePath(tempfile.mkdtemp())\n+        self.addCleanup(repo_directory.remove)\n+        self.repo = Repo.init(path=repo_directory.path)\n+        repo_directory.child('README').touch()\n+        self.repo.index.add(['README'])\n+        self.repo.index.commit('Initial commit')\n+        self.repo.create_head('master')\n+\n+    def create_release_branch(self, version):\n+        return create_release_branch(\n+            version=version, path=self.repo.working_dir)\n+\n+    def test_create_release_branch_for_non_release_fails(self):\n+        \"\"\"\n+        Calling :func:`create_release_branch` with a version that isn't a\n+        release fails.\n+        \"\"\"\n+        self.assertRaises(\n+            NotARelease,\n+            self.create_release_branch, '0.3.0-444-gf05215b')\n+\n+    def test_weekly_release_base(self):\n+        \"\"\"\n+        A weekly release is created from the \"master\" branch.\n+        \"\"\"\n+        self.assertEqual(\n+            self.create_release_branch(version='0.3.0dev1').name,\n+            \"master\")\n+\n+    def test_active_branch(self):\n+        \"\"\"\n+        Creating a release branch changes the active branch on the specified\n+        repository to that branch.\n+        \"\"\"\n+        self.repo.create_head('release/flocker-0.3.0pre1')\n+        self.repo.create_tag('0.3.0pre1')\n+        self.create_release_branch(version='0.3.0')\n+        self.assertEqual(\n+            self.repo.active_branch.name,\n+            \"release/flocker-0.3.0\")\n+\n+    def test_first_pre_release(self):\n+        \"\"\"\n+        The first pre-release for a marketing release is created from the\n+        \"master\" branch.\n+        \"\"\"\n+        self.assertEqual(\n+            self.create_release_branch(version='0.3.0pre1').name,\n+            \"master\")\n+\n+    def test_uses_previous_pre_release(self):\n+        \"\"\"\n+        The second pre-release for a marketing release is created from the\n+        previous pre-release release branch.\n+        \"\"\"\n+        self.repo.create_head('release/flocker-0.3.0pre1')\n+        self.repo.create_tag('0.3.0pre1')\n+        self.repo.create_head('release/flocker-0.3.0pre2')\n+        self.repo.create_tag('0.3.0pre2')\n+        self.assertEqual(\n+            self.create_release_branch(version='0.3.0pre3').name,\n+            \"release/flocker-0.3.0pre2\")\n+\n+    def test_unparseable_tags(self):\n+        \"\"\"\n+        There is no error raised if the repository contains a tag which cannot\n+        be parsed as a version.\n+        \"\"\"\n+        self.repo.create_head('release/flocker-0.3.0unparseable')\n+        self.repo.create_tag('0.3.0unparseable')\n+        self.repo.create_head('release/flocker-0.3.0pre2')\n+        self.repo.create_tag('0.3.0pre2')\n+        self.assertEqual(\n+            self.create_release_branch(version='0.3.0pre3').name,\n+            \"release/flocker-0.3.0pre2\")\n+\n+    def test_parent_repository_used(self):\n+        \"\"\"\n+        If a path is given as the repository path, the parents of that file\n+        are searched until a Git repository is found.\n+        \"\"\"\n+        self.assertEqual(\n+            create_release_branch(\n+                version='0.3.0dev1',\n+                path=FilePath(self.repo.working_dir).child('README').path,\n+            ).name,\n+            \"master\")\n+\n+    def test_no_pre_releases_fails(self):\n+        \"\"\"\n+        Trying to release a marketing release when no pre-release exists for it\n+        fails.\n+        \"\"\"\n+        self.assertRaises(\n+            NoPreRelease,\n+            self.create_release_branch, '0.3.0')\n+\n+    def test_missing_pre_release_fails(self):\n+        \"\"\"\n+        Trying to release a pre-release when the previous pre-release does not\n+        exist fails.\n+        \"\"\"\n+        self.repo.create_head('release/flocker-0.3.0pre1')\n+        self.repo.create_tag('0.3.0pre1')\n+        self.assertRaises(\n+            MissingPreRelease,\n+            self.create_release_branch, '0.3.0pre3')\n+\n+    def test_base_branch_does_not_exist_fails(self):\n+        \"\"\"\n+        Trying to create a release when the base branch does not exist fails.\n+        \"\"\"\n+        self.repo.create_tag('0.3.0pre1')\n+\n+        self.assertRaises(\n+            BaseBranchDoesNotExist,\n+            self.create_release_branch, '0.3.0')\n+\n+    def test_tag_exists_fails(self):\n+        \"\"\"\n+        Trying to create a release when a tag already exists for the given\n+        version fails.\n+        \"\"\"\n+        self.repo.create_tag('0.3.0')\n+        self.assertRaises(\n+            TagExists,\n+            self.create_release_branch, '0.3.0')\n+\n+    def test_branch_exists_fails(self):\n+        \"\"\"\n+        Trying to create a release when a branch already exists for the given\n+        version fails.\n+        \"\"\"\n+        self.repo.create_head('release/flocker-0.3.0pre1')\n+        self.repo.create_tag('0.3.0pre1')\n+        self.repo.create_head('release/flocker-0.3.0')\n+        self.assertRaises(\n+            BranchExists,\n+            self.create_release_branch, '0.3.0')","path":"admin/test/test_release.py","position":188,"original_position":188,"commit_id":"d1dfbcfeab610f8476e8aea0d403cd90308e3593","original_commit_id":"d1dfbcfeab610f8476e8aea0d403cd90308e3593","user":{"login":"adamtheturtle","id":797801,"avatar_url":"https://avatars.githubusercontent.com/u/797801?v=3","gravatar_id":"","url":"https://api.github.com/users/adamtheturtle","html_url":"https://github.com/adamtheturtle","followers_url":"https://api.github.com/users/adamtheturtle/followers","following_url":"https://api.github.com/users/adamtheturtle/following{/other_user}","gists_url":"https://api.github.com/users/adamtheturtle/gists{/gist_id}","starred_url":"https://api.github.com/users/adamtheturtle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamtheturtle/subscriptions","organizations_url":"https://api.github.com/users/adamtheturtle/orgs","repos_url":"https://api.github.com/users/adamtheturtle/repos","events_url":"https://api.github.com/users/adamtheturtle/events{/privacy}","received_events_url":"https://api.github.com/users/adamtheturtle/received_events","type":"User","site_admin":false},"body":"This is what happens when I don't do TDD properly :disappointed: ","created_at":"2015-04-14T15:29:29Z","updated_at":"2015-04-14T15:29:29Z","html_url":"https://github.com/ClusterHQ/flocker/pull/1305#discussion_r28337894","pull_request_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1305","_links":{"self":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/28337894"},"html":{"href":"https://github.com/ClusterHQ/flocker/pull/1305#discussion_r28337894"},"pull_request":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1305"}}},"pull_request":{"url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1305","id":33253832,"html_url":"https://github.com/ClusterHQ/flocker/pull/1305","diff_url":"https://github.com/ClusterHQ/flocker/pull/1305.diff","patch_url":"https://github.com/ClusterHQ/flocker/pull/1305.patch","issue_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/1305","number":1305,"state":"open","locked":false,"title":"Base branch floc 1706","user":{"login":"adamtheturtle","id":797801,"avatar_url":"https://avatars.githubusercontent.com/u/797801?v=3","gravatar_id":"","url":"https://api.github.com/users/adamtheturtle","html_url":"https://github.com/adamtheturtle","followers_url":"https://api.github.com/users/adamtheturtle/followers","following_url":"https://api.github.com/users/adamtheturtle/following{/other_user}","gists_url":"https://api.github.com/users/adamtheturtle/gists{/gist_id}","starred_url":"https://api.github.com/users/adamtheturtle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamtheturtle/subscriptions","organizations_url":"https://api.github.com/users/adamtheturtle/orgs","repos_url":"https://api.github.com/users/adamtheturtle/repos","events_url":"https://api.github.com/users/adamtheturtle/events{/privacy}","received_events_url":"https://api.github.com/users/adamtheturtle/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-14T12:50:41Z","updated_at":"2015-04-14T15:29:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76f98cd8a9ed10c92741618923d4f0fbd7b75c65","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1305/commits","review_comments_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1305/comments","review_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/1305/comments","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/d1dfbcfeab610f8476e8aea0d403cd90308e3593","head":{"label":"ClusterHQ:base-branch-FLOC-1706","ref":"base-branch-FLOC-1706","sha":"d1dfbcfeab610f8476e8aea0d403cd90308e3593","user":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"repo":{"id":19248542,"name":"flocker","full_name":"ClusterHQ/flocker","owner":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ClusterHQ/flocker","description":"Easily manage Docker containers & their data","fork":false,"url":"https://api.github.com/repos/ClusterHQ/flocker","forks_url":"https://api.github.com/repos/ClusterHQ/flocker/forks","keys_url":"https://api.github.com/repos/ClusterHQ/flocker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ClusterHQ/flocker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ClusterHQ/flocker/teams","hooks_url":"https://api.github.com/repos/ClusterHQ/flocker/hooks","issue_events_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/events{/number}","events_url":"https://api.github.com/repos/ClusterHQ/flocker/events","assignees_url":"https://api.github.com/repos/ClusterHQ/flocker/assignees{/user}","branches_url":"https://api.github.com/repos/ClusterHQ/flocker/branches{/branch}","tags_url":"https://api.github.com/repos/ClusterHQ/flocker/tags","blobs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ClusterHQ/flocker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/refs{/sha}","trees_url":"https://api.github.com/repos/ClusterHQ/flocker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/{sha}","languages_url":"https://api.github.com/repos/ClusterHQ/flocker/languages","stargazers_url":"https://api.github.com/repos/ClusterHQ/flocker/stargazers","contributors_url":"https://api.github.com/repos/ClusterHQ/flocker/contributors","subscribers_url":"https://api.github.com/repos/ClusterHQ/flocker/subscribers","subscription_url":"https://api.github.com/repos/ClusterHQ/flocker/subscription","commits_url":"https://api.github.com/repos/ClusterHQ/flocker/commits{/sha}","git_commits_url":"https://api.github.com/repos/ClusterHQ/flocker/git/commits{/sha}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/comments{/number}","issue_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/comments{/number}","contents_url":"https://api.github.com/repos/ClusterHQ/flocker/contents/{+path}","compare_url":"https://api.github.com/repos/ClusterHQ/flocker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ClusterHQ/flocker/merges","archive_url":"https://api.github.com/repos/ClusterHQ/flocker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ClusterHQ/flocker/downloads","issues_url":"https://api.github.com/repos/ClusterHQ/flocker/issues{/number}","pulls_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls{/number}","milestones_url":"https://api.github.com/repos/ClusterHQ/flocker/milestones{/number}","notifications_url":"https://api.github.com/repos/ClusterHQ/flocker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ClusterHQ/flocker/labels{/name}","releases_url":"https://api.github.com/repos/ClusterHQ/flocker/releases{/id}","created_at":"2014-04-28T18:02:14Z","updated_at":"2015-04-14T14:12:27Z","pushed_at":"2015-04-14T15:28:47Z","git_url":"git://github.com/ClusterHQ/flocker.git","ssh_url":"git@github.com:ClusterHQ/flocker.git","clone_url":"https://github.com/ClusterHQ/flocker.git","svn_url":"https://github.com/ClusterHQ/flocker","homepage":"https://clusterhq.com","size":48650,"stargazers_count":1336,"watchers_count":1336,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":73,"mirror_url":null,"open_issues_count":33,"forks":73,"open_issues":33,"watchers":1336,"default_branch":"master"}},"base":{"label":"ClusterHQ:master","ref":"master","sha":"c10c09cff85fd4d238416b67915e937d84a891c1","user":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"repo":{"id":19248542,"name":"flocker","full_name":"ClusterHQ/flocker","owner":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ClusterHQ/flocker","description":"Easily manage Docker containers & their data","fork":false,"url":"https://api.github.com/repos/ClusterHQ/flocker","forks_url":"https://api.github.com/repos/ClusterHQ/flocker/forks","keys_url":"https://api.github.com/repos/ClusterHQ/flocker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ClusterHQ/flocker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ClusterHQ/flocker/teams","hooks_url":"https://api.github.com/repos/ClusterHQ/flocker/hooks","issue_events_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/events{/number}","events_url":"https://api.github.com/repos/ClusterHQ/flocker/events","assignees_url":"https://api.github.com/repos/ClusterHQ/flocker/assignees{/user}","branches_url":"https://api.github.com/repos/ClusterHQ/flocker/branches{/branch}","tags_url":"https://api.github.com/repos/ClusterHQ/flocker/tags","blobs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ClusterHQ/flocker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/refs{/sha}","trees_url":"https://api.github.com/repos/ClusterHQ/flocker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/{sha}","languages_url":"https://api.github.com/repos/ClusterHQ/flocker/languages","stargazers_url":"https://api.github.com/repos/ClusterHQ/flocker/stargazers","contributors_url":"https://api.github.com/repos/ClusterHQ/flocker/contributors","subscribers_url":"https://api.github.com/repos/ClusterHQ/flocker/subscribers","subscription_url":"https://api.github.com/repos/ClusterHQ/flocker/subscription","commits_url":"https://api.github.com/repos/ClusterHQ/flocker/commits{/sha}","git_commits_url":"https://api.github.com/repos/ClusterHQ/flocker/git/commits{/sha}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/comments{/number}","issue_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/comments{/number}","contents_url":"https://api.github.com/repos/ClusterHQ/flocker/contents/{+path}","compare_url":"https://api.github.com/repos/ClusterHQ/flocker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ClusterHQ/flocker/merges","archive_url":"https://api.github.com/repos/ClusterHQ/flocker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ClusterHQ/flocker/downloads","issues_url":"https://api.github.com/repos/ClusterHQ/flocker/issues{/number}","pulls_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls{/number}","milestones_url":"https://api.github.com/repos/ClusterHQ/flocker/milestones{/number}","notifications_url":"https://api.github.com/repos/ClusterHQ/flocker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ClusterHQ/flocker/labels{/name}","releases_url":"https://api.github.com/repos/ClusterHQ/flocker/releases{/id}","created_at":"2014-04-28T18:02:14Z","updated_at":"2015-04-14T14:12:27Z","pushed_at":"2015-04-14T15:28:47Z","git_url":"git://github.com/ClusterHQ/flocker.git","ssh_url":"git@github.com:ClusterHQ/flocker.git","clone_url":"https://github.com/ClusterHQ/flocker.git","svn_url":"https://github.com/ClusterHQ/flocker","homepage":"https://clusterhq.com","size":48650,"stargazers_count":1336,"watchers_count":1336,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":73,"mirror_url":null,"open_issues_count":33,"forks":73,"open_issues":33,"watchers":1336,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1305"},"html":{"href":"https://github.com/ClusterHQ/flocker/pull/1305"},"issue":{"href":"https://api.github.com/repos/ClusterHQ/flocker/issues/1305"},"comments":{"href":"https://api.github.com/repos/ClusterHQ/flocker/issues/1305/comments"},"review_comments":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1305/comments"},"review_comment":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1305/commits"},"statuses":{"href":"https://api.github.com/repos/ClusterHQ/flocker/statuses/d1dfbcfeab610f8476e8aea0d403cd90308e3593"}}}}