feat(parity): report --stats during server-contacting dry-run
rsync prints the --stats block (with the (DRY RUN) suffix) for -n; route the dry-run path through report_transfer_stats using the wire counters and the STATUS_STATS receiver report.
This commit is contained in:
@@ -1607,6 +1607,9 @@ static int send_dry_run_remote(Config* config) {
|
|||||||
protocol_session_bind(&session);
|
protocol_session_bind(&session);
|
||||||
|
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
time_t dry_start = time(NULL);
|
||||||
|
ReceiverStats dry_stats;
|
||||||
|
memset(&dry_stats, 0, sizeof(dry_stats));
|
||||||
PreparedScanner prepared;
|
PreparedScanner prepared;
|
||||||
memset(&prepared, 0, sizeof(prepared));
|
memset(&prepared, 0, sizeof(prepared));
|
||||||
DirectoryScanner* scanner = NULL;
|
DirectoryScanner* scanner = NULL;
|
||||||
@@ -1737,12 +1740,10 @@ static int send_dry_run_remote(Config* config) {
|
|||||||
if (!receive_status(client->file_descriptor, &status))
|
if (!receive_status(client->file_descriptor, &status))
|
||||||
goto dry_fail;
|
goto dry_fail;
|
||||||
if (status == STATUS_STATS) {
|
if (status == STATUS_STATS) {
|
||||||
ReceiverStats stats;
|
|
||||||
memset(&stats, 0, sizeof(stats));
|
|
||||||
ArrayList* would_delete = array_list_create(free);
|
ArrayList* would_delete = array_list_create(free);
|
||||||
if (!would_delete)
|
if (!would_delete)
|
||||||
goto dry_fail;
|
goto dry_fail;
|
||||||
if (!receive_stats_record(client->file_descriptor, &stats, would_delete)) {
|
if (!receive_stats_record(client->file_descriptor, &dry_stats, would_delete)) {
|
||||||
array_list_delete(would_delete);
|
array_list_delete(would_delete);
|
||||||
goto dry_fail;
|
goto dry_fail;
|
||||||
}
|
}
|
||||||
@@ -1785,6 +1786,7 @@ static int send_dry_run_remote(Config* config) {
|
|||||||
else
|
else
|
||||||
printf("Total: %d files, %.1f MB\n", file_count, (double)total_bytes / (double)BYTES_PER_MIB);
|
printf("Total: %d files, %.1f MB\n", file_count, (double)total_bytes / (double)BYTES_PER_MIB);
|
||||||
}
|
}
|
||||||
|
report_transfer_stats(config, file_count, total_bytes, dry_start, &dry_stats);
|
||||||
ret = io_error ? 1 : 0;
|
ret = io_error ? 1 : 0;
|
||||||
|
|
||||||
dry_fail:
|
dry_fail:
|
||||||
|
|||||||
Reference in New Issue
Block a user