GitHub PullRequestReviewCommentEvent at 2014-07-03 20:49:23
Repository: specialist-publisher
Actor: evilstreak
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/specialist-publisher/pulls/comments/14537185","id":14537185,"diff_hunk":"@@ -0,0 +1,180 @@\n+#!/usr/bin/env ruby\n+\n+class InconsisentEditionStateFixer\n+  require \"ostruct\"\n+\n+  def initialize(raw_editions, output)\n+    @finder = InconsisentEditionStateFinder.new(raw_editions)\n+    @output = output\n+  end\n+\n+  def call\n+    inconsistent_documents\n+    .tap { |docs| log \"Found #{docs.size} with inconsistent edition states\" }\n+    .each do |doc|\n+      log \"Archiving old editions for #{doc.editions.first.slug}\"\n+      archive_old_editions(doc)\n+    end\n+\n+    raise \"Archiving not successful\" unless find_inconsistent_documents.empty?\n+    log \"Archiving successful\"\n+  end\n+\n+  def find_inconsistent_documents\n+    @finder.find_inconsistent_documents\n+  end\n+\n+private\n+  def archive_old_editions(doc)\n+    doc\n+      .editions\n+     .-(editions_not_to_be_archived(doc))","path":"bin/fix_inconsistent_edition_states","position":31,"original_position":31,"commit_id":"b07bd0d0fb20ae8bf848e9802d6a9850cbb15d36","original_commit_id":"b07bd0d0fb20ae8bf848e9802d6a9850cbb15d36","user":{"login":"evilstreak","id":74812,"avatar_url":"https://avatars.githubusercontent.com/u/74812?","gravatar_id":"76b802165c7c55b9c719495d5e4dbf48","url":"https://api.github.com/users/evilstreak","html_url":"https://github.com/evilstreak","followers_url":"https://api.github.com/users/evilstreak/followers","following_url":"https://api.github.com/users/evilstreak/following{/other_user}","gists_url":"https://api.github.com/users/evilstreak/gists{/gist_id}","starred_url":"https://api.github.com/users/evilstreak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evilstreak/subscriptions","organizations_url":"https://api.github.com/users/evilstreak/orgs","repos_url":"https://api.github.com/users/evilstreak/repos","events_url":"https://api.github.com/users/evilstreak/events{/privacy}","received_events_url":"https://api.github.com/users/evilstreak/received_events","type":"User","site_admin":false},"body":"Some indent alignment issues here","created_at":"2014-07-03T20:49:23Z","updated_at":"2014-07-03T20:49:23Z","html_url":"https://github.com/alphagov/specialist-publisher/pull/155#discussion_r14537185","pull_request_url":"https://api.github.com/repos/alphagov/specialist-publisher/pulls/155","_links":{"self":{"href":"https://api.github.com/repos/alphagov/specialist-publisher/pulls/comments/14537185"},"html":{"href":"https://github.com/alphagov/specialist-publisher/pull/155#discussion_r14537185"},"pull_request":{"href":"https://api.github.com/repos/alphagov/specialist-publisher/pulls/155"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/specialist-publisher/pulls/155","id":17878456,"html_url":"https://github.com/alphagov/specialist-publisher/pull/155","diff_url":"https://github.com/alphagov/specialist-publisher/pull/155.diff","patch_url":"https://github.com/alphagov/specialist-publisher/pull/155.patch","issue_url":"https://api.github.com/repos/alphagov/specialist-publisher/issues/155","number":155,"state":"open","title":"Script to fix inconsistent edition states","user":{"login":"bestie","id":145723,"avatar_url":"https://avatars.githubusercontent.com/u/145723?","gravatar_id":"9b6423e15df69eef44d5d34189e128f3","url":"https://api.github.com/users/bestie","html_url":"https://github.com/bestie","followers_url":"https://api.github.com/users/bestie/followers","following_url":"https://api.github.com/users/bestie/following{/other_user}","gists_url":"https://api.github.com/users/bestie/gists{/gist_id}","starred_url":"https://api.github.com/users/bestie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bestie/subscriptions","organizations_url":"https://api.github.com/users/bestie/orgs","repos_url":"https://api.github.com/users/bestie/repos","events_url":"https://api.github.com/users/bestie/events{/privacy}","received_events_url":"https://api.github.com/users/bestie/received_events","type":"User","site_admin":false},"body":"As can be seen in the test data some editions have states in consistent with their version number as a result of not being correctly archived.","created_at":"2014-07-02T10:34:56Z","updated_at":"2014-07-03T20:49:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5071d2925c673751b063af56e2a4b4bdca925ba4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/specialist-publisher/pulls/155/commits","review_comments_url":"https://api.github.com/repos/alphagov/specialist-publisher/pulls/155/comments","review_comment_url":"https://api.github.com/repos/alphagov/specialist-publisher/pulls/comments/{number}","comments_url":"https://api.github.com/repos/alphagov/specialist-publisher/issues/155/comments","statuses_url":"https://api.github.com/repos/alphagov/specialist-publisher/statuses/b07bd0d0fb20ae8bf848e9802d6a9850cbb15d36","head":{"label":"alphagov:fix-inconsistent-edition-states","ref":"fix-inconsistent-edition-states","sha":"b07bd0d0fb20ae8bf848e9802d6a9850cbb15d36","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?","gravatar_id":"5618b843830194a2475a6e48823f7455","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":16176198,"name":"specialist-publisher","full_name":"alphagov/specialist-publisher","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?","gravatar_id":"5618b843830194a2475a6e48823f7455","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/specialist-publisher","description":"","fork":false,"url":"https://api.github.com/repos/alphagov/specialist-publisher","forks_url":"https://api.github.com/repos/alphagov/specialist-publisher/forks","keys_url":"https://api.github.com/repos/alphagov/specialist-publisher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/specialist-publisher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/specialist-publisher/teams","hooks_url":"https://api.github.com/repos/alphagov/specialist-publisher/hooks","issue_events_url":"https://api.github.com/repos/alphagov/specialist-publisher/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/specialist-publisher/events","assignees_url":"https://api.github.com/repos/alphagov/specialist-publisher/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/specialist-publisher/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/specialist-publisher/tags","blobs_url":"https://api.github.com/repos/alphagov/specialist-publisher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/specialist-publisher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/specialist-publisher/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/specialist-publisher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/specialist-publisher/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/specialist-publisher/languages","stargazers_url":"https://api.github.com/repos/alphagov/specialist-publisher/stargazers","contributors_url":"https://api.github.com/repos/alphagov/specialist-publisher/contributors","subscribers_url":"https://api.github.com/repos/alphagov/specialist-publisher/subscribers","subscription_url":"https://api.github.com/repos/alphagov/specialist-publisher/subscription","commits_url":"https://api.github.com/repos/alphagov/specialist-publisher/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/specialist-publisher/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/specialist-publisher/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/specialist-publisher/issues/comments/{number}","contents_url":"https://api.github.com/repos/alphagov/specialist-publisher/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/specialist-publisher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/specialist-publisher/merges","archive_url":"https://api.github.com/repos/alphagov/specialist-publisher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/specialist-publisher/downloads","issues_url":"https://api.github.com/repos/alphagov/specialist-publisher/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/specialist-publisher/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/specialist-publisher/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/specialist-publisher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/specialist-publisher/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/specialist-publisher/releases{/id}","created_at":"2014-01-23T15:21:42Z","updated_at":"2014-06-25T15:42:11Z","pushed_at":"2014-07-03T20:37:39Z","git_url":"git://github.com/alphagov/specialist-publisher.git","ssh_url":"git@github.com:alphagov/specialist-publisher.git","clone_url":"https://github.com/alphagov/specialist-publisher.git","svn_url":"https://github.com/alphagov/specialist-publisher","homepage":null,"size":8323,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"2652d7f97bf7d4f902956d331090b6994e39bfd7","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?","gravatar_id":"5618b843830194a2475a6e48823f7455","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":16176198,"name":"specialist-publisher","full_name":"alphagov/specialist-publisher","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?","gravatar_id":"5618b843830194a2475a6e48823f7455","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/specialist-publisher","description":"","fork":false,"url":"https://api.github.com/repos/alphagov/specialist-publisher","forks_url":"https://api.github.com/repos/alphagov/specialist-publisher/forks","keys_url":"https://api.github.com/repos/alphagov/specialist-publisher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/specialist-publisher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/specialist-publisher/teams","hooks_url":"https://api.github.com/repos/alphagov/specialist-publisher/hooks","issue_events_url":"https://api.github.com/repos/alphagov/specialist-publisher/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/specialist-publisher/events","assignees_url":"https://api.github.com/repos/alphagov/specialist-publisher/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/specialist-publisher/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/specialist-publisher/tags","blobs_url":"https://api.github.com/repos/alphagov/specialist-publisher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/specialist-publisher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/specialist-publisher/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/specialist-publisher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/specialist-publisher/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/specialist-publisher/languages","stargazers_url":"https://api.github.com/repos/alphagov/specialist-publisher/stargazers","contributors_url":"https://api.github.com/repos/alphagov/specialist-publisher/contributors","subscribers_url":"https://api.github.com/repos/alphagov/specialist-publisher/subscribers","subscription_url":"https://api.github.com/repos/alphagov/specialist-publisher/subscription","commits_url":"https://api.github.com/repos/alphagov/specialist-publisher/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/specialist-publisher/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/specialist-publisher/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/specialist-publisher/issues/comments/{number}","contents_url":"https://api.github.com/repos/alphagov/specialist-publisher/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/specialist-publisher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/specialist-publisher/merges","archive_url":"https://api.github.com/repos/alphagov/specialist-publisher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/specialist-publisher/downloads","issues_url":"https://api.github.com/repos/alphagov/specialist-publisher/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/specialist-publisher/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/specialist-publisher/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/specialist-publisher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/specialist-publisher/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/specialist-publisher/releases{/id}","created_at":"2014-01-23T15:21:42Z","updated_at":"2014-06-25T15:42:11Z","pushed_at":"2014-07-03T20:37:39Z","git_url":"git://github.com/alphagov/specialist-publisher.git","ssh_url":"git@github.com:alphagov/specialist-publisher.git","clone_url":"https://github.com/alphagov/specialist-publisher.git","svn_url":"https://github.com/alphagov/specialist-publisher","homepage":null,"size":8323,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/specialist-publisher/pulls/155"},"html":{"href":"https://github.com/alphagov/specialist-publisher/pull/155"},"issue":{"href":"https://api.github.com/repos/alphagov/specialist-publisher/issues/155"},"comments":{"href":"https://api.github.com/repos/alphagov/specialist-publisher/issues/155/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/specialist-publisher/pulls/155/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/specialist-publisher/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/alphagov/specialist-publisher/pulls/155/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/specialist-publisher/statuses/b07bd0d0fb20ae8bf848e9802d6a9850cbb15d36"}}}}