File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / rsync / patches / downdate.diff
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 00:32:36 2021 UTC (3 years, 3 months ago) by misho
Branches: rsync, MAIN
CVS tags: v3_2_3, HEAD
rsync 3.2.3

A patch from Stefan Müller to add the --downdate option, which works
in the opposite manner as --update.

To use this patch, run these commands for a successful build:

    patch -p1 <patches/downdate.diff
    ./configure                                 (optional if already run)
    make

based-on: e94bad1c156fc3910f24e2b3b71a81b0b0bdeb70
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
@@ -55,6 +55,7 @@ extern int ignore_errors;
 extern int remove_source_files;
 extern int delay_updates;
 extern int update_only;
+extern int downdate_only;
 extern int human_readable;
 extern int ignore_existing;
 extern int ignore_non_existing;
@@ -1713,6 +1714,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
 		goto cleanup;
 	}
 
+	if (downdate_only > 0 && statret == 0 && file->modtime - sx.st.st_mtime >= modify_window) {
+		if (INFO_GTE(SKIP, 1))
+			rprintf(FINFO, "%s is older\n", fname);
+		return;
+	}
+
 	fnamecmp_type = FNAMECMP_FNAME;
 
 	if (statret == 0 && !(S_ISREG(sx.st.st_mode) || (write_devices && IS_DEVICE(sx.st.st_mode)))) {
@@ -2157,6 +2164,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
 			ignore_existing = -ignore_existing;
 			ignore_non_existing = -ignore_non_existing;
 			update_only = -update_only;
+			downdate_only = -downdate_only;
 			always_checksum = -always_checksum;
 			size_only = -size_only;
 			append_mode = -append_mode;
@@ -2182,6 +2190,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
 			ignore_existing = -ignore_existing;
 			ignore_non_existing = -ignore_non_existing;
 			update_only = -update_only;
+			downdate_only = -downdate_only;
 			always_checksum = -always_checksum;
 			size_only = -size_only;
 			append_mode = -append_mode;
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
@@ -62,6 +62,7 @@ int preserve_times = 0;
 int preserve_atimes = 0;
 int preserve_crtimes = 0;
 int update_only = 0;
+int downdate_only = 0;
 int open_noatime = 0;
 int cvs_exclude = 0;
 int dry_run = 0;
@@ -683,6 +684,7 @@ static struct poptOption long_options[] = {
   {"no-one-file-system",0, POPT_ARG_VAL,    &one_file_system, 0, 0, 0 },
   {"no-x",             0,  POPT_ARG_VAL,    &one_file_system, 0, 0, 0 },
   {"update",          'u', POPT_ARG_NONE,   &update_only, 0, 0, 0 },
+  {"downdate",        'w', POPT_ARG_NONE,   &downdate_only, 0, 0, 0 },
   {"existing",         0,  POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
   {"ignore-non-existing",0,POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
   {"ignore-existing",  0,  POPT_ARG_NONE,   &ignore_existing, 0, 0, 0 },
diff --git a/rsync.1.md b/rsync.1.md
--- a/rsync.1.md
+++ b/rsync.1.md
@@ -347,6 +347,7 @@ detailed description below for a complete description.
 --backup-dir=DIR         make backups into hierarchy based in DIR
 --suffix=SUFFIX          backup suffix (default ~ w/o --backup-dir)
 --update, -u             skip files that are newer on the receiver
+--downdate, -w           skip files that are older on the receiver
 --inplace                update destination files in-place
 --append                 append data onto shorter files
 --append-verify          --append w/old data in file checksum
diff -Nurp a/rsync.1 b/rsync.1
--- a/rsync.1
+++ b/rsync.1
@@ -423,6 +423,7 @@ detailed description below for a complet
 --backup-dir=DIR         make backups into hierarchy based in DIR
 --suffix=SUFFIX          backup suffix (default ~ w/o --backup-dir)
 --update, -u             skip files that are newer on the receiver
+--downdate, -w           skip files that are older on the receiver
 --inplace                update destination files in-place
 --append                 append data onto shorter files
 --append-verify          --append w/old data in file checksum
diff -Nurp a/rsync.1.html b/rsync.1.html
--- a/rsync.1.html
+++ b/rsync.1.html
@@ -338,6 +338,7 @@ detailed description below for a complet
 --backup-dir=DIR         make backups into hierarchy based in DIR
 --suffix=SUFFIX          backup suffix (default ~ w/o --backup-dir)
 --update, -u             skip files that are newer on the receiver
+--downdate, -w           skip files that are older on the receiver
 --inplace                update destination files in-place
 --append                 append data onto shorter files
 --append-verify          --append w/old data in file checksum

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>