{"action":"created","comment":{"url":"https://api.github.com/repos/juju/charmstore/pulls/comments/25413954","id":25413954,"diff_hunk":"@@ -793,6 +848,600 @@ func (s *migrationsSuite) TestPopulateWriteACLSomeUpdates(c *gc.C) {\n \t})\n }\n \n+func (s *migrationsSuite) TestPopulatePromulgatedEntities(c *gc.C) {\n+\ts.patchMigrations(c, getMigrations(\"populate promulgated entities\"))\n+\tid1 := charm.MustParseReference(\"trusty/django-42\")\n+\tid2 := charm.MustParseReference(\"~who/utopic/rails-47\")\n+\tid3 := charm.MustParseReference(\"~who/trusty/django-42\")\n+\tid4 := charm.MustParseReference(\"~dalek/trusty/django-42\")\n+\tid5 := charm.MustParseReference(\"~ace/utopic/rails-47\")\n+\tid6 := charm.MustParseReference(\"~who/trusty/django-41\")\n+\ts.insertEntity(c, &mongodoc.Entity{\n+\t\tURL:      id1,\n+\t\tBlobHash: \"django-1\",\n+\t\tExtraInfo: map[string][]byte{\n+\t\t\t\"bzr-owner\": []byte(`\"who\"`),\n+\t\t},\n+\t}, entity2...)\n+\ts.insertEntity(c, &mongodoc.Entity{\n+\t\tURL:      id2,\n+\t\tBlobHash: \"rails-1\",\n+\t\tExtraInfo: map[string][]byte{\n+\t\t\t\"bzr-owner\": []byte(`\"who\"`),\n+\t\t},\n+\t}, entity2...)\n+\ts.insertEntity(c, &mongodoc.Entity{\n+\t\tURL:      id3,\n+\t\tBlobHash: \"django-1\",\n+\t\tExtraInfo: map[string][]byte{\n+\t\t\t\"bzr-owner\": []byte(`\"who\"`),\n+\t\t},\n+\t}, entity2...)\n+\ts.insertEntity(c, &mongodoc.Entity{\n+\t\tURL:      id4,\n+\t\tBlobHash: \"django-1\",\n+\t\tExtraInfo: map[string][]byte{\n+\t\t\t\"bzr-owner\": []byte(`\"dalek\"`),\n+\t\t},\n+\t}, entity2...)\n+\ts.insertEntity(c, &mongodoc.Entity{\n+\t\tURL:      id5,\n+\t\tBlobHash: \"rails-1\",\n+\t\tExtraInfo: map[string][]byte{\n+\t\t\t\"bzr-owner\": []byte(`\"ace\"`),\n+\t\t},\n+\t}, entity2...)\n+\ts.insertEntity(c, &mongodoc.Entity{\n+\t\tURL:      id6,\n+\t\tBlobHash: \"django-2\",\n+\t\tExtraInfo: map[string][]byte{\n+\t\t\t\"bzr-owner\": []byte(`\"who\"`),\n+\t\t},\n+\t}, entity2...)\n+\n+\ts.insertBaseEntity(c, &mongodoc.BaseEntity{URL: baseURL(id1)}, baseEntity2...)\n+\ts.insertBaseEntity(c, &mongodoc.BaseEntity{URL: baseURL(id2)}, baseEntity2...)\n+\ts.insertBaseEntity(c, &mongodoc.BaseEntity{URL: baseURL(id3)}, baseEntity2...)\n+\ts.insertBaseEntity(c, &mongodoc.BaseEntity{URL: baseURL(id4)}, baseEntity2...)\n+\ts.insertBaseEntity(c, &mongodoc.BaseEntity{URL: baseURL(id5)}, baseEntity2...)\n+\n+\t// Start the server.\n+\terr := s.newServer(c)\n+\tc.Assert(err, gc.IsNil)\n+\n+\t// Ensure entities have been updated correctly.\n+\ts.checkCount(c, s.db.Entities(), 5)\n+\ts.checkEntity(c, &mongodoc.Entity{\n+\t\tURL:                 id2,\n+\t\tBaseURL:             baseURL(id2),\n+\t\tBlobHash:            \"rails-1\",\n+\t\tUser:                id2.User,\n+\t\tName:                id2.Name,\n+\t\tRevision:            id2.Revision,\n+\t\tSeries:              id2.Series,\n+\t\tPromulgatedRevision: -1,\n+\t\tExtraInfo: map[string][]byte{\n+\t\t\t\"bzr-owner\": []byte(`\"who\"`),\n+\t\t},\n+\t})\n+\ts.checkEntity(c, &mongodoc.Entity{\n+\t\tURL:                 id3,\n+\t\tBaseURL:             baseURL(id3),\n+\t\tBlobHash:            \"django-1\",\n+\t\tUser:                id3.User,\n+\t\tName:                id3.Name,\n+\t\tRevision:            id3.Revision,\n+\t\tSeries:              id3.Series,\n+\t\tPromulgatedURL:      id1,\n+\t\tPromulgatedRevision: id1.Revision,\n+\t\tExtraInfo: map[string][]byte{\n+\t\t\t\"bzr-owner\": []byte(`\"who\"`),\n+\t\t}})\n+\ts.checkEntity(c, &mongodoc.Entity{\n+\t\tURL:                 id4,\n+\t\tBaseURL:             baseURL(id4),\n+\t\tBlobHash:            \"django-1\",\n+\t\tUser:                id4.User,\n+\t\tName:                id4.Name,\n+\t\tRevision:            id4.Revision,\n+\t\tSeries:              id4.Series,\n+\t\tPromulgatedRevision: -1,\n+\t\tExtraInfo: map[string][]byte{\n+\t\t\t\"bzr-owner\": []byte(`\"dalek\"`),\n+\t\t},\n+\t})\n+\ts.checkEntity(c, &mongodoc.Entity{\n+\t\tURL:                 id5,\n+\t\tBaseURL:             baseURL(id5),\n+\t\tBlobHash:            \"rails-1\",\n+\t\tUser:                id5.User,\n+\t\tName:                id5.Name,\n+\t\tRevision:            id5.Revision,\n+\t\tSeries:              id5.Series,\n+\t\tPromulgatedRevision: -1,\n+\t\tExtraInfo: map[string][]byte{\n+\t\t\t\"bzr-owner\": []byte(`\"ace\"`),\n+\t\t},\n+\t})\n+\ts.checkEntity(c, &mongodoc.Entity{\n+\t\tURL:                 id6,\n+\t\tBaseURL:             baseURL(id6),\n+\t\tBlobHash:            \"django-2\",\n+\t\tUser:                id6.User,\n+\t\tName:                id6.Name,\n+\t\tRevision:            id6.Revision,\n+\t\tSeries:              id6.Series,\n+\t\tPromulgatedRevision: -1,\n+\t\tExtraInfo: map[string][]byte{\n+\t\t\t\"bzr-owner\": []byte(`\"who\"`),\n+\t\t},\n+\t})\n+\n+\ts.checkCount(c, s.db.BaseEntities(), 4)\n+\ts.checkBaseEntity(c, &mongodoc.BaseEntity{\n+\t\tURL:         baseURL(id2),\n+\t\tUser:        id2.User,\n+\t\tName:        id2.Name,\n+\t\tPublic:      true,\n+\t\tACLs:        mongodoc.ACL{},\n+\t\tPromulgated: mongodoc.False,\n+\t})\n+\ts.checkBaseEntity(c, &mongodoc.BaseEntity{\n+\t\tURL:         baseURL(id3),\n+\t\tUser:        id3.User,\n+\t\tName:        id3.Name,\n+\t\tPublic:      true,\n+\t\tACLs:        mongodoc.ACL{},\n+\t\tPromulgated: mongodoc.True,","path":"internal/charmstore/migrations_test.go","position":480,"original_position":480,"commit_id":"96e8ca08fcd2f4f2db6b75154988bb10d9d4b929","original_commit_id":"96e8ca08fcd2f4f2db6b75154988bb10d9d4b929","user":{"login":"mhilton","id":1136018,"avatar_url":"https://avatars.githubusercontent.com/u/1136018?v=3","gravatar_id":"","url":"https://api.github.com/users/mhilton","html_url":"https://github.com/mhilton","followers_url":"https://api.github.com/users/mhilton/followers","following_url":"https://api.github.com/users/mhilton/following{/other_user}","gists_url":"https://api.github.com/users/mhilton/gists{/gist_id}","starred_url":"https://api.github.com/users/mhilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhilton/subscriptions","organizations_url":"https://api.github.com/users/mhilton/orgs","repos_url":"https://api.github.com/users/mhilton/repos","events_url":"https://api.github.com/users/mhilton/events{/privacy}","received_events_url":"https://api.github.com/users/mhilton/received_events","type":"User","site_admin":false},"body":"done.","created_at":"2015-02-26T09:28:48Z","updated_at":"2015-02-26T09:28:48Z","html_url":"https://github.com/juju/charmstore/pull/299#discussion_r25413954","pull_request_url":"https://api.github.com/repos/juju/charmstore/pulls/299","_links":{"self":{"href":"https://api.github.com/repos/juju/charmstore/pulls/comments/25413954"},"html":{"href":"https://github.com/juju/charmstore/pull/299#discussion_r25413954"},"pull_request":{"href":"https://api.github.com/repos/juju/charmstore/pulls/299"}}},"pull_request":{"url":"https://api.github.com/repos/juju/charmstore/pulls/299","id":29834338,"html_url":"https://github.com/juju/charmstore/pull/299","diff_url":"https://github.com/juju/charmstore/pull/299.diff","patch_url":"https://github.com/juju/charmstore/pull/299.patch","issue_url":"https://api.github.com/repos/juju/charmstore/issues/299","number":299,"state":"open","locked":false,"title":"Change to promulgation model.","user":{"login":"mhilton","id":1136018,"avatar_url":"https://avatars.githubusercontent.com/u/1136018?v=3","gravatar_id":"","url":"https://api.github.com/users/mhilton","html_url":"https://github.com/mhilton","followers_url":"https://api.github.com/users/mhilton/followers","following_url":"https://api.github.com/users/mhilton/following{/other_user}","gists_url":"https://api.github.com/users/mhilton/gists{/gist_id}","starred_url":"https://api.github.com/users/mhilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhilton/subscriptions","organizations_url":"https://api.github.com/users/mhilton/orgs","repos_url":"https://api.github.com/users/mhilton/repos","events_url":"https://api.github.com/users/mhilton/events{/privacy}","received_events_url":"https://api.github.com/users/mhilton/received_events","type":"User","site_admin":false},"body":"Changes to use the new promulgation model. This includes:\r\n\r\n * Updated insertion logic\r\n * Updated query logic\r\n * Updates to tests where necessary","created_at":"2015-02-23T18:49:50Z","updated_at":"2015-02-26T09:28:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"84df978d4ee7efde87bd7aa75abe5cb19c9ed634","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/juju/charmstore/pulls/299/commits","review_comments_url":"https://api.github.com/repos/juju/charmstore/pulls/299/comments","review_comment_url":"https://api.github.com/repos/juju/charmstore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/juju/charmstore/issues/299/comments","statuses_url":"https://api.github.com/repos/juju/charmstore/statuses/96e8ca08fcd2f4f2db6b75154988bb10d9d4b929","head":{"label":"mhilton:promulgation-model","ref":"promulgation-model","sha":"96e8ca08fcd2f4f2db6b75154988bb10d9d4b929","user":{"login":"mhilton","id":1136018,"avatar_url":"https://avatars.githubusercontent.com/u/1136018?v=3","gravatar_id":"","url":"https://api.github.com/users/mhilton","html_url":"https://github.com/mhilton","followers_url":"https://api.github.com/users/mhilton/followers","following_url":"https://api.github.com/users/mhilton/following{/other_user}","gists_url":"https://api.github.com/users/mhilton/gists{/gist_id}","starred_url":"https://api.github.com/users/mhilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhilton/subscriptions","organizations_url":"https://api.github.com/users/mhilton/orgs","repos_url":"https://api.github.com/users/mhilton/repos","events_url":"https://api.github.com/users/mhilton/events{/privacy}","received_events_url":"https://api.github.com/users/mhilton/received_events","type":"User","site_admin":false},"repo":{"id":24229515,"name":"charmstore","full_name":"mhilton/charmstore","owner":{"login":"mhilton","id":1136018,"avatar_url":"https://avatars.githubusercontent.com/u/1136018?v=3","gravatar_id":"","url":"https://api.github.com/users/mhilton","html_url":"https://github.com/mhilton","followers_url":"https://api.github.com/users/mhilton/followers","following_url":"https://api.github.com/users/mhilton/following{/other_user}","gists_url":"https://api.github.com/users/mhilton/gists{/gist_id}","starred_url":"https://api.github.com/users/mhilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhilton/subscriptions","organizations_url":"https://api.github.com/users/mhilton/orgs","repos_url":"https://api.github.com/users/mhilton/repos","events_url":"https://api.github.com/users/mhilton/events{/privacy}","received_events_url":"https://api.github.com/users/mhilton/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mhilton/charmstore","description":"The charm store server.","fork":true,"url":"https://api.github.com/repos/mhilton/charmstore","forks_url":"https://api.github.com/repos/mhilton/charmstore/forks","keys_url":"https://api.github.com/repos/mhilton/charmstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mhilton/charmstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mhilton/charmstore/teams","hooks_url":"https://api.github.com/repos/mhilton/charmstore/hooks","issue_events_url":"https://api.github.com/repos/mhilton/charmstore/issues/events{/number}","events_url":"https://api.github.com/repos/mhilton/charmstore/events","assignees_url":"https://api.github.com/repos/mhilton/charmstore/assignees{/user}","branches_url":"https://api.github.com/repos/mhilton/charmstore/branches{/branch}","tags_url":"https://api.github.com/repos/mhilton/charmstore/tags","blobs_url":"https://api.github.com/repos/mhilton/charmstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mhilton/charmstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mhilton/charmstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/mhilton/charmstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mhilton/charmstore/statuses/{sha}","languages_url":"https://api.github.com/repos/mhilton/charmstore/languages","stargazers_url":"https://api.github.com/repos/mhilton/charmstore/stargazers","contributors_url":"https://api.github.com/repos/mhilton/charmstore/contributors","subscribers_url":"https://api.github.com/repos/mhilton/charmstore/subscribers","subscription_url":"https://api.github.com/repos/mhilton/charmstore/subscription","commits_url":"https://api.github.com/repos/mhilton/charmstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/mhilton/charmstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/mhilton/charmstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/mhilton/charmstore/issues/comments{/number}","contents_url":"https://api.github.com/repos/mhilton/charmstore/contents/{+path}","compare_url":"https://api.github.com/repos/mhilton/charmstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mhilton/charmstore/merges","archive_url":"https://api.github.com/repos/mhilton/charmstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mhilton/charmstore/downloads","issues_url":"https://api.github.com/repos/mhilton/charmstore/issues{/number}","pulls_url":"https://api.github.com/repos/mhilton/charmstore/pulls{/number}","milestones_url":"https://api.github.com/repos/mhilton/charmstore/milestones{/number}","notifications_url":"https://api.github.com/repos/mhilton/charmstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mhilton/charmstore/labels{/name}","releases_url":"https://api.github.com/repos/mhilton/charmstore/releases{/id}","created_at":"2014-09-19T12:48:28Z","updated_at":"2014-12-08T12:52:10Z","pushed_at":"2015-02-25T09:58:37Z","git_url":"git://github.com/mhilton/charmstore.git","ssh_url":"git@github.com:mhilton/charmstore.git","clone_url":"https://github.com/mhilton/charmstore.git","svn_url":"https://github.com/mhilton/charmstore","homepage":null,"size":2300,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"v4"}},"base":{"label":"juju:v4","ref":"v4","sha":"a53a7bde2f1c88e6ecc27426ec069404f6dbdd44","user":{"login":"juju","id":4604548,"avatar_url":"https://avatars.githubusercontent.com/u/4604548?v=3","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"repo":{"id":20720417,"name":"charmstore","full_name":"juju/charmstore","owner":{"login":"juju","id":4604548,"avatar_url":"https://avatars.githubusercontent.com/u/4604548?v=3","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/juju/charmstore","description":"The charm store server.","fork":false,"url":"https://api.github.com/repos/juju/charmstore","forks_url":"https://api.github.com/repos/juju/charmstore/forks","keys_url":"https://api.github.com/repos/juju/charmstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juju/charmstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juju/charmstore/teams","hooks_url":"https://api.github.com/repos/juju/charmstore/hooks","issue_events_url":"https://api.github.com/repos/juju/charmstore/issues/events{/number}","events_url":"https://api.github.com/repos/juju/charmstore/events","assignees_url":"https://api.github.com/repos/juju/charmstore/assignees{/user}","branches_url":"https://api.github.com/repos/juju/charmstore/branches{/branch}","tags_url":"https://api.github.com/repos/juju/charmstore/tags","blobs_url":"https://api.github.com/repos/juju/charmstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juju/charmstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juju/charmstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/juju/charmstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juju/charmstore/statuses/{sha}","languages_url":"https://api.github.com/repos/juju/charmstore/languages","stargazers_url":"https://api.github.com/repos/juju/charmstore/stargazers","contributors_url":"https://api.github.com/repos/juju/charmstore/contributors","subscribers_url":"https://api.github.com/repos/juju/charmstore/subscribers","subscription_url":"https://api.github.com/repos/juju/charmstore/subscription","commits_url":"https://api.github.com/repos/juju/charmstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/juju/charmstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/juju/charmstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/juju/charmstore/issues/comments{/number}","contents_url":"https://api.github.com/repos/juju/charmstore/contents/{+path}","compare_url":"https://api.github.com/repos/juju/charmstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juju/charmstore/merges","archive_url":"https://api.github.com/repos/juju/charmstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juju/charmstore/downloads","issues_url":"https://api.github.com/repos/juju/charmstore/issues{/number}","pulls_url":"https://api.github.com/repos/juju/charmstore/pulls{/number}","milestones_url":"https://api.github.com/repos/juju/charmstore/milestones{/number}","notifications_url":"https://api.github.com/repos/juju/charmstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juju/charmstore/labels{/name}","releases_url":"https://api.github.com/repos/juju/charmstore/releases{/id}","created_at":"2014-06-11T09:53:37Z","updated_at":"2015-02-26T03:13:10Z","pushed_at":"2015-02-25T18:50:28Z","git_url":"git://github.com/juju/charmstore.git","ssh_url":"git@github.com:juju/charmstore.git","clone_url":"https://github.com/juju/charmstore.git","svn_url":"https://github.com/juju/charmstore","homepage":null,"size":3678,"stargazers_count":6,"watchers_count":6,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":6,"forks":13,"open_issues":6,"watchers":6,"default_branch":"v4"}},"_links":{"self":{"href":"https://api.github.com/repos/juju/charmstore/pulls/299"},"html":{"href":"https://github.com/juju/charmstore/pull/299"},"issue":{"href":"https://api.github.com/repos/juju/charmstore/issues/299"},"comments":{"href":"https://api.github.com/repos/juju/charmstore/issues/299/comments"},"review_comments":{"href":"https://api.github.com/repos/juju/charmstore/pulls/299/comments"},"review_comment":{"href":"https://api.github.com/repos/juju/charmstore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/juju/charmstore/pulls/299/commits"},"statuses":{"href":"https://api.github.com/repos/juju/charmstore/statuses/96e8ca08fcd2f4f2db6b75154988bb10d9d4b929"}}}}