|
|
@ -109,19 +109,20 @@ def file_copy(source, dest, progress_cb):
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
for line in iter(process.stdout.readline, b''):
|
|
|
|
for line in iter(process.stdout.readline, b''):
|
|
|
|
# small comment on this regexp.
|
|
|
|
# rsync outputs progress in parentheses. Each line will have an
|
|
|
|
# rsync outputs three items in the progress (in parentheses)
|
|
|
|
# xfer and a chk item (either ir-chk or to-chk) as follows:
|
|
|
|
|
|
|
|
#
|
|
|
|
# - xfer#x => Interpret it as 'file copy try no. x'
|
|
|
|
# - xfer#x => Interpret it as 'file copy try no. x'
|
|
|
|
# - ir-chk=x/y, where:
|
|
|
|
# - ir-chk=x/y, where:
|
|
|
|
# - x = number of files yet to be checked
|
|
|
|
# - x = number of files yet to be checked
|
|
|
|
# - y = currently calculated total number of files.
|
|
|
|
# - y = currently calculated total number of files.
|
|
|
|
# - to-chk=x/y, which is similar but seems to only be emitted when
|
|
|
|
# - to-chk=x/y, which is similar and happens once the ir-chk
|
|
|
|
# progress is short; these are ignored.
|
|
|
|
# phase (collecting total files) is over.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# If you're copying directory with some links in it, the xfer#
|
|
|
|
# If you're copying directory with some links in it, the xfer#
|
|
|
|
# might not be a reliable counter (for one increase of xfer, many
|
|
|
|
# might not be a reliable counter (for one increase of xfer, many
|
|
|
|
# files may be created).
|
|
|
|
# files may be created).
|
|
|
|
m = re.findall(r'xfr#(\d+), ir-chk=(\d+)/(\d+)', line.decode())
|
|
|
|
m = re.findall(r'xfr#(\d+), ..-chk=(\d+)/(\d+)', line.decode())
|
|
|
|
|
|
|
|
|
|
|
|
if m:
|
|
|
|
if m:
|
|
|
|
# we've got a percentage update
|
|
|
|
# we've got a percentage update
|
|
|
|