[Haven't looked at this patch -kingdon] To: bug-cvs@gnu.org Subject: Re: support to specify diff point by date on branch From: enami tsugutomo Date: 15 May 1998 07:40:58 +0900 Jim Kingdon writes: > > It is unable to specify the diff point by date on branch. In other > > words, can't take diff by using -D option on branch. > > Thanks; I have added this patch to the unofficial patches page at > www.cyclic.com. Thanks, I saw that page. >From cvs page: > [Why --branch and not either (a) -r -D, or (b) -r branchname:date (or > whatever that syntax is that is supported by update -j or whatever it > is)? (a) is not apropriate since it is already has different meaning (cvs diff -r rev -D date is diff between rev and date), but (b) is probably nice idea. Reviced patch is appended this mail. enami. Index: diff.c =================================================================== RCS file: /cvsroot/cvs/src/diff.c,v retrieving revision 1.1.1.12 diff -c -r1.1.1.12 diff.c *** diff.c 1998/04/27 05:06:49 1.1.1.12 --- diff.c 1998/05/08 02:37:22 *************** *** 39,49 **** --- 39,52 ---- enum diff_file)); static int diff_fileproc PROTO ((void *callerdat, struct file_info *finfo)); static void diff_mark_errors PROTO((int err)); + static void diff_branch_setup PROTO ((void)); static char *diff_rev1, *diff_rev2; static char *diff_date1, *diff_date2; static char *use_rev1, *use_rev2; static int have_rev1_label, have_rev2_label; + /* Holds sticky branch tag in current directory. */ + static char *diff_branch1, *diff_branch2; /* Revision of the user file, if it is unchanged from something in the repository and we want to use that fact. */ *************** *** 207,213 **** int argc; char **argv; { ! char tmp[50]; int c, err = 0; int local = 0; int which; --- 210,216 ---- int argc; char **argv; { ! char tmp[50], *cp; int c, err = 0; int local = 0; int which; *************** *** 368,373 **** --- 371,387 ---- } #endif + if (diff_rev1 != NULL && (cp = strchr (diff_rev1, ':')) != NULL) + { + *cp++ = '\0'; + diff_date1 = Make_Date (cp); + } + if (diff_rev2 != NULL && (cp = strchr (diff_rev2, ':')) != NULL) + { + *cp++ = '\0'; + diff_date2 = Make_Date (cp); + } + if (diff_rev1 != NULL) tag_check_valid (diff_rev1, argc, argv, local, 0, ""); if (diff_rev2 != NULL) *************** *** 379,384 **** --- 393,400 ---- wrap_setup (); + diff_branch_setup(); + /* start the recursion processor */ err = start_recursion (diff_fileproc, diff_filesdoneproc, diff_dirproc, diff_dirleaveproc, NULL, argc, argv, local, *************** *** 447,454 **** { Vers_TS *xvers; ! xvers = Version_TS (finfo, NULL, diff_rev1, diff_date1, ! 1, 0); exists = xvers->vn_rcs != NULL; freevers_ts (&xvers); } --- 463,471 ---- { Vers_TS *xvers; ! xvers = Version_TS (finfo, NULL, ! diff_rev1 ? diff_rev1 : diff_branch1, ! diff_date1, 1, 0); exists = xvers->vn_rcs != NULL; freevers_ts (&xvers); } *************** *** 744,749 **** --- 761,790 ---- diff_errors = err; } + static void + diff_branch_setup() + { + int nonbranch; + + if (diff_branch1 != NULL) + free (diff_branch1); + ParseTag(&diff_branch1, NULL, &nonbranch); + if (nonbranch) + { + free (diff_branch1); + diff_branch1 = NULL; + } + + if (diff_branch2 != NULL) + free (diff_branch2); + ParseTag(&diff_branch2, NULL, &nonbranch); + if (nonbranch) + { + free (diff_branch2); + diff_branch2 = NULL; + } + } + /* * Print a warm fuzzy message when we enter a dir * *************** *** 766,771 **** --- 807,814 ---- if (!quiet) error (0, 0, "Diffing %s", update_dir); + + diff_branch_setup(); return (R_PROCESS); } *************** *** 827,833 **** : RCS_branch_head (vers->srcfile, vers->vn_rcs)); else { ! xvers = Version_TS (finfo, NULL, diff_rev1, diff_date1, 1, 0); if (xvers->vn_rcs != NULL) use_rev1 = xstrdup (xvers->vn_rcs); freevers_ts (&xvers); --- 870,878 ---- : RCS_branch_head (vers->srcfile, vers->vn_rcs)); else { ! xvers = Version_TS (finfo, NULL, ! diff_rev1 ? diff_rev1 : diff_branch1, ! diff_date1, 1, 0); if (xvers->vn_rcs != NULL) use_rev1 = xstrdup (xvers->vn_rcs); freevers_ts (&xvers); *************** *** 842,848 **** : RCS_branch_head (vers->srcfile, vers->vn_rcs)); else { ! xvers = Version_TS (finfo, NULL, diff_rev2, diff_date2, 1, 0); if (xvers->vn_rcs != NULL) use_rev2 = xstrdup (xvers->vn_rcs); freevers_ts (&xvers); --- 887,895 ---- : RCS_branch_head (vers->srcfile, vers->vn_rcs)); else { ! xvers = Version_TS (finfo, NULL, ! diff_rev2 ? diff_rev2 : diff_branch2, ! diff_date2, 1, 0); if (xvers->vn_rcs != NULL) use_rev2 = xstrdup (xvers->vn_rcs); freevers_ts (&xvers);