import gitmagic

def fixup(repo, destination_picker):
    repo.reset()
    for change in gitmagic.find_changes(repo):
        destination_commit = destination_picker.pick(change)
        #todo: apply unified diff from change
        repo.index.commit( message = "fixup! {}".format(destination_commit.message()))


@@ -10,16 +10,17 @@
 tmagic%0A%0A
+%0A
 def fixu
@@ -112,16 +112,52 @@
 (repo):%0A
+        _apply_change(repo, change)%0A
         
@@ -213,54 +213,8 @@
 ge)%0A
-        #todo: apply unified diff from change%0A
     
@@ -297,8 +297,114 @@
 ge()))%0A%0A
+def _apply_change(repo, change):%0A    #todo: apply unified diff only%0A    repo.index.add(change.file_name)%0A%0A

apply whole file instead of a patch