cvs-cvs
[Top][All Lists]
Advanced

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

[Cvs-cvs] ccvs/src ChangeLog checkout.c commit.c diff.c s... [cvs1-11-x-


From: Mark D. Baushke
Subject: [Cvs-cvs] ccvs/src ChangeLog checkout.c commit.c diff.c s... [cvs1-11-x-branch]
Date: Wed, 05 Nov 2008 15:13:46 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Branch:         cvs1-11-x-branch
Changes by:     Mark D. Baushke <mdb>   08/11/05 15:13:44

Modified files:
        src            : ChangeLog checkout.c commit.c diff.c sanity.sh 
                         update.c 

Log message:
        *diff.c (diff): Use SEND_FORCE on files when a -k option is used
        with diff to avoid client/server not finding the requested file.
        * sanity.sh (keyword): Add tests for this.
        
        * checkout.c (checkout): For multiroot checkout/update operations,
        do not assume that the static join_rev1 and join_rev2 strings will
        not be seen again with another repository.
        * update.c (update): Ditto.
        * commit.c (commit): For multiroot commits with -F logmessage
        do not generate "cannot specify both a message and a log file"
        errors. Track the use of -m as an argument explicitly.
        (finaladd): API change to pass the saved_message.
        (check_fileproc, commit_fileproc, commit_filesdoneproc): Pass the
        saved_message via the callerdat block.
        (commit_direntproc): Ditto.
        * sanity.sh (multiroot-{commit-2,update-join-{1,2},admin-{1,2,3,4}}):
        Do commits with -F logmessage to test above and also look at other
        broken behavior which needs to be fixed. There are some FIXME
        tests here which should be addressed.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/ChangeLog?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.2336.2.509&r2=1.2336.2.510
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/checkout.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.107.4.14&r2=1.107.4.15
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/commit.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.187.4.38&r2=1.187.4.39
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/diff.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.94.2.10&r2=1.94.2.11
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/sanity.sh?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.752.2.220&r2=1.752.2.221
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/update.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.202.4.34&r2=1.202.4.35

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/ChangeLog,v
retrieving revision 1.2336.2.509
retrieving revision 1.2336.2.510
diff -u -b -r1.2336.2.509 -r1.2336.2.510
--- ChangeLog   12 Sep 2008 15:34:44 -0000      1.2336.2.509
+++ ChangeLog   5 Nov 2008 15:13:39 -0000       1.2336.2.510
@@ -1,3 +1,25 @@
+2008-11-05  Mark D. Baushke  <address@hidden>
+
+       *diff.c (diff): Use SEND_FORCE on files when a -k option is used
+       with diff to avoid client/server not finding the requested file.
+       * sanity.sh (keyword): Add tests for this.
+
+       * checkout.c (checkout): For multiroot checkout/update operations,
+       do not assume that the static join_rev1 and join_rev2 strings will
+       not be seen again with another repository.
+       * update.c (update): Ditto.
+       * commit.c (commit): For multiroot commits with -F logmessage
+       do not generate "cannot specify both a message and a log file"
+       errors. Track the use of -m as an argument explicitly.
+       (finaladd): API change to pass the saved_message.
+       (check_fileproc, commit_fileproc, commit_filesdoneproc): Pass the
+       saved_message via the callerdat block.
+       (commit_direntproc): Ditto.
+       * sanity.sh (multiroot-{commit-2,update-join-{1,2},admin-{1,2,3,4}}):
+       Do commits with -F logmessage to test above and also look at other
+       broken behavior which needs to be fixed. There are some FIXME
+       tests here which should be addressed.
+
 2008-09-12  Derek R. Price  <address@hidden>
 
        [bug #17565] (Patch from Susanne Bertling <address@hidden>).

Index: checkout.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/checkout.c,v
retrieving revision 1.107.4.14
retrieving revision 1.107.4.15
diff -u -b -r1.107.4.14 -r1.107.4.15
--- checkout.c  23 Sep 2005 16:42:59 -0000      1.107.4.14
+++ checkout.c  5 Nov 2008 15:13:40 -0000       1.107.4.15
@@ -115,6 +115,7 @@
     int shorten = -1;
     char *where = NULL;
     char *valid_options;
+    int jrev_count = 0;
     const char *const *valid_usage;
 
     /* initialize static options */
@@ -219,11 +220,12 @@
                checkout_prune_dirs = 1;
                break;
            case 'j':
-               if (join_rev2)
+               jrev_count++;
+               if (jrev_count > 2)
                    error (1, 0, "only two -j options can be specified");
-               if (join_rev1)
+               if (jrev_count == 2)
                    join_rev2 = optarg;
-               else
+               else if (jrev_count == 1)
                    join_rev1 = optarg;
                break;
            case '?':

Index: commit.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/commit.c,v
retrieving revision 1.187.4.38
retrieving revision 1.187.4.39
diff -u -b -r1.187.4.38 -r1.187.4.39
--- commit.c    31 May 2006 15:15:56 -0000      1.187.4.38
+++ commit.c    5 Nov 2008 15:13:40 -0000       1.187.4.39
@@ -51,7 +51,7 @@
                                         const char *update_dir,
                                         List *entries));
 static int finaladd PROTO((struct file_info *finfo, char *revision, char *tag,
-                          char *options));
+                          char *options, char *msg));
 static int findmaxrev PROTO((Node * p, void *closure));
 static int lock_RCS PROTO((const char *user, RCSNode *rcs, const char *rev,
                           const char *repository));
@@ -78,6 +78,10 @@
     List *cilist;                      /* list with commit_info structs */
 };
 
+struct commit_data
+{
+    char *saved_message;
+};
 static int force_ci = 0;
 static int got_message;
 static int aflag;
@@ -87,7 +91,6 @@
 static char *logfile;
 static List *mulist;
 static List *saved_ulist;
-static char *saved_message;
 static time_t last_register_time;
 
 static const char *const commit_usage[] =
@@ -376,6 +379,9 @@
     int c;
     int err = 0;
     int local = 0;
+    struct commit_data commit_data;
+
+    memset(&commit_data, 0, sizeof commit_data);
 
     if (argc == -1)
        usage (commit_usage);
@@ -421,13 +427,13 @@
 #else
                use_editor = 0;
 #endif
-               if (saved_message)
+               if (commit_data.saved_message)
                {
-                   free (saved_message);
-                   saved_message = NULL;
+                   free (commit_data.saved_message);
+                   commit_data.saved_message = NULL;
                }
 
-               saved_message = xstrdup(optarg);
+               commit_data.saved_message = xstrdup(optarg);
                break;
            case 'r':
                if (saved_tag)
@@ -478,10 +484,11 @@
     {
        size_t size = 0, len;
 
-       if (saved_message)
+       if (commit_data.saved_message)
            error (1, 0, "cannot specify both a message and a log file");
 
-       get_file (logfile, logfile, "r", &saved_message, &size, &len);
+       get_file (logfile, logfile, "r", &commit_data.saved_message,
+                 &size, &len);
     }
 
 #ifdef CLIENT_SUPPORT
@@ -551,10 +558,12 @@
         * The protocol is designed this way.  This is a feature.
         */
        if (use_editor)
-           do_editor (".", &saved_message, (char *)NULL, find_args.ulist);
+           do_editor (".", &commit_data.saved_message, NULL,
+                      find_args.ulist);
 
        /* We always send some sort of message, even if empty.  */
-       option_with_arg ("-m", saved_message ? saved_message : "");
+       option_with_arg ("-m", commit_data.saved_message
+                        ? commit_data.saved_message : "");
 
        /* OK, now process all the questionable files we have been saving
           up.  */
@@ -627,7 +636,7 @@
 
        send_to_server ("ci\012", 0);
        err = get_responses_and_close ();
-       if (err != 0 && use_editor && saved_message != NULL)
+       if (err != 0 && use_editor && commit_data.saved_message != NULL)
        {
            /* If there was an error, don't nuke the user's carefully
               constructed prose.  This is something of a kludge; a better
@@ -645,8 +654,9 @@
            if (fp == NULL)
                error (1, 0, "cannot create temporary file %s",
                       fname ? fname : "(null)");
-           if (fwrite (saved_message, 1, strlen (saved_message), fp)
-               != strlen (saved_message))
+           if (fwrite (commit_data.saved_message, 1,
+                       strlen (commit_data.saved_message), fp)
+               != strlen (commit_data.saved_message))
                error (1, errno, "cannot write temporary file %s", fname);
            if (fclose (fp) < 0)
                error (0, errno, "cannot close temporary file %s", fname);
@@ -691,8 +701,8 @@
      */
     err = start_recursion (check_fileproc, check_filesdoneproc,
                           check_direntproc, (DIRLEAVEPROC) NULL, NULL, argc,
-                          argv, local, W_LOCAL, aflag, CVS_LOCK_NONE,
-                          (char *) NULL, 1, (char *) NULL);
+                          argv, local, W_LOCAL, aflag,
+                          CVS_LOCK_NONE, (char *) NULL, 1, (char *) NULL);
     if (err)
     {
        Lock_Cleanup ();
@@ -705,9 +715,10 @@
     write_dirnonbranch = 0;
     if (noexec == 0)
        err = start_recursion (commit_fileproc, commit_filesdoneproc,
-                              commit_direntproc, commit_dirleaveproc, NULL,
-                              argc, argv, local, W_LOCAL, aflag, CVS_LOCK_NONE,
-                              (char *) NULL, 1, (char *) NULL);
+                              commit_direntproc, commit_dirleaveproc,
+                              &commit_data,
+                              argc, argv, local, W_LOCAL, aflag,
+                              CVS_LOCK_NONE, (char *) NULL, 1, (char *) NULL);
 
     /*
      * Unlock all the dirs and clean up
@@ -715,6 +726,12 @@
     Lock_Cleanup ();
     dellist (&mulist);
 
+    if (commit_data.saved_message)
+    {
+       free(commit_data.saved_message);
+       commit_data.saved_message = NULL;
+    }
+
     if (server_active)
        return err;
 
@@ -835,6 +852,7 @@
     Vers_TS *vers;
     struct commit_info *ci;
     struct logfile_info *li;
+    struct commit_data *commit_data = callerdat;
 
     size_t cvsroot_len = strlen (current_parsed_root->directory);
 
@@ -1237,6 +1255,7 @@
     int err = 0;
     List *ulist, *cilist;
     struct commit_info *ci;
+    struct commit_data *commit_data = callerdat;
 
     /* Keep track of whether write_dirtag is a branch tag.
        Note that if it is a branch tag in some files and a nonbranch tag
@@ -1276,9 +1295,9 @@
     {
        got_message = 1;
        if (!server_active && use_editor)
-           do_editor (finfo->update_dir, &saved_message,
+           do_editor (finfo->update_dir, &commit_data->saved_message,
                       finfo->repository, ulist);
-       do_verify (&saved_message, finfo->repository);
+       do_verify (&commit_data->saved_message, finfo->repository);
     }
 
     p = findnode (cilist, finfo->file);
@@ -1325,7 +1344,7 @@
                free (ci->rev);
            ci->rev = RCS_whatbranch (finfo->rcs, ci->tag);
            err = Checkin ('A', finfo, ci->rev,
-                          ci->tag, ci->options, saved_message);
+                          ci->tag, ci->options, commit_data->saved_message);
            if (err != 0)
            {
                unlockrcs (finfo->rcs);
@@ -1363,14 +1382,15 @@
        }
 
        /* XXX - an added file with symbolic -r should add tag as well */
-       err = finaladd (finfo, ci->rev ? ci->rev : xrev, ci->tag, ci->options);
+       err = finaladd (finfo, ci->rev ? ci->rev : xrev, ci->tag, ci->options,
+                       commit_data->saved_message);
        if (xrev)
            free (xrev);
     }
     else if (ci->status == T_MODIFIED)
     {
        err = Checkin ('M', finfo, ci->rev, ci->tag,
-                      ci->options, saved_message);
+                      ci->options, commit_data->saved_message);
 
        (void) time (&last_register_time);
 
@@ -1382,7 +1402,7 @@
     }
     else if (ci->status == T_REMOVED)
     {
-       err = remove_file (finfo, ci->tag, saved_message);
+       err = remove_file (finfo, ci->tag, commit_data->saved_message);
 #ifdef SERVER_SUPPORT
        if (server_active) {
            server_scratch_entry_only ();
@@ -1460,6 +1480,7 @@
 {
     Node *p;
     List *ulist;
+    struct commit_data *commit_data = callerdat;
 
     assert (repository);
 
@@ -1471,7 +1492,8 @@
 
     got_message = 0;
 
-    Update_Logfile (repository, saved_message, (FILE *) 0, ulist);
+    Update_Logfile (repository, commit_data->saved_message,
+                   (FILE *) 0, ulist);
 
     /* Build the administrative files if necessary.  */
     {
@@ -1535,6 +1557,7 @@
     Node *p;
     List *ulist;
     char *real_repos;
+    struct commit_data *commit_data = callerdat;
 
     if (!isdir (dir))
        return R_SKIP_ALL;
@@ -1554,8 +1577,9 @@
     real_repos = Name_Repository (dir, update_dir);
     got_message = 1;
     if (!server_active && use_editor)
-       do_editor (update_dir, &saved_message, real_repos, ulist);
-    do_verify (&saved_message, real_repos);
+       do_editor (update_dir, &commit_data->saved_message,
+                  real_repos, ulist);
+    do_verify (&commit_data->saved_message, real_repos);
     free (real_repos);
     return R_PROCESS;
 }
@@ -1782,15 +1806,16 @@
  * Do the actual checkin for added files
  */
 static int
-finaladd (finfo, rev, tag, options)
+finaladd (finfo, rev, tag, options, lmsg)
     struct file_info *finfo;
     char *rev;
     char *tag;
     char *options;
+    char *lmsg;
 {
     int ret;
 
-    ret = Checkin ('A', finfo, rev, tag, options, saved_message);
+    ret = Checkin ('A', finfo, rev, tag, options, lmsg);
     if (ret == 0)
     {
        char *tmp = xmalloc (strlen (finfo->file) + sizeof (CVSADM)

Index: diff.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/diff.c,v
retrieving revision 1.94.2.10
retrieving revision 1.94.2.11
diff -u -b -r1.94.2.10 -r1.94.2.11
--- diff.c      27 May 2005 16:25:11 -0000      1.94.2.10
+++ diff.c      5 Nov 2008 15:13:40 -0000       1.94.2.11
@@ -413,7 +413,10 @@
        options = xstrdup ("");
 
 #ifdef CLIENT_SUPPORT
-    if (current_parsed_root->isremote) {
+    if (current_parsed_root->isremote)
+    {
+       int flags;
+
        /* We're the client side.  Fire up the remote server.  */
        start_server ();
        
@@ -437,10 +440,13 @@
        send_arg ("--");
 
        /* Send the current files unless diffing two revs from the archive */
-       if (diff_rev2 == NULL && diff_date2 == NULL)
-           send_files (argc, argv, local, 0, 0);
-       else
-           send_files (argc, argv, local, 0, SEND_NO_CONTENTS);
+       flags = 0;
+       if (diff_rev2 != NULL || diff_date2 != NULL)
+           flags |= SEND_NO_CONTENTS;
+       else if (options[0] != '\0')
+           flags |= SEND_FORCE;
+
+       send_files (argc, argv, local, 0, flags);
 
        send_file_names (argc, argv, SEND_EXPAND_WILD);
 

Index: sanity.sh
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/sanity.sh,v
retrieving revision 1.752.2.220
retrieving revision 1.752.2.221
diff -u -b -r1.752.2.220 -r1.752.2.221
--- sanity.sh   12 Sep 2008 15:34:45 -0000      1.752.2.220
+++ sanity.sh   5 Nov 2008 15:13:41 -0000       1.752.2.221
@@ -23157,6 +23157,17 @@
          dotest keyword-23 "$testcvs update -A file1" "U file1"
          dotest keyword-24 "cat file1" '\$'"Name:  "'\$'"
 change"
+         dotest_fail keyword-25 "${testcvs} diff -kk file1" \
+"Index: file1
+===================================================================
+RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
+retrieving revision 1\.3
+diff -r1\.3 file1
+1c1
+< \$Name\$
+---
+> \$Name:  $"
+         dotest keyword-26 "${testcvs} diff -kkv file1" ""
 
          cd ../..
          rm -r 1
@@ -27607,6 +27618,77 @@
 new revision: 1.2; previous revision: 1.1
 done"
 
+         echo Extra-line >> mod1-1/file1-1
+         echo Extra-line >> mod2-2/file2-2
+         echo 'Using a message file.' >log-message.txt
+         dotest multiroot-commit-2 \
+"${testcvs} commit -F log-message.txt mod1-1/file1-1 mod2-2/file2-2" \
+"Checking in mod1-1/file1-1;
+${CVSROOT1_DIRNAME}/mod1-1/file1-1,v  <--  file1-1
+new revision: 1\.3; previous revision: 1\.2
+done
+Checking in mod2-2/file2-2;
+${CVSROOT2_DIRNAME}/mod2-2/file2-2,v  <--  file2-2
+new revision: 1\.3; previous revision: 1\.2
+done"
+         dotest multiroot-update-join-1 \
+"${testcvs} update -j1.3 -j1.2 mod1-1/file1-1 mod2-2/file2-2" \
+"RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
+retrieving revision 1\.3
+retrieving revision 1\.2
+Merging differences between 1\.3 and 1\.2 into file1-1
+RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
+retrieving revision 1\.3
+retrieving revision 1\.2
+Merging differences between 1\.3 and 1\.2 into file2-2"
+         dotest multiroot-update-join-2 \
+"${testcvs} -Q update -C mod1-1/file1-1 mod2-2/file2-2" \
+""
+         
+         rm log-message.txt
+         dotest multiroot-admin-1 "${testcvs} admin -o1.3 mod1-1/file1-1" \
+"RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
+deleting revision 1\.3
+done"
+         # FIXME: For $remote operation, an error like:
+         # cvs [admin aborted]: no such directory `mod2-2'
+         # will happen if the CVS/Root has $CVSROOT1 in it.
+         # If CVS is missing and there is no CVSROOT environment
+         # variable, there is also a "No CVSROOT specified!"
+         # error which really needs to be fixed too.
+          dotest multiroot-admin-2 \
+"${testcvs} -d ${CVSROOT2} admin -o1.3 mod2-2/file2-2" \
+"RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
+deleting revision 1\.3
+done"
+
+         # FIXME: Just becuase CVS/Root does not have a mod2-2
+         # directory does not mean that recurse should print that
+         # error.
+         dotest multiroot-admin-3 "${testcvs} status mod2-2/file2-2" \
+"===================================================================
+File: file2-2                  Status: Needs Patch
+
+   Working revision:   1\.3    ${DATE}
+   Repository revision:        1\.2    ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
+   Sticky Tag:         (none)
+   Sticky Date:                (none)
+   Sticky Options:     (none)" \
+"${PROG} \[status aborted\]: no such directory \`mod2-2'
+===================================================================
+File: file2-2                  Status: Needs Patch
+
+   Working revision:   1\.3
+   Repository revision:        1\.2    ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
+   Sticky Tag:         (none)
+   Sticky Date:                (none)
+   Sticky Options:     (none)"
+
+         dotest multiroot-admin-4 \
+"${testcvs} update mod1-1/file1-1 mod2-2/file2-2" \
+"U mod1-1/file1-1
+U mod2-2/file2-2"
+
          dotest multiroot-update-2 "${testcvs} update" \
 "${PROG} update: Updating \.
 ${PROG} [a-z]*: Updating mod1-1

Index: update.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/update.c,v
retrieving revision 1.202.4.34
retrieving revision 1.202.4.35
diff -u -b -r1.202.4.34 -r1.202.4.35
--- update.c    7 May 2008 15:34:17 -0000       1.202.4.34
+++ update.c    5 Nov 2008 15:13:43 -0000       1.202.4.35
@@ -144,6 +144,7 @@
     int c, err;
     int local = 0;                     /* recursive by default */
     int which;                         /* where to look for files and dirs */
+    int jrev_count = 0;                        /* multiple cvsroot w/ -j 
options */
 
     if (argc == -1)
        usage (update_usage);
@@ -210,11 +211,12 @@
                noexec = 1;             /* so no locks will be created */
                break;
            case 'j':
-               if (join_rev2)
+               jrev_count++;
+               if (jrev_count > 2)
                    error (1, 0, "only two -j options can be specified");
-               if (join_rev1)
+               if (jrev_count == 2)
                    join_rev2 = optarg;
-               else
+               else if (jrev_count == 1)
                    join_rev1 = optarg;
                break;
            case 'u':




reply via email to

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