Index: NEWS =================================================================== RCS file: /home2/cvsroot/ccvs/NEWS,v retrieving revision 1.84 diff -c -c -r1.84 NEWS *** NEWS 2000/10/17 19:11:33 1.84 --- NEWS 2000/10/18 23:29:53 *************** *** 1,5 **** --- 1,9 ---- Changes since 1.11: + * The 'modules' file now supports the '-r' switch. This allows the creation of + version specific module names that automatically check out the proper version + or branch tag. + * The ~/.cvspass file has a slightly modified format. Now two slightly different CVSROOTs which represent the same repository and user name no longer require separate calls to 'cvs login' to use. The new code should be backwards Index: src/ChangeLog =================================================================== RCS file: /home2/cvsroot/ccvs/src/ChangeLog,v retrieving revision 1.1978 diff -c -c -r1.1978 ChangeLog *** src/ChangeLog 2000/10/18 19:34:45 1.1978 --- src/ChangeLog 2000/10/18 23:29:54 *************** *** 1,3 **** --- 1,13 ---- + 2000-10-18 Scott Stanton + + * sanity.sh (modules5): Added tests for '-r' switch in the + "modules" file. + * mkmodules.c: Added description of '-r' flag to "modules". + * checkout.c (checkout): Added support for the '-r' option to the + modules file. + * modules.c (do_module): Made the 'tag' variable non-static so it + can be used from the checkout file. + 2000-10-18 Derek Price * root.c (normalize_cvsroot): removed references to free_port_s and the Index: src/checkout.c =================================================================== RCS file: /home2/cvsroot/ccvs/src/checkout.c,v retrieving revision 1.91 diff -c -c -r1.91 checkout.c *** src/checkout.c 2000/09/27 14:33:15 1.91 --- src/checkout.c 2000/10/18 23:29:54 *************** *** 86,92 **** static int pipeout; static int aflag; static char *options = NULL; ! static char *tag = NULL; static int tag_validated = 0; static char *date = NULL; static char *join_rev1 = NULL; --- 86,92 ---- static int pipeout; static int aflag; static char *options = NULL; ! char *tag = NULL; static int tag_validated = 0; static char *date = NULL; static char *join_rev1 = NULL; Index: src/mkmodules.c =================================================================== RCS file: /home2/cvsroot/ccvs/src/mkmodules.c,v retrieving revision 1.62 diff -c -c -r1.62 mkmodules.c *** src/mkmodules.c 2000/09/08 15:28:36 1.62 --- src/mkmodules.c 2000/10/18 23:29:54 *************** *** 260,265 **** --- 260,266 ---- "# -u prog Run \"prog\" on \"cvs update\" of module.\n", "# -d dir Place module in directory \"dir\" instead of module name.\n", "# -l Top-level directory only -- do not recurse.\n", + "# -r tag Use the specified \"tag\" when checking out files.\n", "#\n", "# NOTE: If you change any of the \"Run\" options above, you'll have to\n", "# release and re-checkout any working directories of these modules.\n", Index: src/modules.c =================================================================== RCS file: /home2/cvsroot/ccvs/src/modules.c,v retrieving revision 1.60 diff -c -c -r1.60 modules.c *** src/modules.c 2000/07/26 19:29:01 1.60 --- src/modules.c 2000/10/18 23:29:54 *************** *** 24,36 **** #include "cvs.h" #include "savecwd.h" /* Defines related to the syntax of the modules file. */ /* Options in modules file. Note that it is OK to use GNU getopt features; we already are arranging to make sure we are using the getopt distributed with CVS. */ ! #define CVSMODULE_OPTS "+ad:i:lo:e:s:t:u:" /* Special delimiter. */ #define CVSMODULE_SPEC '&' --- 24,38 ---- #include "cvs.h" #include "savecwd.h" + extern char *tag; + /* Defines related to the syntax of the modules file. */ /* Options in modules file. Note that it is OK to use GNU getopt features; we already are arranging to make sure we are using the getopt distributed with CVS. */ ! #define CVSMODULE_OPTS "+ad:i:lo:e:r:s:t:u:" /* Special delimiter. */ #define CVSMODULE_SPEC '&' *************** *** 132,137 **** --- 134,141 ---- char *cp; int c, err = 0; int nonalias_opt = 0; + char *default_tag = NULL; + int restore_tag; #ifdef SERVER_SUPPORT int restore_server_dir = 0; *************** *** 447,452 **** --- 451,462 ---- export_prog = xstrdup (optarg); nonalias_opt = 1; break; + case 'r': + nonalias_opt = 1; + if (default_tag) + free (default_tag); + default_tag = xstrdup (optarg); + break; case 't': if (tag_prog) free (tag_prog); *************** *** 516,521 **** --- 526,541 ---- goto do_module_return; } + if (default_tag && !tag) + { + restore_tag = 1; + tag = default_tag; + } + else + { + restore_tag = 0; + } + /* otherwise, process this module */ if (modargc > 0) { *************** *** 574,579 **** --- 594,603 ---- do_special: + if (restore_tag) + { + tag = NULL; + } free_names (&xmodargc, xmodargv); xmodargv = NULL; Index: src/sanity.sh =================================================================== RCS file: /home2/cvsroot/ccvs/src/sanity.sh,v retrieving revision 1.629 diff -c -c -r1.629 sanity.sh *** src/sanity.sh 2000/10/18 15:01:02 1.629 --- src/sanity.sh 2000/10/18 23:29:58 *************** *** 7886,7891 **** --- 7886,7892 ---- realmodule ${OPTS} first-dir/subdir a dirmodule ${OPTS} first-dir/subdir namedmodule -d nameddir ${OPTS} first-dir/subdir + oldrealmodule -r 1.1 ${OPTS} first-dir/subdir a EOF dotest modules5-7 "${testcvs} ci -m 'add modules' CVSROOT/modules" \ *************** *** 8036,8041 **** --- 8037,8074 ---- "You have \[0\] altered files in this repository\. Are you sure you want to release (and delete) directory .nameddir.: " fi + + # Verify that a module with a '-r' switch checks out the right + # version. + dotest module5-29 "${testcvs} co oldrealmodule" \ + "U oldrealmodule/a + ${PROG} [a-z]*: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .oldrealmodule.. + checkout script invoked in ${TESTDIR}/1 + args: oldrealmodule" + dotest module5-30 "cvs status oldrealmodule/a" \ + "=================================================================== + File: a Status: Up-to-date + + Working revision: 1\.1.* + Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/subdir/a,v + Sticky Tag: 1\.1 + Sticky Date: (none) + Sticky Options: (none)" + rm -rf oldrealmodule + dotest module5-31 "${testcvs} co -r 1 oldrealmodule" \ + "U oldrealmodule/a + ${PROG} [a-z]*: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .oldrealmodule.. + checkout script invoked in ${TESTDIR}/1 + args: oldrealmodule" + dotest module5-32 "cvs status oldrealmodule/a" \ + "=================================================================== + File: a Status: Up-to-date + + Working revision: 1\.2.* + Repository revision: 1\.2 ${TESTDIR}/cvsroot/first-dir/subdir/a,v + Sticky Tag: 1 + Sticky Date: (none) + Sticky Options: (none)" cd .. rm -rf 1 ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/*.sh === Exit status: 1