Updated to apply cleanly.
[rsync/rsync-patches.git] / append.diff
index e079fb2..20306a9 100644 (file)
@@ -1,8 +1,8 @@
 This patch adds the --append option, which works like a "resume" mode in
 an ftp client, appending new data onto the end of the files it updates.
 
---- orig/generator.c   2005-02-27 18:24:42
-+++ generator.c        2005-02-27 07:51:38
+--- orig/generator.c   2005-03-17 09:05:21
++++ generator.c        2005-03-03 02:59:17
 @@ -51,6 +51,7 @@ extern int remove_sent_files;
  extern int update_only;
  extern int opt_ignore_existing;
@@ -11,7 +11,7 @@ an ftp client, appending new data onto the end of the files it updates.
  extern int make_backups;
  extern int csum_length;
  extern int ignore_times;
-@@ -457,35 +458,42 @@ static void generate_and_send_sums(int f
+@@ -466,35 +467,42 @@ static void generate_and_send_sums(int f
        OFF_T offset = 0;
  
        sum_sizes_sqroot(&sum, len);
@@ -61,7 +61,7 @@ an ftp client, appending new data onto the end of the files it updates.
        }
  
        if (mapbuf)
-@@ -925,6 +933,9 @@ static void recv_generator(char *fname, 
+@@ -973,6 +981,9 @@ static void recv_generator(char *fname, 
                return;
        }
  
@@ -71,16 +71,16 @@ an ftp client, appending new data onto the end of the files it updates.
        if (!compare_dest && fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
                ;
        else if (fnamecmp_type == FNAMECMP_FUZZY)
-@@ -951,7 +962,7 @@ prepare_to_open:
+@@ -1143,7 +1154,7 @@ void generate_files(int f_out, struct fi
+       if (delete_before && !local_name && flist->count > 0)
+               do_delete_pass(flist);
  
-       if (dry_run || read_batch)
-               goto notify_others;
--      if (whole_file > 0) {
-+      if (whole_file > 0 && !append_mode) {
-               if (statret == 0)
-                       statret = 1;
-               goto notify_others;
-@@ -1147,6 +1158,8 @@ void generate_files(int f_out, struct fi
+-      if (whole_file < 0)
++      if (append_mode || whole_file < 0)
+               whole_file = 0;
+       if (verbose >= 2) {
+               rprintf(FINFO, "delta-transmission %s\n",
+@@ -1194,6 +1205,8 @@ void generate_files(int f_out, struct fi
        only_existing = max_size = opt_ignore_existing = 0;
        update_only = always_checksum = size_only = 0;
        ignore_times = 1;
@@ -89,7 +89,7 @@ an ftp client, appending new data onto the end of the files it updates.
        make_backups = 0; /* avoid a duplicate backup for inplace processing */
  
        /* We expect to just sit around now, so don't exit on a timeout.
---- orig/match.c       2005-02-15 19:27:04
+--- orig/match.c       2005-03-05 17:51:23
 +++ match.c    2005-02-11 20:26:31
 @@ -23,6 +23,7 @@ extern int verbose;
  extern int am_server;
@@ -99,7 +99,7 @@ an ftp client, appending new data onto the end of the files it updates.
  
  int updating_basis_file;
  
-@@ -334,6 +335,21 @@ void match_sums(int f, struct sum_struct
+@@ -330,6 +331,21 @@ void match_sums(int f, struct sum_struct
  
        sum_init(checksum_seed);
  
@@ -121,7 +121,7 @@ an ftp client, appending new data onto the end of the files it updates.
        if (len > 0 && s->count > 0) {
                build_hash_table(s);
  
-@@ -347,7 +363,7 @@ void match_sums(int f, struct sum_struct
+@@ -343,7 +359,7 @@ void match_sums(int f, struct sum_struct
        } else {
                OFF_T j;
                /* by doing this in pieces we avoid too many seeks */
@@ -130,8 +130,8 @@ an ftp client, appending new data onto the end of the files it updates.
                        matched(f, s, buf, j, -2);
                matched(f, s, buf, len, -1);
        }
---- orig/options.c     2005-03-01 05:49:24
-+++ options.c  2005-02-16 15:36:40
+--- orig/options.c     2005-03-24 16:41:46
++++ options.c  2005-03-11 11:21:34
 @@ -39,6 +39,7 @@ int make_backups = 0;
   **/
  int whole_file = -1;
@@ -140,15 +140,15 @@ an ftp client, appending new data onto the end of the files it updates.
  int archive_mode = 0;
  int keep_dirlinks = 0;
  int copy_links = 0;
-@@ -163,6 +164,7 @@ static int F_option_cnt = 0;
+@@ -165,6 +166,7 @@ static int F_option_cnt = 0;
  static int modify_window_set;
  static int refused_delete, refused_archive_part;
  static int refused_partial, refused_progress, refused_delete_before;
 +static int refused_inplace;
- static char *dest_option = NULL;
  static char *max_size_arg;
  static char partialdir_for_delayupdate[] = ".~tmp~";
-@@ -272,6 +274,7 @@ void usage(enum logcode F)
+@@ -273,6 +275,7 @@ void usage(enum logcode F)
    rprintf(F,"     --suffix=SUFFIX         set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
    rprintf(F," -u, --update                skip files that are newer on the receiver\n");
    rprintf(F,"     --inplace               update destination files in-place (SEE MAN PAGE)\n");
@@ -156,7 +156,7 @@ an ftp client, appending new data onto the end of the files it updates.
    rprintf(F," -d, --dirs                  transfer directories without recursing\n");
    rprintf(F," -l, --links                 copy symlinks as symlinks\n");
    rprintf(F," -L, --copy-links            transform symlink into referent file/dir\n");
-@@ -398,6 +401,7 @@ static struct poptOption long_options[] 
+@@ -400,6 +403,7 @@ static struct poptOption long_options[] 
    {"links",           'l', POPT_ARG_NONE,   &preserve_links, 0, 0, 0 },
    {"copy-links",      'L', POPT_ARG_NONE,   &copy_links, 0, 0, 0 },
    {"keep-dirlinks",   'K', POPT_ARG_NONE,   &keep_dirlinks, 0, 0, 0 },
@@ -164,7 +164,7 @@ an ftp client, appending new data onto the end of the files it updates.
    {"whole-file",      'W', POPT_ARG_VAL,    &whole_file, 1, 0, 0 },
    {"no-whole-file",    0,  POPT_ARG_VAL,    &whole_file, 0, 0, 0 },
    {"copy-unsafe-links",0,  POPT_ARG_NONE,   &copy_unsafe_links, 0, 0, 0 },
-@@ -571,6 +575,8 @@ static void set_refuse_options(char *bp)
+@@ -574,6 +578,8 @@ static void set_refuse_options(char *bp)
                                                refused_partial = op->val;
                                        else if (wildmatch("progress", op->longName))
                                                refused_progress = op->val;
@@ -173,7 +173,7 @@ an ftp client, appending new data onto the end of the files it updates.
                                        break;
                                }
                                if (!is_wild)
-@@ -1105,6 +1111,14 @@ int parse_arguments(int *argc, const cha
+@@ -1108,6 +1114,14 @@ int parse_arguments(int *argc, const cha
                        bwlimit_writemax = 512;
        }
  
@@ -188,7 +188,7 @@ an ftp client, appending new data onto the end of the files it updates.
        if (delay_updates && !partial_dir)
                partial_dir = partialdir_for_delayupdate;
  
-@@ -1415,7 +1429,9 @@ void server_options(char **args,int *arg
+@@ -1418,7 +1432,9 @@ void server_options(char **args,int *arg
        if (opt_ignore_existing && am_sender)
                args[ac++] = "--ignore-existing";
  
@@ -199,7 +199,7 @@ an ftp client, appending new data onto the end of the files it updates.
                args[ac++] = "--inplace";
  
        if (tmpdir) {
---- orig/receiver.c    2005-02-26 19:27:54
+--- orig/receiver.c    2005-03-24 16:41:46
 +++ receiver.c 2005-02-11 20:26:32
 @@ -44,6 +44,7 @@ extern int remove_sent_files;
  extern int module_id;
@@ -246,9 +246,9 @@ an ftp client, appending new data onto the end of the files it updates.
                        continue;
                }
  
---- orig/rsync.yo      2005-03-01 01:22:59
+--- orig/rsync.yo      2005-03-16 02:19:30
 +++ rsync.yo   2005-02-11 20:36:38
-@@ -309,6 +309,7 @@ to the detailed description below for a 
+@@ -308,6 +308,7 @@ to the detailed description below for a 
       --suffix=SUFFIX         backup suffix (default ~ w/o --backup-dir)
   -u, --update                skip files that are newer on the receiver
       --inplace               update destination files in-place
@@ -271,8 +271,8 @@ an ftp client, appending new data onto the end of the files it updates.
  dit(bf(-d, --dirs)) Tell the sending side to include any directories that
  are encountered.  Unlike bf(--recursive), a directory's contents are not copied
  unless the directory was specified on the command-line as either "." or a
---- orig/sender.c      2005-02-26 03:22:59
-+++ sender.c   2005-02-20 00:17:01
+--- orig/sender.c      2005-03-16 02:19:30
++++ sender.c   2005-03-16 02:25:18
 @@ -28,6 +28,7 @@ extern int log_format_has_i;
  extern int daemon_log_format_has_i;
  extern int csum_length;
@@ -281,7 +281,7 @@ an ftp client, appending new data onto the end of the files it updates.
  extern int protocol_version;
  extern int remove_sent_files;
  extern int updating_basis_file;
-@@ -67,6 +68,13 @@ static struct sum_struct *receive_sums(i
+@@ -68,6 +69,13 @@ static struct sum_struct *receive_sums(i
                        (double)s->count, (long)s->blength, (long)s->remainder);
        }
  
@@ -295,11 +295,11 @@ an ftp client, appending new data onto the end of the files it updates.
        if (s->count == 0)
                return(s);
  
-@@ -161,6 +169,7 @@ void send_files(struct file_list *flist,
-                               /* For inplace: redo phase turns off the backup
-                                * flag so that we do a regular inplace send. */
-                               make_backups = 0;
-+                              append_mode = 0;
-                               continue;
-                       }
-                       break;
+@@ -235,6 +243,7 @@ void send_files(struct file_list *flist,
+                       /* For inplace: redo phase turns off the backup
+                        * flag so that we do a regular inplace send. */
+                       make_backups = 0;
++                      append_mode = 0;
+                       continue;
+               }