Commits

wodny  committed 6123a7a

Avoid double progress for one progress line.
Comments.

  • Participants
  • Parent commits 194231f

Comments (0)

Files changed (1)

File lib/rsync.py

             yield (None, error)
 
     def process_rsync_output(self):
+        # Arbitrarily selected value to decrease importance of the first 
+        # file in the total progress. This is needed because rsync 
+        # reports the total number of files pending after every file, 
+        # but not before (the first one).
         files_total = 100000
         files_current = files_total
         files_progress = 0
             if line and line[0] == '\r':
                 match = Rsync.rsync_report_re.match(line.strip())
                 if match is None: continue
-                progress = int(match.group('cent'))
                 if match.group('total'):
                     files_total = int(match.group('total'))
                     files_current = int(match.group('current'))
+                    # 100% progress of file and one less file to process 
+                    # gives double progress until the next line of 
+                    # rsync's progress report, so reduce it.
+                    progress = 0
+                else:
+                    progress = int(match.group('cent'))
             elif line and line.strip():
                 status = line.strip()
             files_progress = 100 * (files_total - files_current) / files_total + 1.0 * progress / files_total