info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Info-cvs Digest, Vol 3, Issue 42


From: Larry Jones
Subject: Re: Info-cvs Digest, Vol 3, Issue 42
Date: Thu, 27 Feb 2003 12:03:20 -0500 (EST)

Douglas Finkle writes:
> 
> The fix should, IMHO, be applied to the server. Maybe this feature 
> (cvswrappers MERGE directive) is what CVS developers had intended
> to do, but have not yet fully implemented. I wish some of them
> would kindly speak up. :-)

I hate to encourage anyone to use the wrappers functionality, but here
is a patch that attempts to allow wrappers to specify MERGE for binary
files.  It should also allow merge options to work in client/server
mode.  Feel free to test and report back.
 
Index: cvs.h
===================================================================
RCS file: /cvs/ccvs/src/cvs.h,v
retrieving revision 1.241
diff -u -r1.241 cvs.h
--- cvs.h       25 Feb 2003 22:02:13 -0000      1.241
+++ cvs.h       27 Feb 2003 16:26:02 -0000
@@ -876,6 +876,7 @@
 char *wrap_rcsoption PROTO ((const char *fileName, int asFlag));
 char *wrap_tocvs_process_file PROTO((const char *fileName));
 int   wrap_merge_is_copy PROTO((const char *fileName));
+int   wrap_merge_is_merge PROTO((const char *fileName));
 void wrap_fromcvs_process_file PROTO ((const char *fileName));
 void wrap_add_file PROTO((const char *file,int temp));
 void wrap_add PROTO((char *line,int temp));
Index: update.c
===================================================================
RCS file: /cvs/ccvs/src/update.c,v
retrieving revision 1.204
diff -u -r1.204 update.c
--- update.c    9 Feb 2003 04:13:28 -0000       1.204
+++ update.c    27 Feb 2003 16:26:05 -0000
@@ -2003,8 +2003,8 @@
     copy_file (finfo->file, backup);
     xchmod (finfo->file, 1);
 
-    if (strcmp (vers->options, "-kb") == 0
-       || wrap_merge_is_copy (finfo->file)
+    if ((strcmp (vers->options, "-kb") == 0 ? !wrap_merge_is_merge 
(finfo->file)
+                                           : wrap_merge_is_copy (finfo->file))
        || special_file_mismatch (finfo, NULL, vers->vn_rcs))
     {
        /* For binary files, a merge is always a conflict.  Same for
@@ -2165,14 +2165,16 @@
     char *jdate1;
     char *jdate2;
 
-    TRACE ( 1, "join_file(%s, %s%s%s%s, %s, %s)",
-           finfo->file,
-           vers->tag ? vers->tag : "",
-           vers->tag ? " (" : "",
-           vers->vn_rcs ? vers->vn_rcs : "",
-           vers->tag ? ")" : "",
-           join_rev1 ? join_rev1 : "",
-           join_rev2 ? join_rev2 : "" );
+    if (trace)
+       fprintf (stderr, "%s-> join_file(%s, %s%s%s%s, %s, %s)\n",
+               CLIENT_SERVER_STR,
+               finfo->file,
+               vers->tag ? vers->tag : "",
+               vers->tag ? " (" : "",
+               vers->vn_rcs ? vers->vn_rcs : "",
+               vers->tag ? ")" : "",
+               join_rev1 ? join_rev1 : "",
+               join_rev2 ? join_rev2 : "");
 
     jrev1 = join_rev1;
     jrev2 = join_rev2;
@@ -2524,8 +2526,8 @@
 
        /* Avoid this in the text file case.  See below for why.
         */
-       && (strcmp (t_options, "-kb") == 0
-           || wrap_merge_is_copy (finfo->file)))
+       && (strcmp (t_options, "-kb") == 0 ? !wrap_merge_is_merge (finfo->file)
+                                          : wrap_merge_is_copy (finfo->file)))
     {
        /* FIXME: Verify my comment below:
         *
@@ -2567,8 +2569,8 @@
           print.  */
        write_letter (finfo, 'U');
     }
-    else if (strcmp (t_options, "-kb") == 0
-            || wrap_merge_is_copy (finfo->file)
+    else if ((strcmp (t_options, "-kb") == 0 ? !wrap_merge_is_merge 
(finfo->file)
+                                           : wrap_merge_is_copy (finfo->file))
             || special_file_mismatch (finfo, rev1, rev2))
     {
        /* We are dealing with binary files, or files with a
Index: wrapper.c
===================================================================
RCS file: /cvs/ccvs/src/wrapper.c,v
retrieving revision 1.31
diff -u -r1.31 wrapper.c
--- wrapper.c   23 May 2002 18:13:17 -0000      1.31
+++ wrapper.c   27 Feb 2003 16:26:05 -0000
@@ -170,11 +170,6 @@
               and (more importantly) where we found it.  */
            error (0, 0, "\
 -t and -f wrapper options are not supported remotely; ignored");
-       if (wrap_list[i]->mergeMethod == WRAP_COPY)
-           /* For greater studliness we would print the offending option
-              and (more importantly) where we found it.  */
-           error (0, 0, "\
--m wrapper option is not supported remotely; ignored");
        send_to_server ("Argument -W\012Argument ", 0);
        send_to_server (wrap_list[i]->wildCard, 0);
        send_to_server (" -k '", 0);
@@ -182,6 +177,11 @@
            send_to_server (wrap_list[i]->rcsOption, 0);
        else
            send_to_server ("kv", 0);
+       if (wrap_list[i]->mergeMethod !=
+               (wrap_list[i]->rcsOption && wrap_list[i]->rcsOption[0] == 'b')
+               ? WRAP_COPY : WRAP_MERGE)
+           send_to_server (wrap_list[i]->mergeMethod == WRAP_COPY ?
+                               "' -m 'COPY" : "' -m 'MERGE", 0);
        send_to_server ("'\012", 0);
     }
 }
@@ -574,10 +574,15 @@
     const char *fileName;
 {
     WrapperEntry *e=wrap_matching_entry(fileName);
-    if(e==NULL || e->mergeMethod==WRAP_MERGE)
-       return 0;
+    return (e != NULL && e->mergeMethod == WRAP_COPY);
+}
 
-    return 1;
+int
+wrap_merge_is_merge (fileName)
+    const char *fileName;
+{
+    WrapperEntry *e=wrap_matching_entry(fileName);
+    return (e != NULL && e->mergeMethod == WRAP_MERGE);
 }
 
 void

-Larry Jones

Just when I thought this junk was beginning to make sense. -- Calvin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]