Fixed transaction rollback on failed sync

Change-Id: Id9448045ec2cfe71882a989391dc9035ff6f6897
diff --git a/trsync/objects/rsync_mirror.py b/trsync/objects/rsync_mirror.py
index aac178e..0156f5a 100644
--- a/trsync/objects/rsync_mirror.py
+++ b/trsync/objects/rsync_mirror.py
@@ -106,19 +106,19 @@
         transaction = list()
         try:
             # start transaction
+            transaction.append(lambda p=repo_path: self.rsync.rm_all(p))
             result = super(TRsync, self).push(self.url.a_dir(source),
                                               repo_path,
                                               extra)
-            transaction.append(lambda p=repo_path: self.rsync.rm_all(p))
             self._log.info('{}'.format(result))
 
             if save_diff is True:
                 diff_file = self._tmp.get_file(content='{}'.format(result))
                 diff_file_name = '{}.diff.txt'.format(repo_path)
-                super(TRsync, self).push(diff_file, diff_file_name)
                 transaction.append(
                     lambda f=diff_file_name: self.rsync.rm_all(f)
                 )
+                super(TRsync, self).push(diff_file, diff_file_name)
                 self._log.debug('Diff file {} created.'
                                 ''.format(diff_file_name))
 
@@ -129,6 +129,7 @@
                     undo = lambda l=symlink, t=tgt: self.rsync.symlink(l, t)
                 except Exception:
                     undo = lambda l=symlink: self.rsync.rm_all(l)
+                transaction.append(undo)
                 self.rsync.symlink(
                     symlink,
                     self.url.path_relative(
@@ -136,7 +137,6 @@
                         os.path.split(symlink)[0]
                     )
                 )
-                transaction.append(undo)
 
         except RuntimeError:
             self._log.error("Rollback transaction because some of sync"