[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Branches in modules files [Was : Defining modules]
From: |
so |
Subject: |
Branches in modules files [Was : Defining modules] |
Date: |
Tue, 27 Mar 2001 10:05:46 +0100 |
Hi everyboby,
On Monday, March 5, 2001 at 11:13:42 -0500 (EST), Larry Jones wrote :
>Michael Lukaschek writes:
>>
> [snip]
>
>> Is there a way to specify a branch in the modules file? I want to define
>> a module using a specified branch of another module...
>
>No. You're not the first person to express an interest in this -- if
>anyone is looking for a CVS enhancement project, this might be a good
>one.
Well, it remembered me 2 postings from Scott Stanton on bug-cvs in october
2000.
I enclose a merge of these 2 messages at the end of this posting.
Best regards,
Patrick Gouin.
FROM: Scott Stanton
DATE: 10/18/2000 16:33:17
SUBJECT: RE: `-r` modules patch
I am sending you a patch to CVS that adds support for the '-r' switch to
the modules files. This allows the creation of version-specific modules
that automatically check out the correct version/branch tag. We have been
using this patch very successfully for the last two years at Ajuba
Solutions. I hope it will prove useful to others. This patch is the
smallest change I could think of to add this feature. It's possibly not
the most elegant approach, since it involves exporting a previously static
variable. However, it does work and is a quite small patch.
I grant permission to distribute this patch under the terms of the GNU
Public License.
--Scott
Ok, here`s a revision of my previous patch. It includes a few test suite
additions, plus an update of the "modules" template in addition to the
original changes.
--Scott
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 <<EMAIL: PROTECTED>>
+
+ * 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 <<EMAIL: PROTECTED>>
* 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.",
"# -d dir Place module in directory "dir" instead of module name.",
"# -l Top-level directory only -- do not recurse.",
+ "# -r tag Use the specified "tag" when checking out files.",
"#",
"# NOTE: If you change any of the "Run" options above, you`ll have
to",
"# release and re-checkout any working directories of these modules.",
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Branches in modules files [Was : Defining modules],
so <=