{"action":"created","comment":{"url":"https://api.github.com/repos/google/xi-editor/pulls/comments/124672558","pull_request_review_id":46985626,"id":124672558,"diff_hunk":"@@ -632,16 +633,38 @@ fn compute_deltas(revs: &[Revision], text: &Rope, tombstones: &Rope, deletes_fro\n     out\n }\n \n+/// Computes a series of priorities and transforms for the deltas on the right\n+/// from the new revisions on the left.\n+///\n+/// Applies an optimization where it combines sequential revisions with the\n+/// same priority into one transform to decrease the number of transforms that\n+/// have to be considered in `rebase` substantially for normal editing\n+/// patterns. Any large runs of typing in the same place by the same user (e.g\n+/// typing a paragraph) will be combined into a single segment in a transform\n+/// as opposed to thousands of revisions.\n+fn compute_transforms(revs: Vec<Revision>) -> Vec<(usize, Subset)> {\n+    let mut out = Vec::new();\n+    let mut last_priority: Option<usize> = None;\n+    for r in revs.into_iter() {\n+        if let Contents::Edit {priority, inserts, .. } = r.edit {\n+            if Some(priority) == last_priority {\n+                let last: &mut (usize, Subset) = out.last_mut().unwrap();\n+                last.1 = last.1.transform_union(&inserts);\n+            } else {\n+                last_priority = Some(priority);\n+                out.push((priority, inserts));\n+            }\n+        }\n+    }\n+    out\n+}\n+\n /// Rebase b_new on top of a_new and return revision contents that can be appended as new","path":"rust/rope/src/engine.rs","position":42,"original_position":42,"commit_id":"aa6da77fd74ce20836cc251ab8eeed44083ef209","original_commit_id":"aa6da77fd74ce20836cc251ab8eeed44083ef209","user":{"login":"raphlinus","id":242367,"avatar_url":"https://avatars0.githubusercontent.com/u/242367?v=3","gravatar_id":"","url":"https://api.github.com/users/raphlinus","html_url":"https://github.com/raphlinus","followers_url":"https://api.github.com/users/raphlinus/followers","following_url":"https://api.github.com/users/raphlinus/following{/other_user}","gists_url":"https://api.github.com/users/raphlinus/gists{/gist_id}","starred_url":"https://api.github.com/users/raphlinus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphlinus/subscriptions","organizations_url":"https://api.github.com/users/raphlinus/orgs","repos_url":"https://api.github.com/users/raphlinus/repos","events_url":"https://api.github.com/users/raphlinus/events{/privacy}","received_events_url":"https://api.github.com/users/raphlinus/received_events","type":"User","site_admin":false},"body":"Comment seems to be stale as params have been renamed.","created_at":"2017-06-28T22:27:02Z","updated_at":"2017-06-28T22:32:45Z","html_url":"https://github.com/google/xi-editor/pull/351#discussion_r124672558","pull_request_url":"https://api.github.com/repos/google/xi-editor/pulls/351","_links":{"self":{"href":"https://api.github.com/repos/google/xi-editor/pulls/comments/124672558"},"html":{"href":"https://github.com/google/xi-editor/pull/351#discussion_r124672558"},"pull_request":{"href":"https://api.github.com/repos/google/xi-editor/pulls/351"}}},"pull_request":{"url":"https://api.github.com/repos/google/xi-editor/pulls/351","id":127982916,"html_url":"https://github.com/google/xi-editor/pull/351","diff_url":"https://github.com/google/xi-editor/pull/351.diff","patch_url":"https://github.com/google/xi-editor/pull/351.patch","issue_url":"https://api.github.com/repos/google/xi-editor/issues/351","number":351,"state":"open","locked":false,"title":"Combine sequential edits with same priority in merge","user":{"login":"trishume","id":887610,"avatar_url":"https://avatars2.githubusercontent.com/u/887610?v=3","gravatar_id":"","url":"https://api.github.com/users/trishume","html_url":"https://github.com/trishume","followers_url":"https://api.github.com/users/trishume/followers","following_url":"https://api.github.com/users/trishume/following{/other_user}","gists_url":"https://api.github.com/users/trishume/gists{/gist_id}","starred_url":"https://api.github.com/users/trishume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trishume/subscriptions","organizations_url":"https://api.github.com/users/trishume/orgs","repos_url":"https://api.github.com/users/trishume/repos","events_url":"https://api.github.com/users/trishume/events{/privacy}","received_events_url":"https://api.github.com/users/trishume/received_events","type":"User","site_admin":false},"body":"Applies an optimization where it combines sequential revisions with the same priority into one transform to decrease the number of transforms that have to be considered in `rebase` substantially for normal editing patterns. Any large runs of typing in the same place by the same user (e.g typing a paragraph) will be combined into a single segment in a transform as opposed to thousands of revisions.\r\n\r\n**Not to be merged before #350**\r\n\r\ncc @jimbeveridge","created_at":"2017-06-28T17:57:41Z","updated_at":"2017-06-28T22:32:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"71e73156d1e37f5c12832ce5b6d89b1eabf65127","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/google/xi-editor/pulls/351/commits","review_comments_url":"https://api.github.com/repos/google/xi-editor/pulls/351/comments","review_comment_url":"https://api.github.com/repos/google/xi-editor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/xi-editor/issues/351/comments","statuses_url":"https://api.github.com/repos/google/xi-editor/statuses/aa6da77fd74ce20836cc251ab8eeed44083ef209","head":{"label":"google:batch-optimization","ref":"batch-optimization","sha":"aa6da77fd74ce20836cc251ab8eeed44083ef209","user":{"login":"google","id":1342004,"avatar_url":"https://avatars2.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":57167764,"name":"xi-editor","full_name":"google/xi-editor","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars2.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/xi-editor","description":"A modern editor with a backend written in Rust.","fork":false,"url":"https://api.github.com/repos/google/xi-editor","forks_url":"https://api.github.com/repos/google/xi-editor/forks","keys_url":"https://api.github.com/repos/google/xi-editor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/xi-editor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/xi-editor/teams","hooks_url":"https://api.github.com/repos/google/xi-editor/hooks","issue_events_url":"https://api.github.com/repos/google/xi-editor/issues/events{/number}","events_url":"https://api.github.com/repos/google/xi-editor/events","assignees_url":"https://api.github.com/repos/google/xi-editor/assignees{/user}","branches_url":"https://api.github.com/repos/google/xi-editor/branches{/branch}","tags_url":"https://api.github.com/repos/google/xi-editor/tags","blobs_url":"https://api.github.com/repos/google/xi-editor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/xi-editor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/xi-editor/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/xi-editor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/xi-editor/statuses/{sha}","languages_url":"https://api.github.com/repos/google/xi-editor/languages","stargazers_url":"https://api.github.com/repos/google/xi-editor/stargazers","contributors_url":"https://api.github.com/repos/google/xi-editor/contributors","subscribers_url":"https://api.github.com/repos/google/xi-editor/subscribers","subscription_url":"https://api.github.com/repos/google/xi-editor/subscription","commits_url":"https://api.github.com/repos/google/xi-editor/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/xi-editor/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/xi-editor/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/xi-editor/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/xi-editor/contents/{+path}","compare_url":"https://api.github.com/repos/google/xi-editor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/xi-editor/merges","archive_url":"https://api.github.com/repos/google/xi-editor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/xi-editor/downloads","issues_url":"https://api.github.com/repos/google/xi-editor/issues{/number}","pulls_url":"https://api.github.com/repos/google/xi-editor/pulls{/number}","milestones_url":"https://api.github.com/repos/google/xi-editor/milestones{/number}","notifications_url":"https://api.github.com/repos/google/xi-editor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/xi-editor/labels{/name}","releases_url":"https://api.github.com/repos/google/xi-editor/releases{/id}","deployments_url":"https://api.github.com/repos/google/xi-editor/deployments","created_at":"2016-04-26T23:03:23Z","updated_at":"2017-06-28T19:01:33Z","pushed_at":"2017-06-28T17:57:42Z","git_url":"git://github.com/google/xi-editor.git","ssh_url":"git@github.com:google/xi-editor.git","clone_url":"https://github.com/google/xi-editor.git","svn_url":"https://github.com/google/xi-editor","homepage":"","size":2183,"stargazers_count":8016,"watchers_count":8016,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":271,"mirror_url":null,"open_issues_count":91,"forks":271,"open_issues":91,"watchers":8016,"default_branch":"master"}},"base":{"label":"google:crdt-delete","ref":"crdt-delete","sha":"32862f1ae6288c962821260ca568a633caada76e","user":{"login":"google","id":1342004,"avatar_url":"https://avatars2.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":57167764,"name":"xi-editor","full_name":"google/xi-editor","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars2.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/xi-editor","description":"A modern editor with a backend written in Rust.","fork":false,"url":"https://api.github.com/repos/google/xi-editor","forks_url":"https://api.github.com/repos/google/xi-editor/forks","keys_url":"https://api.github.com/repos/google/xi-editor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/xi-editor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/xi-editor/teams","hooks_url":"https://api.github.com/repos/google/xi-editor/hooks","issue_events_url":"https://api.github.com/repos/google/xi-editor/issues/events{/number}","events_url":"https://api.github.com/repos/google/xi-editor/events","assignees_url":"https://api.github.com/repos/google/xi-editor/assignees{/user}","branches_url":"https://api.github.com/repos/google/xi-editor/branches{/branch}","tags_url":"https://api.github.com/repos/google/xi-editor/tags","blobs_url":"https://api.github.com/repos/google/xi-editor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/xi-editor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/xi-editor/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/xi-editor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/xi-editor/statuses/{sha}","languages_url":"https://api.github.com/repos/google/xi-editor/languages","stargazers_url":"https://api.github.com/repos/google/xi-editor/stargazers","contributors_url":"https://api.github.com/repos/google/xi-editor/contributors","subscribers_url":"https://api.github.com/repos/google/xi-editor/subscribers","subscription_url":"https://api.github.com/repos/google/xi-editor/subscription","commits_url":"https://api.github.com/repos/google/xi-editor/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/xi-editor/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/xi-editor/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/xi-editor/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/xi-editor/contents/{+path}","compare_url":"https://api.github.com/repos/google/xi-editor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/xi-editor/merges","archive_url":"https://api.github.com/repos/google/xi-editor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/xi-editor/downloads","issues_url":"https://api.github.com/repos/google/xi-editor/issues{/number}","pulls_url":"https://api.github.com/repos/google/xi-editor/pulls{/number}","milestones_url":"https://api.github.com/repos/google/xi-editor/milestones{/number}","notifications_url":"https://api.github.com/repos/google/xi-editor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/xi-editor/labels{/name}","releases_url":"https://api.github.com/repos/google/xi-editor/releases{/id}","deployments_url":"https://api.github.com/repos/google/xi-editor/deployments","created_at":"2016-04-26T23:03:23Z","updated_at":"2017-06-28T19:01:33Z","pushed_at":"2017-06-28T17:57:42Z","git_url":"git://github.com/google/xi-editor.git","ssh_url":"git@github.com:google/xi-editor.git","clone_url":"https://github.com/google/xi-editor.git","svn_url":"https://github.com/google/xi-editor","homepage":"","size":2183,"stargazers_count":8016,"watchers_count":8016,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":271,"mirror_url":null,"open_issues_count":91,"forks":271,"open_issues":91,"watchers":8016,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/xi-editor/pulls/351"},"html":{"href":"https://github.com/google/xi-editor/pull/351"},"issue":{"href":"https://api.github.com/repos/google/xi-editor/issues/351"},"comments":{"href":"https://api.github.com/repos/google/xi-editor/issues/351/comments"},"review_comments":{"href":"https://api.github.com/repos/google/xi-editor/pulls/351/comments"},"review_comment":{"href":"https://api.github.com/repos/google/xi-editor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/xi-editor/pulls/351/commits"},"statuses":{"href":"https://api.github.com/repos/google/xi-editor/statuses/aa6da77fd74ce20836cc251ab8eeed44083ef209"}}}}
{"actor":{"display_login":"raphlinus"}}