bug-cvs
[Top][All Lists]
Advanced

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

CVS_LOCAL_BRANCH_NUM feature


From: Mark D. Baushke
Subject: CVS_LOCAL_BRANCH_NUM feature
Date: Mon, 03 Mar 2003 03:37:29 -0800

Hi Folks,

Does anyone object to giving the canoncial cvs version the hack that is
needed to support some CVSup local modifications?

There has been some talk in recent months (see the URL: and messages in
the thread:
http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg38563.html)
that it may be desirable to have a command-line switch to control the
selection of the magic branch number. This would allow users to put it
into their .cvsrc file. I have NOT tried to implement any of those
suggestions.

A number of web pages that talk about how to use CVSup mention the need
for this hack. Two examples of such pages may be found here:

    http://www.cs.wustl.edu/~nanbor/CVSUP/cvs-repo-sync.html
and
    http://www.scriptkiddie.org/freebsd/setting_up_local_repo.html

Comments anyone?

        Thanks,
        -- Mark

log message:
Port the FreeBSD CVS_LOCAL_BRANCH_NUM feature into ccvs.
This patch was originally committed to the FreeBSD sources
on 1996-09-03 by Peter Wemm <peter@FreeBSD.org> and is used
a great deal by users of CVSup. For the original patch, see:
http://www.freebsd.org/cgi/cvsweb.cgi/src/contrib/cvs/src/rcs.c.diff?r1=1.1&r2=1.2

Index: doc/ChangeLog
===================================================================
RCS file: /cvs/ccvs/doc/ChangeLog,v
retrieving revision 1.735
diff -u -p -r1.735 ChangeLog
--- doc/ChangeLog       27 Feb 2003 16:51:22 -0000      1.735
+++ doc/ChangeLog       3 Mar 2003 11:35:04 -0000
@@ -1,3 +1,8 @@
+2003-03-03  Mark D. Baushke  <mdb@cvshome.org>
+
+       * cvs.texinfo (CVS_LOCAL_BRANCH_NUM): Document new environment
+       variable.
+
 2003-02-27  Derek Price  <derek@ximbiot.com>
 
        * cvs.texinfo (Environment variables): Make the information on
Index: doc/cvs.texinfo
===================================================================
RCS file: /cvs/ccvs/doc/cvs.texinfo,v
retrieving revision 1.556
diff -u -p -r1.556 cvs.texinfo
--- doc/cvs.texinfo     27 Feb 2003 16:51:22 -0000      1.556
+++ doc/cvs.texinfo     3 Mar 2003 11:35:04 -0000
@@ -13694,6 +13694,16 @@ Later versions of @sc{cvs} do not rewrit
 @file{CVS/Root}, so @code{CVS_IGNORE_REMOTE_ROOT} has no
 effect.
 
+@cindex CVS_LOCAL_BRANCH_NUM, environment variable
+@item $CVS_LOCAL_BRANCH_NUM
+Setting this variable allows some control over the
+branch number that is assigned. This is specifically to
+support the local commit feature of CVSup. If one sets
+@code{CVS_LOCAL_BRANCH_NUM} to (say) 1000 then branches
+the local repository, the revision numbers will look
+like 1.66.1000.xx. There is almost a dead-set certainty
+that there will be no conflicts with version numbers.
+
 @cindex COMSPEC, environment variable
 @item $COMSPEC
 Used under OS/2 only.  It specifies the name of the
Index: man/ChangeLog
===================================================================
RCS file: /cvs/ccvs/man/ChangeLog,v
retrieving revision 1.59
diff -u -p -r1.59 ChangeLog
--- man/ChangeLog       26 Feb 2003 19:21:29 -0000      1.59
+++ man/ChangeLog       3 Mar 2003 11:35:04 -0000
@@ -1,3 +1,7 @@
+2003-03-03  Mark D. Baushke  <mdb@cvshome.org>
+
+       * cvs.1 (CVS_LOCAL_BRANCH_NUM): Document new environment variable.
+
 2003-02-26  Larry Jones  <lawrence.jones@eds.com>
 
        * cvs.1: Note using "cvs" in .cvsrc for global options.
Index: man/cvs.1
===================================================================
RCS file: /cvs/ccvs/man/cvs.1,v
retrieving revision 1.31
diff -u -p -r1.31 cvs.1
--- man/cvs.1   26 Feb 2003 19:21:29 -0000      1.31
+++ man/cvs.1   3 Mar 2003 11:35:04 -0000
@@ -2078,6 +2078,15 @@ If this variable is set then
 .B cvs
 will ignore all references to remote repositories in the CVS/Root file.
 .TP
+.SM CVS_LOCAL_BRANCH_NUM
+Setting this variable allows some control over the
+branch number that is assigned. This is specifically to
+support the local commit feature of CVSup. If one sets
+CVS_LOCAL_BRANCH_NUM to (say) 1000 then branches
+the local repository, the revision numbers will look
+like 1.66.1000.xx. There is almost a dead-set certainty
+that there will be no conflicts with version numbers.
+.TP
 .SM CVS_RSH
 .B cvs
 uses the contents of this variable to determine the name of the
Index: src/ChangeLog
===================================================================
RCS file: /cvs/ccvs/src/ChangeLog,v
retrieving revision 1.2369
diff -u -p -r1.2369 ChangeLog
--- src/ChangeLog       28 Feb 2003 23:11:21 -0000      1.2369
+++ src/ChangeLog       3 Mar 2003 11:35:04 -0000
@@ -1,3 +1,21 @@
+2003-03-03  Mark D. Baushke  <mdb@cvshome.org>
+
+       * rcs.c (RCS_magicrev): CVS_LOCAL_BRANCH_NUM feature.
+       Port of the FreeBSD hack for setting the next magic branch number
+       to be used. The original patch was written by Peter Wemm
+       <peter@FreeBSD.org> and may be found by visiting the URL:
+       
http://www.freebsd.org/cgi/cvsweb.cgi/src/contrib/cvs/src/rcs.c.diff?r1=1.1&r2=1.2
+       Implement a horrible (but simple) hack to allow some control over the
+       branch number that is assigned. This is specifically to support the
+       local commit feature of cvsup. If one sets $CVS_LOCAL_BRANCH_NUM to
+       (say) 1000 then branches the local repository, the revision numbers
+       will look like 1.66.1000.xx. This is almost a dead-set certainty that
+       there will be no conflicts with version numbers.
+       (This needs to be something more than an option to 'cvs tag' or 'cvs
+       rtag' as various parts of cvs "know" how to automatically branch files
+       (eg: cvs add). Trying to remember state is getting "Too Hard (TM)")
+       * sanity.sh (branches3): Test the CVS_LOCAL_BRANCH_NUM feature.
+       
 2003-02-28  Derek Price  <derek@ximbiot.com>
 
        * root.c (parse_cvsroot): Set no_password for :gserver: and :kserver: as
Index: src/rcs.c
===================================================================
RCS file: /cvs/ccvs/src/rcs.c,v
retrieving revision 1.267
diff -u -p -r1.267 rcs.c
--- src/rcs.c   26 Feb 2003 03:06:01 -0000      1.267
+++ src/rcs.c   3 Mar 2003 11:35:11 -0000
@@ -2496,13 +2496,25 @@ RCS_magicrev (rcs, rev)
     char *rev;
 {
     int rev_num;
-    char *xrev, *test_branch;
+    char *xrev, *test_branch, *local_branch_num;
 
     xrev = xmalloc (strlen (rev) + 14); /* enough for .0.number */
     check_rev = xrev;
 
+    local_branch_num = getenv("CVS_LOCAL_BRANCH_NUM");
+    if (local_branch_num)
+    {
+      rev_num = atoi(local_branch_num);
+      if (rev_num < 2)
+       rev_num = 2;
+      else
+       rev_num &= ~1;
+    }
+    else
+      rev_num = 2;
+
     /* only look at even numbered branches */
-    for (rev_num = 2; ; rev_num += 2)
+    for ( ; ; rev_num += 2)
     {
        /* see if the physical branch exists */
        (void) sprintf (xrev, "%s.%d", rev, rev_num);
Index: src/sanity.sh
===================================================================
RCS file: /cvs/ccvs/src/sanity.sh,v
retrieving revision 1.763
diff -u -p -r1.763 sanity.sh
--- src/sanity.sh       26 Feb 2003 21:55:15 -0000      1.763
+++ src/sanity.sh       3 Mar 2003 11:35:12 -0000
@@ -675,7 +675,7 @@ if test x"$*" = x; then
        tests="${tests} commit-add-missing"
        # Branching, tagging, removing, adding, multiple directories
        tests="${tests} rdiff diff death death2 rm-update-message rmadd rmadd2"
-       tests="${tests} dirs dirs2 branches branches2 tagc tagf"
+       tests="${tests} dirs dirs2 branches branches2 branches3 tagc tagf"
        tests="${tests} rcslib multibranch import importb importc"
        tests="${tests} update-p import-after-initial branch-after-import"
        tests="${tests} join join2 join3 join-readonly-conflict"
@@ -5690,6 +5690,56 @@ File: file5              Status: Up-to-da
          cd ../../..
          rm -rf ${CVSROOT_DIRNAME}/first-dir
          rm -r trunk b1a b1b
+         ;;
+
+       branches3)
+         mkdir ${CVSROOT_DIRNAME}/first-dir
+         mkdir branches3; cd branches3
+
+         dotest branches3-1 "${testcvs} -q co first-dir"
+         cd first-dir
+         echo "file1 first revision" > file1
+         dotest branches3-2 "${testcvs} add file1" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+         dotest branches3-3 "${testcvs} commit -m add file1" \
+"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
+done
+Checking in file1;
+${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
+initial revision: 1\.1
+done"
+
+         # Tag the file using a CVS_LOCAL_BRANCH_NUM of 1000
+         CVS_LOCAL_BRANCH_NUM=1000 \
+         dotest branches3-4 "${testcvs} -q tag -b tag1" 'T file1'
+         dotest branches3-5 "${testcvs} -q log file1" \
+"
+RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch:
+locks: strict
+access list:
+symbolic names:
+       tag1: 1\.1\.0\.1000
+keyword substitution: kv
+total revisions: 1;    selected revisions: 1
+description:
+----------------------------
+revision 1.1
+date: [0-9/: ]*;  author: ${username};  state: Exp;
+add
+============================================================================="
+
+         if $keep; then
+           echo Keeping ${TESTDIR} and exiting due to --keep
+           exit 0
+         fi
+
+         cd ../..
+         rm -rf ${CVSROOT_DIRNAME}/first-dir
+         rm -r branches3
          ;;
 
        tagc)




reply via email to

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