{"action":"created","comment":{"url":"https://api.github.com/repos/jimix/CDTDatastore/pulls/comments/28360391","id":28360391,"diff_hunk":"@@ -2208,6 +2221,75 @@ - (id)executeSaveRequest:(NSSaveChangesRequest *)saveRequest\n     return @[];\n }\n \n+- (id)executeBatchUpdateRequest:(NSBatchUpdateRequest *)updateRequest\n+                    withContext:(NSManagedObjectContext *)context\n+                          error:(NSError **)error\n+{\n+    NSError *err = nil;\n+\n+    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];\n+    fetchRequest.entity = updateRequest.entity;\n+    fetchRequest.predicate = updateRequest.predicate;\n+\n+    NSDictionary *query = [self queryForFetchRequest:fetchRequest error:&err];\n+\n+    if (!query) {\n+        if (error) *error = err;\n+        return nil;\n+    }\n+\n+    err = nil;\n+    CDTQueryResult *hits = [self.indexManager queryWithDictionary:query options:nil error:&err];\n+    // hits == nil is valid, get rid of this once tested\n+    if (!hits && err) {\n+        if (error) *error = err;\n+        return nil;\n+    }\n+\n+    // Note: This dictionary is *not* the same dictionary specified in the original request.\n+    // The keys have all been transformed from attribute names into NSAttributeDescriptions\n+    NSDictionary *updates = updateRequest.propertiesToUpdate;\n+\n+    NSEntityDescription *entity = [updateRequest entity];\n+\n+    NSMutableArray *results = [NSMutableArray array];\n+    for (CDTDocumentRevision *rev in hits) {\n+        NSManagedObjectID *moid = [self newObjectIDForEntity:entity referenceObject:rev.docId];\n+        NSManagedObject *mo = [context objectWithID:moid];\n+\n+        for (NSAttributeDescription *attr in [updates allKeys]) {\n+            id newValue = [updates[attr] constantValue];\n+            [mo setValue:newValue forKey:attr.name];\n+        }\n+\n+        if (![self updateManagedObject:mo error:&err]) {\n+            if (error) *error = err;\n+            return nil;\n+        }\n+\n+        [results addObject:moid];\n+    }\n+\n+    CDTISBatchUpdateResult *updateResult = [[CDTISBatchUpdateResult alloc] init];","path":"Classes/common/CDTIncrementalStore.m","position":80,"original_position":80,"commit_id":"1489fcc2992219f5e541e3acb28e229bde440f8b","original_commit_id":"1489fcc2992219f5e541e3acb28e229bde440f8b","user":{"login":"jimix","id":727026,"avatar_url":"https://avatars.githubusercontent.com/u/727026?v=3","gravatar_id":"","url":"https://api.github.com/users/jimix","html_url":"https://github.com/jimix","followers_url":"https://api.github.com/users/jimix/followers","following_url":"https://api.github.com/users/jimix/following{/other_user}","gists_url":"https://api.github.com/users/jimix/gists{/gist_id}","starred_url":"https://api.github.com/users/jimix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimix/subscriptions","organizations_url":"https://api.github.com/users/jimix/orgs","repos_url":"https://api.github.com/users/jimix/repos","events_url":"https://api.github.com/users/jimix/events{/privacy}","received_events_url":"https://api.github.com/users/jimix/received_events","type":"User","site_admin":false},"body":"new?","created_at":"2015-04-14T19:16:11Z","updated_at":"2015-04-14T19:16:11Z","html_url":"https://github.com/jimix/CDTDatastore/pull/36#discussion_r28360391","pull_request_url":"https://api.github.com/repos/jimix/CDTDatastore/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/jimix/CDTDatastore/pulls/comments/28360391"},"html":{"href":"https://github.com/jimix/CDTDatastore/pull/36#discussion_r28360391"},"pull_request":{"href":"https://api.github.com/repos/jimix/CDTDatastore/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/jimix/CDTDatastore/pulls/36","id":33212406,"html_url":"https://github.com/jimix/CDTDatastore/pull/36","diff_url":"https://github.com/jimix/CDTDatastore/pull/36.diff","patch_url":"https://github.com/jimix/CDTDatastore/pull/36.patch","issue_url":"https://api.github.com/repos/jimix/CDTDatastore/issues/36","number":36,"state":"open","locked":false,"title":"Support for batch update requests","user":{"login":"mkistler","id":800728,"avatar_url":"https://avatars.githubusercontent.com/u/800728?v=3","gravatar_id":"","url":"https://api.github.com/users/mkistler","html_url":"https://github.com/mkistler","followers_url":"https://api.github.com/users/mkistler/followers","following_url":"https://api.github.com/users/mkistler/following{/other_user}","gists_url":"https://api.github.com/users/mkistler/gists{/gist_id}","starred_url":"https://api.github.com/users/mkistler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkistler/subscriptions","organizations_url":"https://api.github.com/users/mkistler/orgs","repos_url":"https://api.github.com/users/mkistler/repos","events_url":"https://api.github.com/users/mkistler/events{/privacy}","received_events_url":"https://api.github.com/users/mkistler/received_events","type":"User","site_admin":false},"body":"Resolves issue #30.","created_at":"2015-04-13T23:05:41Z","updated_at":"2015-04-14T19:16:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bd8913f0045b8b94c77119238bf77fef3326e9ad","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jimix/CDTDatastore/pulls/36/commits","review_comments_url":"https://api.github.com/repos/jimix/CDTDatastore/pulls/36/comments","review_comment_url":"https://api.github.com/repos/jimix/CDTDatastore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jimix/CDTDatastore/issues/36/comments","statuses_url":"https://api.github.com/repos/jimix/CDTDatastore/statuses/1489fcc2992219f5e541e3acb28e229bde440f8b","head":{"label":"jimix:mdk/batchupdate","ref":"mdk/batchupdate","sha":"1489fcc2992219f5e541e3acb28e229bde440f8b","user":{"login":"jimix","id":727026,"avatar_url":"https://avatars.githubusercontent.com/u/727026?v=3","gravatar_id":"","url":"https://api.github.com/users/jimix","html_url":"https://github.com/jimix","followers_url":"https://api.github.com/users/jimix/followers","following_url":"https://api.github.com/users/jimix/following{/other_user}","gists_url":"https://api.github.com/users/jimix/gists{/gist_id}","starred_url":"https://api.github.com/users/jimix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimix/subscriptions","organizations_url":"https://api.github.com/users/jimix/orgs","repos_url":"https://api.github.com/users/jimix/repos","events_url":"https://api.github.com/users/jimix/events{/privacy}","received_events_url":"https://api.github.com/users/jimix/received_events","type":"User","site_admin":false},"repo":{"id":28232724,"name":"CDTDatastore","full_name":"jimix/CDTDatastore","owner":{"login":"jimix","id":727026,"avatar_url":"https://avatars.githubusercontent.com/u/727026?v=3","gravatar_id":"","url":"https://api.github.com/users/jimix","html_url":"https://github.com/jimix","followers_url":"https://api.github.com/users/jimix/followers","following_url":"https://api.github.com/users/jimix/following{/other_user}","gists_url":"https://api.github.com/users/jimix/gists{/gist_id}","starred_url":"https://api.github.com/users/jimix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimix/subscriptions","organizations_url":"https://api.github.com/users/jimix/orgs","repos_url":"https://api.github.com/users/jimix/repos","events_url":"https://api.github.com/users/jimix/events{/privacy}","received_events_url":"https://api.github.com/users/jimix/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jimix/CDTDatastore","description":"Cloudant Sync iOS datastore library. See CDTDatastore/doc/coredata.md","fork":true,"url":"https://api.github.com/repos/jimix/CDTDatastore","forks_url":"https://api.github.com/repos/jimix/CDTDatastore/forks","keys_url":"https://api.github.com/repos/jimix/CDTDatastore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jimix/CDTDatastore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jimix/CDTDatastore/teams","hooks_url":"https://api.github.com/repos/jimix/CDTDatastore/hooks","issue_events_url":"https://api.github.com/repos/jimix/CDTDatastore/issues/events{/number}","events_url":"https://api.github.com/repos/jimix/CDTDatastore/events","assignees_url":"https://api.github.com/repos/jimix/CDTDatastore/assignees{/user}","branches_url":"https://api.github.com/repos/jimix/CDTDatastore/branches{/branch}","tags_url":"https://api.github.com/repos/jimix/CDTDatastore/tags","blobs_url":"https://api.github.com/repos/jimix/CDTDatastore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jimix/CDTDatastore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jimix/CDTDatastore/git/refs{/sha}","trees_url":"https://api.github.com/repos/jimix/CDTDatastore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jimix/CDTDatastore/statuses/{sha}","languages_url":"https://api.github.com/repos/jimix/CDTDatastore/languages","stargazers_url":"https://api.github.com/repos/jimix/CDTDatastore/stargazers","contributors_url":"https://api.github.com/repos/jimix/CDTDatastore/contributors","subscribers_url":"https://api.github.com/repos/jimix/CDTDatastore/subscribers","subscription_url":"https://api.github.com/repos/jimix/CDTDatastore/subscription","commits_url":"https://api.github.com/repos/jimix/CDTDatastore/commits{/sha}","git_commits_url":"https://api.github.com/repos/jimix/CDTDatastore/git/commits{/sha}","comments_url":"https://api.github.com/repos/jimix/CDTDatastore/comments{/number}","issue_comment_url":"https://api.github.com/repos/jimix/CDTDatastore/issues/comments{/number}","contents_url":"https://api.github.com/repos/jimix/CDTDatastore/contents/{+path}","compare_url":"https://api.github.com/repos/jimix/CDTDatastore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jimix/CDTDatastore/merges","archive_url":"https://api.github.com/repos/jimix/CDTDatastore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jimix/CDTDatastore/downloads","issues_url":"https://api.github.com/repos/jimix/CDTDatastore/issues{/number}","pulls_url":"https://api.github.com/repos/jimix/CDTDatastore/pulls{/number}","milestones_url":"https://api.github.com/repos/jimix/CDTDatastore/milestones{/number}","notifications_url":"https://api.github.com/repos/jimix/CDTDatastore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jimix/CDTDatastore/labels{/name}","releases_url":"https://api.github.com/repos/jimix/CDTDatastore/releases{/id}","created_at":"2014-12-19T14:34:30Z","updated_at":"2015-03-31T22:27:39Z","pushed_at":"2015-04-13T23:05:41Z","git_url":"git://github.com/jimix/CDTDatastore.git","ssh_url":"git@github.com:jimix/CDTDatastore.git","clone_url":"https://github.com/jimix/CDTDatastore.git","svn_url":"https://github.com/jimix/CDTDatastore","homepage":"","size":2925,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"CDTIncrementalStore"}},"base":{"label":"jimix:jimix/CDTIncrementalStore","ref":"jimix/CDTIncrementalStore","sha":"669b512d19ae1dc284801273c5e5aeac19eb1580","user":{"login":"jimix","id":727026,"avatar_url":"https://avatars.githubusercontent.com/u/727026?v=3","gravatar_id":"","url":"https://api.github.com/users/jimix","html_url":"https://github.com/jimix","followers_url":"https://api.github.com/users/jimix/followers","following_url":"https://api.github.com/users/jimix/following{/other_user}","gists_url":"https://api.github.com/users/jimix/gists{/gist_id}","starred_url":"https://api.github.com/users/jimix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimix/subscriptions","organizations_url":"https://api.github.com/users/jimix/orgs","repos_url":"https://api.github.com/users/jimix/repos","events_url":"https://api.github.com/users/jimix/events{/privacy}","received_events_url":"https://api.github.com/users/jimix/received_events","type":"User","site_admin":false},"repo":{"id":28232724,"name":"CDTDatastore","full_name":"jimix/CDTDatastore","owner":{"login":"jimix","id":727026,"avatar_url":"https://avatars.githubusercontent.com/u/727026?v=3","gravatar_id":"","url":"https://api.github.com/users/jimix","html_url":"https://github.com/jimix","followers_url":"https://api.github.com/users/jimix/followers","following_url":"https://api.github.com/users/jimix/following{/other_user}","gists_url":"https://api.github.com/users/jimix/gists{/gist_id}","starred_url":"https://api.github.com/users/jimix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimix/subscriptions","organizations_url":"https://api.github.com/users/jimix/orgs","repos_url":"https://api.github.com/users/jimix/repos","events_url":"https://api.github.com/users/jimix/events{/privacy}","received_events_url":"https://api.github.com/users/jimix/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jimix/CDTDatastore","description":"Cloudant Sync iOS datastore library. See CDTDatastore/doc/coredata.md","fork":true,"url":"https://api.github.com/repos/jimix/CDTDatastore","forks_url":"https://api.github.com/repos/jimix/CDTDatastore/forks","keys_url":"https://api.github.com/repos/jimix/CDTDatastore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jimix/CDTDatastore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jimix/CDTDatastore/teams","hooks_url":"https://api.github.com/repos/jimix/CDTDatastore/hooks","issue_events_url":"https://api.github.com/repos/jimix/CDTDatastore/issues/events{/number}","events_url":"https://api.github.com/repos/jimix/CDTDatastore/events","assignees_url":"https://api.github.com/repos/jimix/CDTDatastore/assignees{/user}","branches_url":"https://api.github.com/repos/jimix/CDTDatastore/branches{/branch}","tags_url":"https://api.github.com/repos/jimix/CDTDatastore/tags","blobs_url":"https://api.github.com/repos/jimix/CDTDatastore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jimix/CDTDatastore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jimix/CDTDatastore/git/refs{/sha}","trees_url":"https://api.github.com/repos/jimix/CDTDatastore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jimix/CDTDatastore/statuses/{sha}","languages_url":"https://api.github.com/repos/jimix/CDTDatastore/languages","stargazers_url":"https://api.github.com/repos/jimix/CDTDatastore/stargazers","contributors_url":"https://api.github.com/repos/jimix/CDTDatastore/contributors","subscribers_url":"https://api.github.com/repos/jimix/CDTDatastore/subscribers","subscription_url":"https://api.github.com/repos/jimix/CDTDatastore/subscription","commits_url":"https://api.github.com/repos/jimix/CDTDatastore/commits{/sha}","git_commits_url":"https://api.github.com/repos/jimix/CDTDatastore/git/commits{/sha}","comments_url":"https://api.github.com/repos/jimix/CDTDatastore/comments{/number}","issue_comment_url":"https://api.github.com/repos/jimix/CDTDatastore/issues/comments{/number}","contents_url":"https://api.github.com/repos/jimix/CDTDatastore/contents/{+path}","compare_url":"https://api.github.com/repos/jimix/CDTDatastore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jimix/CDTDatastore/merges","archive_url":"https://api.github.com/repos/jimix/CDTDatastore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jimix/CDTDatastore/downloads","issues_url":"https://api.github.com/repos/jimix/CDTDatastore/issues{/number}","pulls_url":"https://api.github.com/repos/jimix/CDTDatastore/pulls{/number}","milestones_url":"https://api.github.com/repos/jimix/CDTDatastore/milestones{/number}","notifications_url":"https://api.github.com/repos/jimix/CDTDatastore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jimix/CDTDatastore/labels{/name}","releases_url":"https://api.github.com/repos/jimix/CDTDatastore/releases{/id}","created_at":"2014-12-19T14:34:30Z","updated_at":"2015-03-31T22:27:39Z","pushed_at":"2015-04-13T23:05:41Z","git_url":"git://github.com/jimix/CDTDatastore.git","ssh_url":"git@github.com:jimix/CDTDatastore.git","clone_url":"https://github.com/jimix/CDTDatastore.git","svn_url":"https://github.com/jimix/CDTDatastore","homepage":"","size":2925,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"CDTIncrementalStore"}},"_links":{"self":{"href":"https://api.github.com/repos/jimix/CDTDatastore/pulls/36"},"html":{"href":"https://github.com/jimix/CDTDatastore/pull/36"},"issue":{"href":"https://api.github.com/repos/jimix/CDTDatastore/issues/36"},"comments":{"href":"https://api.github.com/repos/jimix/CDTDatastore/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/jimix/CDTDatastore/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/jimix/CDTDatastore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jimix/CDTDatastore/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/jimix/CDTDatastore/statuses/1489fcc2992219f5e541e3acb28e229bde440f8b"}}}}