The Samba-Bugzilla – Attachment 3390 Details for
Bug 3784
Showing Progress without being Verbose
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to give total run progress indication
rsync-total-progress.diff (text/plain), 4.80 KB, created by
Graeme Humphries (mail address dead)
on 2008-07-04 15:54:53 UTC
(
hide
)
Description:
patch to give total run progress indication
Filename:
MIME Type:
Creator:
Graeme Humphries (mail address dead)
Created:
2008-07-04 15:54:53 UTC
Size:
4.80 KB
patch
obsolete
>diff -r 6e94d9d50855 options.c >--- a/options.c Fri Jul 04 10:41:18 2008 -0700 >+++ b/options.c Fri Jul 04 13:50:00 2008 -0700 >@@ -101,6 +101,7 @@ int am_daemon = 0; > int am_daemon = 0; > int do_stats = 0; > int do_progress = 0; >+int do_total_progress = 0; > int connect_timeout = 0; > int keep_partial = 0; > int safe_symlinks = 0; >@@ -201,7 +202,7 @@ static int modify_window_set; > static int modify_window_set; > static int itemize_changes = 0; > static int refused_delete, refused_archive_part, refused_compress; >-static int refused_partial, refused_progress, refused_delete_before; >+static int refused_partial, refused_progress, refused_total_progress, refused_delete_before; > static int refused_delete_during; > static int refused_inplace, refused_no_iconv; > static char *max_size_arg, *min_size_arg; >@@ -416,6 +417,7 @@ void usage(enum logcode F) > rprintf(F," -8, --8-bit-output leave high-bit chars unescaped in output\n"); > rprintf(F," -h, --human-readable output numbers in a human-readable format\n"); > rprintf(F," --progress show progress during transfer\n"); >+ rprintf(F," --total-progress show progress for overall transfer, not individual files\n"); > rprintf(F," -P same as --partial --progress\n"); > rprintf(F," -i, --itemize-changes output a change-summary for all updates\n"); > rprintf(F," --out-format=FORMAT output updates using the specified FORMAT\n"); >@@ -588,6 +590,7 @@ static struct poptOption long_options[] > {"compress-level", 0, POPT_ARG_INT, &def_compress_level, 'z', 0, 0 }, > {0, 'P', POPT_ARG_NONE, 0, 'P', 0, 0 }, > {"progress", 0, POPT_ARG_VAL, &do_progress, 1, 0, 0 }, >+ {"total-progress", 0, POPT_ARG_VAL, &do_total_progress, 1, 0, 0 }, > {"no-progress", 0, POPT_ARG_VAL, &do_progress, 0, 0, 0 }, > {"partial", 0, POPT_ARG_VAL, &keep_partial, 1, 0, 0 }, > {"no-partial", 0, POPT_ARG_VAL, &keep_partial, 0, 0, 0 }, >@@ -778,6 +781,8 @@ static void set_refuse_options(char *bp) > refused_partial = op->val; > else if (wildmatch("progress", op->longName)) > refused_progress = op->val; >+ else if (wildmatch("total-progress", op->longName)) >+ refused_total_progress = op->val; > else if (wildmatch("inplace", op->longName)) > refused_inplace = op->val; > else if (wildmatch("no-iconv", op->longName)) >@@ -1532,12 +1537,15 @@ int parse_arguments(int *argc_p, const c > log_before_transfer = !am_server; > } > >- if (do_progress && !verbose && !log_before_transfer && !am_server) >+ if (do_progress && !verbose && !log_before_transfer && !am_server && !do_total_progress) > verbose = 1; >+ >+ if (do_total_progress) >+ do_progress = 1; > > if (dry_run) > do_xfers = 0; >- >+ > set_io_timeout(io_timeout); > > if (verbose && !stdout_format) { >diff -r 6e94d9d50855 progress.c >--- a/progress.c Fri Jul 04 10:41:18 2008 -0700 >+++ b/progress.c Fri Jul 04 13:50:00 2008 -0700 >@@ -27,6 +27,10 @@ extern struct stats stats; > extern struct stats stats; > extern struct file_list *cur_flist; > >+extern int do_total_progress; >+extern int verbose; >+ >+ > #define PROGRESS_HISTORY_SECS 5 > > #ifdef GETPGRP_VOID >@@ -66,10 +70,14 @@ static void rprint_progress(OFF_T ofs, O > { > char rembuf[64], eol[128]; > const char *units; >+ if (do_total_progress) { >+ ofs = stats.total_transferred_size; >+ size = stats.total_size; >+ } > int pct = ofs == size ? 100 : (int) (100.0 * ofs / size); > unsigned long diff; > double rate, remain; >- >+ > if (is_last) { > /* Compute stats based on the starting info. */ > if (!ph_start.time.tv_sec >@@ -106,11 +114,17 @@ static void rprint_progress(OFF_T ofs, O > (int) remain % 60); > } > >- if (is_last) { >- snprintf(eol, sizeof eol, " (xfer#%d, to-check=%d/%d)\n", >- stats.num_transferred_files, >- stats.num_files - current_file_index - 1, >- stats.num_files); >+ if (is_last || do_total_progress) { >+ if (is_last && verbose) >+ snprintf(eol, sizeof eol, " (xfer#%d, to-check=%d/%d)\n", >+ stats.num_transferred_files, >+ stats.num_files - current_file_index - 1, >+ stats.num_files); >+ else >+ snprintf(eol, sizeof eol, " (xfer#%d, to-check=%d/%d)\r", >+ stats.num_transferred_files, >+ stats.num_files - current_file_index - 1, >+ stats.num_files); > } else > strlcpy(eol, "\r", sizeof eol); > progress_is_active = 0; >@@ -134,9 +148,13 @@ void end_progress(OFF_T size) > if (!am_server) { > struct timeval now; > gettimeofday(&now, NULL); >- rprint_progress(size, size, &now, True); >+ if (do_total_progress) >+ rprint_progress(size, size, &now, True); >+ else >+ rprint_progress(size, size, &now, True); > } >- memset(&ph_start, 0, sizeof ph_start); >+ if (!do_total_progress) >+ memset(&ph_start, 0, sizeof ph_start); > } > > void show_progress(OFF_T ofs, OFF_T size)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 3784
: 3390