{"action":"opened","issue":{"url":"https://api.github.com/repos/Zverik/simple-revert/issues/3","repository_url":"https://api.github.com/repos/Zverik/simple-revert","labels_url":"https://api.github.com/repos/Zverik/simple-revert/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/Zverik/simple-revert/issues/3/comments","events_url":"https://api.github.com/repos/Zverik/simple-revert/issues/3/events","html_url":"https://github.com/Zverik/simple-revert/issues/3","id":133973717,"number":3,"title":"Merging diffs for a single object","user":{"login":"Zverik","id":766031,"avatar_url":"https://avatars.githubusercontent.com/u/766031?v=3","gravatar_id":"","url":"https://api.github.com/users/Zverik","html_url":"https://github.com/Zverik","followers_url":"https://api.github.com/users/Zverik/followers","following_url":"https://api.github.com/users/Zverik/following{/other_user}","gists_url":"https://api.github.com/users/Zverik/gists{/gist_id}","starred_url":"https://api.github.com/users/Zverik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zverik/subscriptions","organizations_url":"https://api.github.com/users/Zverik/orgs","repos_url":"https://api.github.com/users/Zverik/repos","events_url":"https://api.github.com/users/Zverik/events{/privacy}","received_events_url":"https://api.github.com/users/Zverik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-16T12:51:05Z","updated_at":"2016-02-16T12:51:05Z","closed_at":null,"body":"Example history:\r\n1. Created X\r\n2. Changed to Y\r\n3. Deleted\r\n4. Restored as Z\r\n5. Changed to N\r\n\r\nAnd now we are reverting changesets 3 and 4. What will the diff look like?\r\n\r\nFirst, creation and deletion can be reverted either if it's the last or first action (e.g. 4 can be reveretd w/o 5, but cannot revert 4 in the example, as well as 3 by itself. 1 can be, in that case the object will be deleted). But if delete-restore are chained, then after merging they become a simple diff.\r\n\r\nSo, there needs to be a `merge_diffs` function that merges two diffs into one.\r\n\r\nIt is applied first to chained create-delete and delete-create (first are simply removed, latter are converted to a simple diff). Then all versions starting from 1 are merged.\r\n\r\nNeed to test intermittent versions reverting. Also, maybe allow reverting any object creation, dropping all previous changes."}}