Updated to work with latest g2r changes.
authorWayne Davison <wayned@samba.org>
Wed, 3 Nov 2004 23:00:57 +0000 (23:00 +0000)
committerWayne Davison <wayned@samba.org>
Wed, 3 Nov 2004 23:00:57 +0000 (23:00 +0000)
compare-dest.diff
fuzzy.diff

index ec4cdaa..8d62217 100644 (file)
@@ -1,5 +1,3 @@
-Depends-On-Patch: g2r-basis-filename.diff
-
 This patch allows multiple --compare-dest or --link-dest options to be
 used, making the transfer of some files more optimal.  Note that the
 algorithm does NOT search for the best match -- it stops at the first
@@ -9,8 +7,8 @@ they are suppled).
 
 Before compiling, be sure to run "make proto".
 
---- orig/generator.c   2004-10-09 04:06:49
-+++ generator.c        2004-10-09 03:35:50
+--- orig/generator.c   2004-11-03 20:30:45
++++ generator.c        2004-11-03 22:47:23
 @@ -45,7 +45,7 @@ extern int io_timeout;
  extern int protocol_version;
  extern int always_checksum;
@@ -22,7 +20,7 @@ Before compiling, be sure to run "make proto".
  extern int local_server;
 @@ -424,11 +424,19 @@ static void recv_generator(char *fname, 
        fnamecmp = fname;
-       fnamecmp_type = G2R_FNAME;
+       fnamecmp_type = FNAMECMP_FNAME;
  
 -      if (statret == -1 && compare_dest != NULL) {
 +      if (statret == -1 && compare_dest[0] != NULL) {
@@ -48,21 +46,21 @@ Before compiling, be sure to run "make proto".
                                                        safe_fname(fname));
                                        }
                                        fnamecmp = fnamecmpbuf;
--                                      fnamecmp_type = 0;
-+                                      fnamecmp_type = i;
+-                                      fnamecmp_type = FNAMECMP_CMPDEST;
++                                      fnamecmp_type = FNAMECMP_CMPDEST + i;
                                }
                        } else
  #endif
                        {
                                fnamecmp = fnamecmpbuf;
--                              fnamecmp_type = 0;
-+                              fnamecmp_type = i;
+-                              fnamecmp_type = FNAMECMP_CMPDEST;
++                              fnamecmp_type = FNAMECMP_CMPDEST + i;
                        }
 -                      statret = 0;
                }
        }
  
---- orig/main.c        2004-10-09 03:25:43
+--- orig/main.c        2004-11-03 20:30:45
 +++ main.c     2004-07-30 07:23:54
 @@ -59,7 +59,7 @@ extern int filesfrom_fd;
  extern pid_t cleanup_child_pid;
@@ -237,9 +235,9 @@ Before compiling, be sure to run "make proto".
        }
  
        if (files_from && (!am_sender || remote_filesfrom_file)) {
---- orig/receiver.c    2004-09-07 21:57:20
-+++ receiver.c 2004-07-30 07:31:12
-@@ -38,7 +38,7 @@ extern int cvs_exclude;
+--- orig/receiver.c    2004-11-03 20:30:45
++++ receiver.c 2004-11-03 22:50:43
+@@ -39,7 +39,7 @@ extern int cvs_exclude;
  extern int io_error;
  extern char *tmpdir;
  extern char *partial_dir;
@@ -248,18 +246,18 @@ Before compiling, be sure to run "make proto".
  extern int make_backups;
  extern int do_progress;
  extern char *backup_dir;
-@@ -438,7 +438,8 @@ int recv_files(int f_in, struct file_lis
+@@ -439,7 +439,8 @@ int recv_files(int f_in, struct file_lis
                partialptr = partial_dir ? partial_dir_fname(fname) : fname;
  
                if (f_in_name >= 0) {
 -                      switch (read_byte(f_in_name)) {
 +                      uchar j;
 +                      switch (j = read_byte(f_in_name)) {
-                       case G2R_FNAME:
+                       case FNAMECMP_FNAME:
                                fnamecmp = fname;
                                break;
-@@ -450,7 +451,7 @@ int recv_files(int f_in, struct file_lis
-                               break;
+@@ -452,7 +453,7 @@ int recv_files(int f_in, struct file_lis
+                       case FNAMECMP_CMPDEST:
                        default:
                                pathjoin(fnamecmpbuf, sizeof fnamecmpbuf,
 -                                       compare_dest, fname);
@@ -267,7 +265,7 @@ Before compiling, be sure to run "make proto".
                                fnamecmp = fnamecmpbuf;
                                break;
                        }
---- orig/rsync.h       2004-09-07 21:52:22
+--- orig/rsync.h       2004-11-03 20:30:45
 +++ rsync.h    2004-07-30 07:23:54
 @@ -98,6 +98,8 @@
  
index d3ce6ce..ba02e1d 100644 (file)
@@ -1,13 +1,11 @@
-Depends-On-Patch: g2r-basis-filename.diff
-
 The changes to generator.c were greatly simplified, making the patch
 easier to maintain and fixing the failing test in the testsuite.
 Very lightly tested.
 
 Be sure to run "make proto" before "make".
 
---- orig/generator.c   2004-10-09 04:06:49
-+++ generator.c        2004-09-23 15:33:08
+--- orig/generator.c   2004-11-03 20:30:45
++++ generator.c        2004-11-03 22:52:53
 @@ -43,6 +43,7 @@ extern int ignore_times;
  extern int size_only;
  extern int io_timeout;
@@ -118,7 +116,7 @@ Be sure to run "make proto" before "make".
 +                  && S_ISREG(st.st_mode)) {
 +                      statret = 0;
 +                      fnamecmp = fnamecmpbuf;
-+                      fnamecmp_type = G2R_FUZZY;
++                      fnamecmp_type = FNAMECMP_FUZZY;
 +              }
 +      }
 +
@@ -130,15 +128,18 @@ Be sure to run "make proto" before "make".
        }
  
 -      if (skip_file(fnamecmp, file, &st)) {
-+      if (fnamecmp_type != G2R_FUZZY && skip_file(fnamecmp, file, &st)) {
-               if (fnamecmp_type == G2R_FNAME)
++      if (fnamecmp_type != FNAMECMP_FUZZY && skip_file(fnamecmp, file, &st)) {
+               if (fnamecmp_type == FNAMECMP_FNAME)
                        set_perms(fname, file, &st, PERMS_REPORT);
                return;
-@@ -564,6 +660,21 @@ prepare_to_open:
+@@ -563,8 +659,24 @@ prepare_to_open:
  notify_others:
-       if (f_out_name >= 0) {
+       write_int(f_out, i);
+-      if (f_out_name >= 0)
++      if (f_out_name >= 0) {
                write_byte(f_out_name, fnamecmp_type);
-+              if (fnamecmp_type == G2R_FUZZY) {
++              if (fnamecmp_type == FNAMECMP_FUZZY) {
 +                      uchar lenbuf[3], *lb = lenbuf;
 +                      int len = strlen(fnamecmpbuf);
 +                      if (len > 0x7F) {
@@ -153,10 +154,11 @@ Be sure to run "make proto" before "make".
 +                      write_buf(f_out_name, lenbuf, lb - lenbuf + 1);
 +                      write_buf(f_out_name, fnamecmpbuf, len);
 +              }
-               io_flush(NORMAL_FLUSH); /* XXX make this more efficient! */
-       }
++      }
  
---- orig/main.c        2004-10-09 03:25:43
+       if (dry_run || read_batch)
+               return;
+--- orig/main.c        2004-11-03 20:30:45
 +++ main.c     2004-07-22 00:32:31
 @@ -48,6 +48,7 @@ extern int keep_dirlinks;
  extern int preserve_hard_links;
@@ -223,9 +225,9 @@ Be sure to run "make proto" before "make".
        *argc = ac;
        return;
  
---- orig/receiver.c    2004-09-07 21:57:20
-+++ receiver.c 2004-07-30 18:21:38
-@@ -319,6 +319,27 @@ static int receive_data(int f_in, char *
+--- orig/receiver.c    2004-11-03 20:30:45
++++ receiver.c 2004-11-03 22:54:05
+@@ -320,6 +320,27 @@ static int receive_data(int f_in, char *
  }
  
  
@@ -253,24 +255,24 @@ Be sure to run "make proto" before "make".
  static void discard_receive_data(int f_in, OFF_T length)
  {
        receive_data(f_in, NULL, -1, 0, NULL, -1, length);
-@@ -448,6 +469,10 @@ int recv_files(int f_in, struct file_lis
-                       case G2R_BACKUP:
+@@ -449,6 +470,10 @@ int recv_files(int f_in, struct file_lis
+                       case FNAMECMP_BACKUP:
                                fnamecmp = get_backup_name(fname);
                                break;
-+                      case G2R_FUZZY:
++                      case FNAMECMP_FUZZY:
 +                              read_gen_name(f_in_name, fnamecmpbuf);
 +                              fnamecmp = fnamecmpbuf;
 +                              break;
+                       case FNAMECMP_CMPDEST:
                        default:
                                pathjoin(fnamecmpbuf, sizeof fnamecmpbuf,
-                                        compare_dest, fname);
---- orig/rsync.h       2004-09-07 21:52:22
-+++ rsync.h    2004-09-07 22:02:37
-@@ -122,6 +122,7 @@
- #define G2R_FNAME     0x80
- #define G2R_PARTIAL_DIR       0x81
- #define G2R_BACKUP    0x82
-+#define G2R_FUZZY     0x83
+--- orig/rsync.h       2004-11-03 20:30:45
++++ rsync.h    2004-11-03 22:53:09
+@@ -123,6 +123,7 @@
+ #define FNAMECMP_FNAME                0x80
+ #define FNAMECMP_PARTIAL_DIR  0x81
+ #define FNAMECMP_BACKUP       0x82
++#define FNAMECMP_FUZZY                0x83
  
  
  /* Log-message categories.  FLOG is only used on the daemon side to