Better message when transferring rsync signatures

This commit is contained in:
Kovid Goyal 2021-10-03 13:29:50 +05:30
parent 42a79cb269
commit a8e06a67c2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -296,8 +296,7 @@ class SendManager:
self.fid_map = {f.file_id: f for f in self.files} self.fid_map = {f.file_id: f for f in self.files}
self.request_id = request_id self.request_id = request_id
self.state = SendState.waiting_for_permission self.state = SendState.waiting_for_permission
self.all_acknowledged = False self.all_acknowledged = self.all_started = self.has_transmitting = self.has_rsync = False
self.all_started = False
self.active_idx: Optional[int] = None self.active_idx: Optional[int] = None
self.current_chunk_uncompressed_sz: Optional[int] = None self.current_chunk_uncompressed_sz: Optional[int] = None
self.prefix = f'\x1b]{FILE_TRANSFER_CODE};id={self.request_id};' self.prefix = f'\x1b]{FILE_TRANSFER_CODE};id={self.request_id};'
@ -329,15 +328,21 @@ class SendManager:
def update_collective_statuses(self) -> None: def update_collective_statuses(self) -> None:
found_not_started = found_not_done = False found_not_started = found_not_done = False
has_rsync = has_transmitting = False
for f in self.files: for f in self.files:
if f.state is not FileState.acknowledged: if f.state is not FileState.acknowledged:
found_not_done = True found_not_done = True
if f.state is FileState.waiting_for_start: if f.state is FileState.waiting_for_start:
found_not_started = True found_not_started = True
if found_not_started and found_not_done: elif f.state is FileState.transmitting:
break has_transmitting = True
if f.ttype is TransmissionType.rsync:
has_rsync = True
self.all_acknowledged = not found_not_done self.all_acknowledged = not found_not_done
self.all_started = not found_not_started self.all_started = not found_not_started
self.has_rsync = has_rsync
self.has_transmitting = has_transmitting
def start_transfer(self) -> str: def start_transfer(self) -> str:
return FileTransmissionCommand(action=Action.send, bypass=self.bypass).serialize() return FileTransmissionCommand(action=Action.send, bypass=self.bypass).serialize()
@ -671,7 +676,10 @@ class Send(Handler):
else: else:
af = self.manager.last_progress_file af = self.manager.last_progress_file
if af is None or af.file_id in self.done_file_ids: if af is None or af.file_id in self.done_file_ids:
self.print(sc, 'Transferring metadata...', end='') if self.manager.has_rsync and not self.manager.has_transmitting:
self.print(sc, 'Transferring rsync signatures...', end='')
else:
self.print(sc, 'Transferring metadata...', end='')
else: else:
self.draw_progress_for_current_file(af, spinner_char=sc) self.draw_progress_for_current_file(af, spinner_char=sc)
self.print() self.print()