{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/WinObjC/pulls/comments/75724673","id":75724673,"diff_hunk":"@@ -0,0 +1,114 @@\n+//******************************************************************************\n+//\n+// Copyright (c) 2016 Microsoft Corporation. All rights reserved.\n+//\n+// This code is licensed under the MIT License (MIT).\n+//\n+// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+// THE SOFTWARE.\n+//\n+//******************************************************************************\n+\n+#import <Foundation/NSUndoManager.h>\n+#import \"_NSUndoGroup.h\"\n+#import \"_NSUndoCall.h\"\n+\n+@implementation _NSUndoGroup : _NSUndoObject\n+\n+- (id)initWithLevel:(NSUInteger)level {\n+    if (self = [super init]) {\n+        _undoGrouping = [NSMutableArray array];\n+        _undoLevel = level;\n+        _isClosed = NO;\n+    }\n+    return self;\n+}\n+\n+- (id)initWithOwner:(NSUndoManager*)manager {\n+    if (self = [self initWithLevel:0]) {\n+        _owningManager = manager;\n+    }\n+    return self;\n+}\n+\n+- (void)addUndoCallToUndoGroup:(_NSUndoCall*)undoCall {\n+    _NSUndoObject* topObjectInGroup = [_undoGrouping firstObject];\n+    if ([topObjectInGroup isKindOfClass:[_NSUndoGroup class]] && ![topObjectInGroup isClosed]) {\n+        [topObjectInGroup addUndoCallToUndoGroup:undoCall];\n+    }\n+    [_undoGrouping insertObject:undoCall atIndex:0];\n+}\n+\n+- (void)callUndoGroup {\n+    while ([_undoGrouping count] > 0) {\n+        _NSUndoObject* object = [_undoGrouping firstObject];\n+        if ([object isKindOfClass:[_NSUndoGroup class]]) {\n+            [_owningManager callNestedGroup];","path":"Frameworks/Foundation/_NSUndoGroup.mm","position":51,"original_position":51,"commit_id":"3a772426a6e48a864ade43e61202168aab318835","original_commit_id":"3a772426a6e48a864ade43e61202168aab318835","user":{"login":"DHowett-MSFT","id":14316954,"avatar_url":"https://avatars.githubusercontent.com/u/14316954?v=3","gravatar_id":"","url":"https://api.github.com/users/DHowett-MSFT","html_url":"https://github.com/DHowett-MSFT","followers_url":"https://api.github.com/users/DHowett-MSFT/followers","following_url":"https://api.github.com/users/DHowett-MSFT/following{/other_user}","gists_url":"https://api.github.com/users/DHowett-MSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/DHowett-MSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DHowett-MSFT/subscriptions","organizations_url":"https://api.github.com/users/DHowett-MSFT/orgs","repos_url":"https://api.github.com/users/DHowett-MSFT/repos","events_url":"https://api.github.com/users/DHowett-MSFT/events{/privacy}","received_events_url":"https://api.github.com/users/DHowett-MSFT/received_events","type":"User","site_admin":false},"body":"If you make all of these conform to an internal interface such as `_NSUndoing`, you don't need to switch on the class.\r\n\r\n`_NSUndoGroup`'s implementation of `_NSUndoing` would just call the `_NSUndoing` implementation on every one of its subjugates.\r\n\r\nWith Objective-C, class checking is a code smell.","created_at":"2016-08-22T17:50:19Z","updated_at":"2016-08-22T17:50:19Z","html_url":"https://github.com/Microsoft/WinObjC/pull/900#discussion_r75724673","pull_request_url":"https://api.github.com/repos/Microsoft/WinObjC/pulls/900","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/WinObjC/pulls/comments/75724673"},"html":{"href":"https://github.com/Microsoft/WinObjC/pull/900#discussion_r75724673"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/WinObjC/pulls/900"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/WinObjC/pulls/900","id":82067401,"html_url":"https://github.com/Microsoft/WinObjC/pull/900","diff_url":"https://github.com/Microsoft/WinObjC/pull/900.diff","patch_url":"https://github.com/Microsoft/WinObjC/pull/900.patch","issue_url":"https://api.github.com/repos/Microsoft/WinObjC/issues/900","number":900,"state":"open","locked":false,"title":"NSUndoManager - Basic Undo/Redo Actions","user":{"login":"MSFTFox","id":17168010,"avatar_url":"https://avatars.githubusercontent.com/u/17168010?v=3","gravatar_id":"","url":"https://api.github.com/users/MSFTFox","html_url":"https://github.com/MSFTFox","followers_url":"https://api.github.com/users/MSFTFox/followers","following_url":"https://api.github.com/users/MSFTFox/following{/other_user}","gists_url":"https://api.github.com/users/MSFTFox/gists{/gist_id}","starred_url":"https://api.github.com/users/MSFTFox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSFTFox/subscriptions","organizations_url":"https://api.github.com/users/MSFTFox/orgs","repos_url":"https://api.github.com/users/MSFTFox/repos","events_url":"https://api.github.com/users/MSFTFox/events{/privacy}","received_events_url":"https://api.github.com/users/MSFTFox/received_events","type":"User","site_admin":false},"body":"Implement basic undo and redo operations for NSUndoManager with simple top level Undo Grouping.\r\n\r\nVerified by new unit tests.\r\n\r\nFix #808","created_at":"2016-08-20T03:24:06Z","updated_at":"2016-08-22T17:50:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"821e5a771c0248fd12fd25189276e72f858a7672","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/WinObjC/pulls/900/commits","review_comments_url":"https://api.github.com/repos/Microsoft/WinObjC/pulls/900/comments","review_comment_url":"https://api.github.com/repos/Microsoft/WinObjC/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/WinObjC/issues/900/comments","statuses_url":"https://api.github.com/repos/Microsoft/WinObjC/statuses/3a772426a6e48a864ade43e61202168aab318835","head":{"label":"MSFTFox:henryfox/Undo","ref":"henryfox/Undo","sha":"3a772426a6e48a864ade43e61202168aab318835","user":{"login":"MSFTFox","id":17168010,"avatar_url":"https://avatars.githubusercontent.com/u/17168010?v=3","gravatar_id":"","url":"https://api.github.com/users/MSFTFox","html_url":"https://github.com/MSFTFox","followers_url":"https://api.github.com/users/MSFTFox/followers","following_url":"https://api.github.com/users/MSFTFox/following{/other_user}","gists_url":"https://api.github.com/users/MSFTFox/gists{/gist_id}","starred_url":"https://api.github.com/users/MSFTFox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSFTFox/subscriptions","organizations_url":"https://api.github.com/users/MSFTFox/orgs","repos_url":"https://api.github.com/users/MSFTFox/repos","events_url":"https://api.github.com/users/MSFTFox/events{/privacy}","received_events_url":"https://api.github.com/users/MSFTFox/received_events","type":"User","site_admin":false},"repo":{"id":63458119,"name":"WinObjC","full_name":"MSFTFox/WinObjC","owner":{"login":"MSFTFox","id":17168010,"avatar_url":"https://avatars.githubusercontent.com/u/17168010?v=3","gravatar_id":"","url":"https://api.github.com/users/MSFTFox","html_url":"https://github.com/MSFTFox","followers_url":"https://api.github.com/users/MSFTFox/followers","following_url":"https://api.github.com/users/MSFTFox/following{/other_user}","gists_url":"https://api.github.com/users/MSFTFox/gists{/gist_id}","starred_url":"https://api.github.com/users/MSFTFox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSFTFox/subscriptions","organizations_url":"https://api.github.com/users/MSFTFox/orgs","repos_url":"https://api.github.com/users/MSFTFox/repos","events_url":"https://api.github.com/users/MSFTFox/events{/privacy}","received_events_url":"https://api.github.com/users/MSFTFox/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MSFTFox/WinObjC","description":"Objective-C for Windows","fork":true,"url":"https://api.github.com/repos/MSFTFox/WinObjC","forks_url":"https://api.github.com/repos/MSFTFox/WinObjC/forks","keys_url":"https://api.github.com/repos/MSFTFox/WinObjC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MSFTFox/WinObjC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MSFTFox/WinObjC/teams","hooks_url":"https://api.github.com/repos/MSFTFox/WinObjC/hooks","issue_events_url":"https://api.github.com/repos/MSFTFox/WinObjC/issues/events{/number}","events_url":"https://api.github.com/repos/MSFTFox/WinObjC/events","assignees_url":"https://api.github.com/repos/MSFTFox/WinObjC/assignees{/user}","branches_url":"https://api.github.com/repos/MSFTFox/WinObjC/branches{/branch}","tags_url":"https://api.github.com/repos/MSFTFox/WinObjC/tags","blobs_url":"https://api.github.com/repos/MSFTFox/WinObjC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MSFTFox/WinObjC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MSFTFox/WinObjC/git/refs{/sha}","trees_url":"https://api.github.com/repos/MSFTFox/WinObjC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MSFTFox/WinObjC/statuses/{sha}","languages_url":"https://api.github.com/repos/MSFTFox/WinObjC/languages","stargazers_url":"https://api.github.com/repos/MSFTFox/WinObjC/stargazers","contributors_url":"https://api.github.com/repos/MSFTFox/WinObjC/contributors","subscribers_url":"https://api.github.com/repos/MSFTFox/WinObjC/subscribers","subscription_url":"https://api.github.com/repos/MSFTFox/WinObjC/subscription","commits_url":"https://api.github.com/repos/MSFTFox/WinObjC/commits{/sha}","git_commits_url":"https://api.github.com/repos/MSFTFox/WinObjC/git/commits{/sha}","comments_url":"https://api.github.com/repos/MSFTFox/WinObjC/comments{/number}","issue_comment_url":"https://api.github.com/repos/MSFTFox/WinObjC/issues/comments{/number}","contents_url":"https://api.github.com/repos/MSFTFox/WinObjC/contents/{+path}","compare_url":"https://api.github.com/repos/MSFTFox/WinObjC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MSFTFox/WinObjC/merges","archive_url":"https://api.github.com/repos/MSFTFox/WinObjC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MSFTFox/WinObjC/downloads","issues_url":"https://api.github.com/repos/MSFTFox/WinObjC/issues{/number}","pulls_url":"https://api.github.com/repos/MSFTFox/WinObjC/pulls{/number}","milestones_url":"https://api.github.com/repos/MSFTFox/WinObjC/milestones{/number}","notifications_url":"https://api.github.com/repos/MSFTFox/WinObjC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MSFTFox/WinObjC/labels{/name}","releases_url":"https://api.github.com/repos/MSFTFox/WinObjC/releases{/id}","deployments_url":"https://api.github.com/repos/MSFTFox/WinObjC/deployments","created_at":"2016-07-16T00:32:00Z","updated_at":"2016-07-16T00:32:15Z","pushed_at":"2016-08-20T03:16:32Z","git_url":"git://github.com/MSFTFox/WinObjC.git","ssh_url":"git@github.com:MSFTFox/WinObjC.git","clone_url":"https://github.com/MSFTFox/WinObjC.git","svn_url":"https://github.com/MSFTFox/WinObjC","homepage":"","size":331557,"stargazers_count":0,"watchers_count":0,"language":"Objective-C++","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":"develop"}},"base":{"label":"Microsoft:develop","ref":"develop","sha":"fff2876358590ad4f4c78814bfb6ba72f6d417f4","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":37950166,"name":"WinObjC","full_name":"Microsoft/WinObjC","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/WinObjC","description":"Objective-C for Windows","fork":false,"url":"https://api.github.com/repos/Microsoft/WinObjC","forks_url":"https://api.github.com/repos/Microsoft/WinObjC/forks","keys_url":"https://api.github.com/repos/Microsoft/WinObjC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/WinObjC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/WinObjC/teams","hooks_url":"https://api.github.com/repos/Microsoft/WinObjC/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/WinObjC/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/WinObjC/events","assignees_url":"https://api.github.com/repos/Microsoft/WinObjC/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/WinObjC/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/WinObjC/tags","blobs_url":"https://api.github.com/repos/Microsoft/WinObjC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/WinObjC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/WinObjC/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/WinObjC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/WinObjC/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/WinObjC/languages","stargazers_url":"https://api.github.com/repos/Microsoft/WinObjC/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/WinObjC/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/WinObjC/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/WinObjC/subscription","commits_url":"https://api.github.com/repos/Microsoft/WinObjC/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/WinObjC/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/WinObjC/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/WinObjC/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/WinObjC/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/WinObjC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/WinObjC/merges","archive_url":"https://api.github.com/repos/Microsoft/WinObjC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/WinObjC/downloads","issues_url":"https://api.github.com/repos/Microsoft/WinObjC/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/WinObjC/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/WinObjC/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/WinObjC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/WinObjC/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/WinObjC/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/WinObjC/deployments","created_at":"2015-06-23T23:14:58Z","updated_at":"2016-08-21T21:48:12Z","pushed_at":"2016-08-22T17:45:40Z","git_url":"git://github.com/Microsoft/WinObjC.git","ssh_url":"git@github.com:Microsoft/WinObjC.git","clone_url":"https://github.com/Microsoft/WinObjC.git","svn_url":"https://github.com/Microsoft/WinObjC","homepage":"","size":334328,"stargazers_count":5416,"watchers_count":5416,"language":"Objective-C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":692,"mirror_url":null,"open_issues_count":227,"forks":692,"open_issues":227,"watchers":5416,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/WinObjC/pulls/900"},"html":{"href":"https://github.com/Microsoft/WinObjC/pull/900"},"issue":{"href":"https://api.github.com/repos/Microsoft/WinObjC/issues/900"},"comments":{"href":"https://api.github.com/repos/Microsoft/WinObjC/issues/900/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/WinObjC/pulls/900/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/WinObjC/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/WinObjC/pulls/900/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/WinObjC/statuses/3a772426a6e48a864ade43e61202168aab318835"}}}}
{"actor":{"display_login":"DHowett-MSFT"}}