bug-cvs
[Top][All Lists]
Advanced

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

Patch: Make rdiff accept "-r rev:date"


From: Jonathan Kamens
Subject: Patch: Make rdiff accept "-r rev:date"
Date: Thu, 30 May 2002 18:14:34 +0000 (UTC)

This patch makes "cvs rdiff" accept "-r rev:date" to allow date-based
comparisons on branches other than the trunk.  It deprecates the "-D"
option to rdiff but does not actually disable it.  It also modifies
the behavior of "cvs update" and "cvs checkout" to allow the "-j" flag
to accept ":date", i.e., the trunk as of the specified date.

Let me know if your mailer doesn't understand the concept of
preserving whitespace and I'll mail the patch to you encoded :-).

Index: doc/ChangeLog
===================================================================
RCS file: /cvsroot/ccvs/doc/ChangeLog,v
retrieving revision 1.706
diff -u -r1.706 ChangeLog
--- doc/ChangeLog       30 Apr 2002 20:56:38 -0000      1.706
+++ doc/ChangeLog       30 May 2002 18:10:28 -0000
@@ -1,3 +1,9 @@
+2002-05-30  Jonathan Kamens  <jik@kamens.brookline.ma.us>
+
+       * cvs.texinfo: Remove documentation of rdiff "-D" option, which is
+       deprecated, and replace it with documentation of the "-r
+       [rev][:date]" syntax.
+
 2002-04-30  Derek Price  <oberon@umich.edu>
 
        * Makefile.in: Regenerated with automake 1.6.
Index: doc/cvs.texinfo
===================================================================
RCS file: /cvsroot/ccvs/doc/cvs.texinfo,v
retrieving revision 1.541
diff -u -r1.541 cvs.texinfo
--- doc/cvs.texinfo     17 Apr 2002 18:12:48 -0000      1.541
+++ doc/cvs.texinfo     30 May 2002 18:10:31 -0000
@@ -10391,7 +10391,7 @@
 
 @itemize @bullet
 @item
-rdiff [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules@dots{}
+rdiff [-flags] [-V vn] -r [t][:d] [-r [t2][:d2]] modules@dots{}
 @item
 Requires: repository.
 @item
@@ -10408,12 +10408,13 @@
 require a prior checkout.) The diff output is sent to
 the standard output device.
 
-You can specify (using the standard @samp{-r} and
-@samp{-D} options) any combination of one or two
-revisions or dates.  If only one revision or date is
+Using the @samp{-r} option, you can specify a revision
+(numeric or symbolic), a date, or both a branch
+tag and a date.
+If only one @samp{-r} option is
 specified, the patch file reflects differences between
-that revision or date and the current head revisions in
-the @sc{rcs} file.
+that revision and/or date and the current head revisions in
+the @sc{rcs} files.
 
 Note that if the software release affected is contained
 in more than one directory, then it may be necessary to
@@ -10435,8 +10436,6 @@
 them):
 
 @table @code
-@item -D @var{date}
-Use the most recent revision no later than @var{date}.
 
 @item -f
 If no matching revision is found, retrieve the most
@@ -10450,6 +10449,13 @@
 
 @item -r @var{tag}
 Use revision @var{tag}.
+
+@item -r :@var{date}
+Use the most recent trunk revision no later than @var{date}.
+
+@item -r @var{tag}:@var{date}
+Use the most recent revision no later than @var{date}
+on branch @var{tag}.
 @end table
 
 In addition to the above, these options are available:
@@ -10512,6 +10518,15 @@
 File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6
 File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4
 File bar.h,v changed from revision 1.29.2.1 to 1.2
+@end example
+
+Suppose you want to see what changes have been made
+since yesterday on the @samp{DEV} branch:
+
+@example
+$ cvs rdiff -r DEV:yesterday -r DEV module-name
+cvs rdiff: Diffing module-name
+@dots{}
 @end example
 
 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Index: src/ChangeLog
===================================================================
RCS file: /cvsroot/ccvs/src/ChangeLog,v
retrieving revision 1.2273
diff -u -r1.2273 ChangeLog
--- src/ChangeLog       24 May 2002 22:01:50 -0000      1.2273
+++ src/ChangeLog       30 May 2002 18:10:33 -0000
@@ -1,3 +1,24 @@
+2002-05-30  Jonathan Kamens  <jik@kamens.brookline.ma.us>
+
+       * patch.c (patch): Print a warning if the "-D" option is used, but
+       continue to accept it for the time being.
+       (patch_proc): Allow revisions to be specified in "-r [rev]:date"
+       format.
+
+       * patch.c (patch_usage): Update the usage message to deprecate
+       "-D" and replace it with "-r [rev][:date]".
+
+       * update.c (do_update): If a join revision is empty after parsing
+       a join tag, i.e., if the tag specified was ":date", set the join
+       revision to null rather than leaving it an empty string, to avoid
+       confusing the RCS code by specifying an empty label (as opposed to
+       a null label).
+
+       * tag.c (tag_check_valid_join): Remove requirement for the tag
+       part of a join tag to be non-empty.  It's not necessary, as long
+       as we remember to set the join tag to NULL if it's empty after the
+       date is parsed off the end of it.
+
 2002-05-24  Larry Jones  <lawrence.jones@eds.com>
 
        * rcscmds.c (diff_exec): Add a -- before the first file name just
Index: src/patch.c
===================================================================
RCS file: /cvsroot/ccvs/src/patch.c,v
retrieving revision 1.78
diff -u -r1.78 patch.c
--- src/patch.c 7 Aug 2001 15:35:32 -0000       1.78
+++ src/patch.c 30 May 2002 18:10:33 -0000
@@ -43,7 +43,7 @@
 static const char *const patch_usage[] =
 {
     "Usage: %s %s [-flR] [-c|-u] [-s|-t] [-V %%d]\n",
-    "    -r rev|-D date [-r rev2 | -D date2] modules...\n",
+    "    -r [rev][:date] [-r [rev2][:date2]] modules...\n",
     "\t-f\tForce a head revision match if tag/date not found.\n",
     "\t-l\tLocal directory only, not recursive\n",
     "\t-R\tProcess directories recursively.\n",
@@ -51,8 +51,7 @@
     "\t-u\tUnidiff format.\n",
     "\t-s\tShort patch - one liner per file.\n",
     "\t-t\tTop two diffs - last change made to the file.\n",
-    "\t-D date\tDate.\n",
-    "\t-r rev\tRevision - symbolic or numeric.\n",
+    "\t-r rev[:date]\tRevision - symbolic or numeric - and/or date.\n",
     "\t-V vers\tUse RCS Version \"vers\" for keyword expansion.\n",
     "(Specify the --help global option for a list of other help options)\n",
     NULL
@@ -104,6 +103,8 @@
                patch_short = 1;
                break;
            case 'D':
+               /* Eventually this will be a real error. */
+               error (0, 0, "-D is deprecated; use -r:date instead");
                if (rev2 != NULL || date2 != NULL)
                    error (1, 0,
                       "no more than two revisions/dates can be specified");
@@ -282,6 +283,7 @@
     int which;
     char *repository;
     char *where;
+    char *cp;
 
     repository = xmalloc (strlen (current_parsed_root->directory) + strlen 
(argv[0])
                          + (mfile == NULL ? 0 : strlen (mfile) + 1) + 2);
@@ -293,7 +295,6 @@
     /* if mfile isn't null, we need to set up to do only part of the module */
     if (mfile != NULL)
     {
-       char *cp;
        char *path;
 
        /* if the portion of the module is a path, put the dir part on repos */
@@ -343,12 +344,28 @@
 
     if (rev1 != NULL && !rev1_validated)
     {
-       tag_check_valid (rev1, argc - 1, argv + 1, local_specified, 0, NULL);
+       tag_check_valid_join (rev1, argc - 1, argv + 1, local_specified, 0,
+                             NULL);
+       if ((cp = strchr(rev1, ':')) != NULL)
+       {
+           *cp++ = '\0';
+           date1 = Make_Date (cp);
+           if (! *rev1)
+               rev1 = NULL;
+       }
        rev1_validated = 1;
     }
     if (rev2 != NULL && !rev2_validated)
     {
-       tag_check_valid (rev2, argc - 1, argv + 1, local_specified, 0, NULL);
+       tag_check_valid_join (rev2, argc - 1, argv + 1, local_specified, 0,
+                             NULL);
+       if ((cp = strchr(rev2, ':')) != NULL)
+       {
+           *cp++ = '\0';
+           date2 = Make_Date (cp);
+           if (! *rev2)
+               rev2 = NULL;
+       }
        rev2_validated = 1;
     }
 
Index: src/tag.c
===================================================================
RCS file: /cvsroot/ccvs/src/tag.c,v
retrieving revision 1.94
diff -u -r1.94 tag.c
--- src/tag.c   6 Jun 2001 19:43:04 -0000       1.94
+++ src/tag.c   30 May 2002 18:10:33 -0000
@@ -1353,13 +1353,10 @@
                   join_tag);
 
         *s = '\0';
-       /* hmmm...  I think it makes sense to allow -j:<date>, but
-        * for now this fixes a bug where CVS just spins and spins (I
-        * think in the RCS code) looking for a zero length tag.
-        */
        if (!*c)
-           error (1, 0,
-                  "argument to join may not contain a date specifier without a 
tag");
+           /* It's OK to specify just ":date" to indicate that date
+              on the trunk. */
+           return;
     }
 
     tag_check_valid (c, argc, argv, local, aflag, repository);
Index: src/update.c
===================================================================
RCS file: /cvsroot/ccvs/src/update.c,v
retrieving revision 1.197
diff -u -r1.197 update.c
--- src/update.c        8 Jul 2001 20:51:46 -0000       1.197
+++ src/update.c        30 May 2002 18:10:34 -0000
@@ -464,6 +464,8 @@
     {
        *cp++ = '\0';
        date_rev1 = Make_Date (cp);
+       if (! *join_rev1)
+           join_rev1 = NULL;
     }
     else
        date_rev1 = (char *) NULL;
@@ -471,6 +473,8 @@
     {
        *cp++ = '\0';
        date_rev2 = Make_Date (cp);
+       if (! *join_rev2)
+           join_rev2 = NULL;
     }
     else
        date_rev2 = (char *) NULL;



reply via email to

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