cvs-cvs
[Top][All Lists]
Advanced

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

[Cvs-cvs] ccvs/src ChangeLog diff.c base.c base.h rcs.c r... [signed-com


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/src ChangeLog diff.c base.c base.h rcs.c r... [signed-commits3]
Date: Fri, 20 Jan 2006 03:12:30 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Branch:         signed-commits3
Changes by:     Derek Robert Price <address@hidden>     06/01/20 03:12:29

Modified files:
        src            : ChangeLog diff.c base.c base.h rcs.c rcs.h 
                         checkin.c import.c no_diff.c update.c 

Log message:
        * diff.c (have_rev1_label, have_rev2_label): Make boolean.
        (diff_file_nodiff): Accept a tag for Name keywords.
        (diff_fileproc): Factor some functionality to...
        * base.c (base_diff), base.h: ...this new function.
        
        * rcs.c (RCS_cmp_file), rcs.h: Accept a tag for Name keywords.
        * checkin.c, import.c, no_diff.c, update.c: Update all callers.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/ChangeLog.diff?only_with_tag=signed-commits3&tr1=1.3328.2.39&tr2=1.3328.2.40&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/diff.c.diff?only_with_tag=signed-commits3&tr1=1.116.6.6&tr2=1.116.6.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/base.c.diff?only_with_tag=signed-commits3&tr1=1.1.4.4&tr2=1.1.4.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/base.h.diff?only_with_tag=signed-commits3&tr1=1.1.4.1&tr2=1.1.4.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/rcs.c.diff?only_with_tag=signed-commits3&tr1=1.356.6.10&tr2=1.356.6.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/rcs.h.diff?only_with_tag=signed-commits3&tr1=1.82.8.6&tr2=1.82.8.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/checkin.c.diff?only_with_tag=signed-commits3&tr1=1.56.2.4&tr2=1.56.2.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/import.c.diff?only_with_tag=signed-commits3&tr1=1.175.6.5&tr2=1.175.6.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/no_diff.c.diff?only_with_tag=signed-commits3&tr1=1.38.8.1&tr2=1.38.8.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/update.c.diff?only_with_tag=signed-commits3&tr1=1.259.2.5&tr2=1.259.2.6&r1=text&r2=text

Patches:
Index: ccvs/src/ChangeLog
diff -u ccvs/src/ChangeLog:1.3328.2.39 ccvs/src/ChangeLog:1.3328.2.40
--- ccvs/src/ChangeLog:1.3328.2.39      Thu Jan 19 20:07:43 2006
+++ ccvs/src/ChangeLog  Fri Jan 20 03:12:29 2006
@@ -1,5 +1,13 @@
 2006-01-19  Derek Price  <address@hidden>
 
+       * diff.c (have_rev1_label, have_rev2_label): Make boolean.
+       (diff_file_nodiff): Accept a tag for Name keywords.
+       (diff_fileproc): Factor some functionality to...
+       * base.c (base_diff), base.h: ...this new function.
+       
+       * rcs.c (RCS_cmp_file), rcs.h: Accept a tag for Name keywords. 
+       * checkin.c, import.c, no_diff.c, update.c: Update all callers.
+
        * diff.c (diff_file_nodiff): Remove proto and move function before
        first invocation.  Return found revisions in args rather than globals.
        (diff_fileproc): Remove unused variables.  Use new diff_file_nodiff
Index: ccvs/src/base.c
diff -u ccvs/src/base.c:1.1.4.4 ccvs/src/base.c:1.1.4.5
--- ccvs/src/base.c:1.1.4.4     Fri Jan  6 20:37:13 2006
+++ ccvs/src/base.c     Fri Jan 20 03:12:29 2006
@@ -582,3 +582,35 @@
 
     return retval;
 }
+
+
+
+/* Merge revisions REV1 and REV2. */
+int
+base_diff (struct file_info *finfo, int diff_argc, char *const *diff_argv,
+          const char *f1, const char *use_rev1, const char *label1,
+          const char *f2, const char *use_rev2, const char *label2,
+          bool empty_files)
+{
+    int status, err = 2;
+
+    RCS_output_diff_options (diff_argc, diff_argv, empty_files,
+                            use_rev1, use_rev2, finfo->file);
+
+    status = diff_exec (f1, f2, label1, label2, diff_argc, diff_argv, RUN_TTY);
+
+    switch (status)
+    {
+       case -1:                        /* fork failed */
+           error (1, errno, "fork failed while diffing %s",
+                  finfo->fullname);
+       case 0:                         /* everything ok */
+           err = 0;
+           break;
+       default:                        /* other error */
+           err = status;
+           break;
+    }
+
+    return err;
+}
Index: ccvs/src/base.h
diff -u ccvs/src/base.h:1.1.4.1 ccvs/src/base.h:1.1.4.2
--- ccvs/src/base.h:1.1.4.1     Wed Dec 21 13:25:10 2005
+++ ccvs/src/base.h     Fri Jan 20 03:12:29 2006
@@ -56,4 +56,8 @@
                const char *poptions, const char *options,
                const char *urev, const char *rev1, const char *rev2,
                bool join);
+int base_diff (struct file_info *finfo, int diff_argc, char *const *diff_argv,
+              const char *f1, const char *use_rev1, const char *label1,
+              const char *f2, const char *use_rev2, const char *label2,
+              bool empty_files);
 #endif /* BASE_H */
Index: ccvs/src/checkin.c
diff -u ccvs/src/checkin.c:1.56.2.4 ccvs/src/checkin.c:1.56.2.5
--- ccvs/src/checkin.c:1.56.2.4 Tue Jan 10 18:42:38 2006
+++ ccvs/src/checkin.c  Fri Jan 20 03:12:29 2006
@@ -91,7 +91,7 @@
 #endif /* PRESERVE_PERMISSIONS_SUPPORT */
                 && options
                 && (!strcmp (options, "-ko") || !strcmp (options, "-kb")))
-               || !RCS_cmp_file (finfo->rcs, rev, NULL, NULL,
+               || !RCS_cmp_file (finfo->rcs, pvers->tag, rev, NULL, NULL,
                                  options, finfo->file))
                /* The existing file is correct.  We don't have to do
                    anything.  */
Index: ccvs/src/diff.c
diff -u ccvs/src/diff.c:1.116.6.6 ccvs/src/diff.c:1.116.6.7
--- ccvs/src/diff.c:1.116.6.6   Thu Jan 19 20:07:43 2006
+++ ccvs/src/diff.c     Fri Jan 20 03:12:29 2006
@@ -64,7 +64,7 @@
 static char *diff_rev1, *diff_rev2;
 /* Command line dates, from -D option.  Malloc'd.  */
 static char *diff_date1, *diff_date2;
-static int have_rev1_label, have_rev2_label;
+static bool have_rev1_label, have_rev2_label;
 
 /* Revision of the user file, if it is unchanged from something in the
    repository and we want to use that fact.  */
@@ -301,8 +301,6 @@
     if (argc == -1)
        usage (diff_usage);
 
-    have_rev1_label = have_rev2_label = 0;
-
     /*
      * Note that we catch all the valid arguments here, so that we can
      * intercept the -r arguments for doing revision diffs; and -l/-R for a
@@ -504,7 +502,7 @@
 static enum diff_file
 diff_file_nodiff (struct file_info *finfo, Vers_TS *vers,
                   enum diff_file empty_file, char **rev1_cache,
-                 char **use_rev1, char **use_rev2)
+                 const char *arg_rev1, char **use_rev1, char **use_rev2)
 {
     Vers_TS *xvers;
     int retcode;
@@ -734,7 +732,7 @@
      * Run a quick cmp to see if we should bother with a full diff.
      */
 
-    retcode = RCS_cmp_file (vers->srcfile, *use_rev1, rev1_cache,
+    retcode = RCS_cmp_file (vers->srcfile, diff_rev1, *use_rev1, rev1_cache,
                             *use_rev2, *options ? options : vers->options,
                            finfo->file);
 
@@ -750,15 +748,14 @@
 static int
 diff_fileproc (void *callerdat, struct file_info *finfo)
 {
-    int status, err = 2;               /* 2 == trouble, like rcsdiff */
+    int err = 2;               /* 2 == trouble, like rcsdiff */
     Vers_TS *vers;
     enum diff_file empty_file = server_use_bases ()
                                ? DIFF_CLIENT : DIFF_DIFFERENT;
-    char *label1;
-    char *label2;
     char *rev1_cache = NULL;
     char *use_rev1 = NULL, *use_rev2 = NULL;
     const char *f1 = NULL, *f2 = NULL;
+    char *label1 = NULL, *label2 = NULL;
 
     user_file_rev = 0;
     vers = Version_TS (finfo, NULL, NULL, NULL, 1, 0);
@@ -910,6 +907,8 @@
 
     
     empty_file = diff_file_nodiff (finfo, vers, empty_file, &rev1_cache,
+                                  diff_rev1 && !isdigit (diff_rev1[0])
+                                  ? diff_rev1 : vers->tag,
                                   &use_rev1, &use_rev2);
     if (empty_file == DIFF_SAME)
     {
@@ -931,32 +930,6 @@
     cvs_output (finfo->fullname, 0);
     cvs_output ("\n", 1);
 
-    /* Set up file labels appropriate for compatibility with the Larry Wall
-     * implementation of patch if the user didn't specify.  This is irrelevant
-     * according to the POSIX.2 specification.
-     */
-    label1 = NULL;
-    label2 = NULL;
-    /* The user cannot set the rev2 label without first setting the rev1
-     * label.
-     */
-    if (!have_rev2_label)
-    {
-       if (empty_file == DIFF_REMOVED)
-           label2 = make_file_label (DEVNULL, NULL, NULL);
-       else
-           label2 = make_file_label (finfo->fullname, use_rev2,
-                                     vers->srcfile);
-       if (!have_rev1_label)
-       {
-           if (empty_file == DIFF_ADDED)
-               label1 = make_file_label (DEVNULL, NULL, NULL);
-           else
-               label1 = make_file_label (finfo->fullname, use_rev1,
-                                         vers->srcfile);
-       }
-    }
-
     /* Print a header for each file.  */
     cvs_output (
 "===================================================================\n",
@@ -975,6 +948,16 @@
 
     if (empty_file == DIFF_ADDED)
        f1 = DEVNULL;
+    else if (rev1_cache)
+    {
+       /* If this is cached, temp_checkout was not called for the client.
+        */
+       assert (empty_file != DIFF_CLIENT);
+       cvs_output ("retrieving revision ", 0);
+       cvs_output (use_rev1, 0);
+       cvs_output ("\n", 1);
+       f1 = rev1_cache;
+    }
     else
     {
        cvs_output ("retrieving revision ", 0);
@@ -1007,30 +990,35 @@
     else
        f2 = finfo->file;
 
-    RCS_output_diff_options (diff_argc, diff_argv, empty_files,
-                            use_rev1, use_rev2, finfo->file);
-
-    status = diff_exec (f1, f2, label1, label2,
-                       diff_argc, diff_argv, RUN_TTY);
-
-    if (label1) free (label1);
-    if (label2) free (label2);
-
-    switch (status)
+    /* Set up file labels appropriate for compatibility with the Larry Wall
+     * implementation of patch if the user didn't specify.  This is irrelevant
+     * according to the POSIX.2 specification.
+     *
+     * The user cannot set the rev2 label without first setting the rev1
+     * label.
+     */
+    if (!have_rev2_label)
     {
-       case -1:                        /* fork failed */
-           error (1, errno, "fork failed while diffing %s",
-                  vers->srcfile->path);
-       case 0:                         /* everything ok */
-           err = 0;
-           break;
-       default:                        /* other error */
-           err = status;
-           break;
+       if (empty_file == DIFF_REMOVED)
+           label2 = make_file_label (DEVNULL, NULL, NULL);
+       else
+           label2 = make_file_label (finfo->fullname, use_rev2,
+                                     finfo->rcs);
+       if (!have_rev1_label)
+       {
+           if (empty_file == DIFF_ADDED)
+               label1 = make_file_label (DEVNULL, NULL, NULL);
+           else
+               label1 = make_file_label (finfo->fullname, use_rev1,
+                                         finfo->rcs);
+       }
     }
 
+    err = base_diff (finfo, diff_argc, diff_argv, f1, use_rev1, label1,
+                    f2, use_rev2, label2, empty_files);
+
 out:
-    if (empty_file != DIFF_ADDED && f1)
+    if (empty_file != DIFF_ADDED && !rev1_cache && f1)
     {
        if (CVS_UNLINK (f1) < 0)
            error (0, errno, "Failed to remove temp file `%s'", f1);
@@ -1043,6 +1031,11 @@
        free ((char *)f2);
     }
 
+    if (use_rev1) free (use_rev1);
+    if (use_rev2) free (use_rev2);
+    if (label1) free (label1);
+    if (label2) free (label2);
+
     /* Call CVS_UNLINK() rather than unlink_file() below to avoid the check
      * for noexec.
      */
@@ -1055,6 +1048,7 @@
 
     freevers_ts (&vers);
     diff_mark_errors (err);
+
     return err;
 }
 
Index: ccvs/src/import.c
diff -u ccvs/src/import.c:1.175.6.5 ccvs/src/import.c:1.175.6.6
--- ccvs/src/import.c:1.175.6.5 Wed Jan 18 06:18:48 2006
+++ ccvs/src/import.c   Fri Jan 20 03:12:29 2006
@@ -722,7 +722,7 @@
            not NULL?  */
        expand = (vers->srcfile->expand != NULL
                  && vers->srcfile->expand[0] == 'b') ? "-kb" : "-ko";
-       different = RCS_cmp_file (vers->srcfile, vers->vn_rcs, NULL,
+       different = RCS_cmp_file (vers->srcfile, vers->tag, vers->vn_rcs, NULL,
                                  NULL, expand, vfile);
        if (tocvsPath)
            if (unlink_file_dir (tocvsPath) < 0)
Index: ccvs/src/no_diff.c
diff -u ccvs/src/no_diff.c:1.38.8.1 ccvs/src/no_diff.c:1.38.8.2
--- ccvs/src/no_diff.c:1.38.8.1 Tue Jan 10 18:42:38 2006
+++ ccvs/src/no_diff.c  Fri Jan 20 03:12:29 2006
@@ -75,7 +75,8 @@
        options = xstrdup ("");
 
     tocvsPath = wrap_tocvs_process_file (finfo->file);
-    retcode = RCS_cmp_file (vers->srcfile, vers->vn_user, NULL, NULL, options,
+    retcode = RCS_cmp_file (vers->srcfile, vers->tag, vers->vn_user, NULL,
+                           NULL, options,
                            tocvsPath == NULL ? finfo->file : tocvsPath);
     if (retcode == 0)
     {
Index: ccvs/src/rcs.c
diff -u ccvs/src/rcs.c:1.356.6.10 ccvs/src/rcs.c:1.356.6.11
--- ccvs/src/rcs.c:1.356.6.10   Wed Jan 18 06:18:48 2006
+++ ccvs/src/rcs.c      Fri Jan 20 03:12:29 2006
@@ -5989,8 +5989,9 @@
    expansion options.  Return 0 if the contents of the revision are
    the same as the contents of the file, 1 if they are different.  */
 int
-RCS_cmp_file (RCSNode *rcs, const char *rev1, char **rev1_cache,
-              const char *rev2, const char *options, const char *filename)
+RCS_cmp_file (RCSNode *rcs, const char *arg_rev1, const char *rev1,
+             char **rev1_cache, const char *rev2, const char *options,
+             const char *filename)
 {
     int binary;
 
@@ -6050,7 +6051,9 @@
        {
            /* Open & cache rev1 */
            tmpfile = cvs_temp_name();
-           if (RCS_checkout (rcs, NULL, rev1, NULL, options, tmpfile,
+           if (RCS_checkout (rcs, NULL, rev1,
+                             arg_rev1 && !isdigit (arg_rev1[0])
+                             ? arg_rev1 : NULL, options, tmpfile,
                              NULL, NULL))
                error (1, errno,
                       "cannot check out revision %s of %s",
Index: ccvs/src/rcs.h
diff -u ccvs/src/rcs.h:1.82.8.6 ccvs/src/rcs.h:1.82.8.7
--- ccvs/src/rcs.h:1.82.8.6     Thu Jan 19 19:39:40 2006
+++ ccvs/src/rcs.h      Fri Jan 20 03:12:29 2006
@@ -284,8 +284,8 @@
 int RCS_checkin (RCSNode *rcs, const char *update_dir, const char *workfile,
                 const char *message, const char *rev, time_t citime,
                 int flags);
-int RCS_cmp_file (RCSNode *, const char *, char **, const char *, const char *,
-                 const char * );
+int RCS_cmp_file (RCSNode *, const char *, const char *, char **, const char *,
+                 const char *, const char *);
 int RCS_settag (RCSNode *, const char *, const char *);
 int RCS_deltag (RCSNode *, const char *);
 int RCS_setbranch (RCSNode *, const char *);
Index: ccvs/src/update.c
diff -u ccvs/src/update.c:1.259.2.5 ccvs/src/update.c:1.259.2.6
--- ccvs/src/update.c:1.259.2.5 Thu Jan 12 18:20:32 2006
+++ ccvs/src/update.c   Fri Jan 20 03:12:29 2006
@@ -2560,8 +2560,9 @@
        if (!noexec
            && ((isfile (basefile) && !xcmp (basefile, finfo->file))
                || (strcmp (vers->vn_user, "0")
-                   && !RCS_cmp_file (finfo->rcs, vers->vn_user, NULL, NULL,
-                                     vers->options, finfo->file))))
+                   && !RCS_cmp_file (finfo->rcs, vers->tag, vers->vn_user,
+                                     NULL, NULL, vers->options,
+                                     finfo->file))))
            isbase = true;
        else
            isbase = false;




reply via email to

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