home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume22 / cvs3.0 / part02 < prev    next >
Text File  |  1990-06-07  |  55KB  |  2,493 lines

  1. Subject:  v22i014:  Concurrent RCS version system, release 3.0, Part02/02
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: ebf25e8e aaf42234 5409ffb7 3c04680d
  5.  
  6. Submitted-by: Dick Grune <dick@cs.vu.nl>
  7. Posting-number: Volume 22, Issue 14
  8. Archive-name: cvs3.0/part02
  9.  
  10. ----------------------------------------------------------------
  11. : This is a shar archive.  Extract with sh, not csh.
  12. : This archive ends with exit, so do not worry about trailing junk.
  13. : --------------------------- cut here --------------------------
  14. PATH=/bin:/usr/bin:/usr/ucb
  15. echo Extracting 'Install'
  16. sed 's/^X//' > 'Install' << '+ END-OF-FILE ''Install'
  17. X#!/bin/sh
  18. X#    This file is part of the Concurrent Versions System CVS.
  19. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  20. X#    $Header: Install,v 3.1 89/09/25 16:32:00 dick Exp $
  21. X
  22. X#
  23. X#        I n s t a l l
  24. X#    Installs $1 in the directory $2; the file is updated to reflect
  25. X#    that the auxiliaries are in $3 and the RCS binaries in $4.
  26. X#    The directory names $2, $3 and $4 have to be absolute paths.
  27. X#    The pair "[ ... ]", used for testing in more advanced shells, is
  28. X#    replaced by the more portable "test ..."
  29. X#    So, a call might look like
  30. X#        Install GC /usr/local/bin `pwd` /usr/bin
  31. X#
  32. X
  33. Xcat $1 |
  34. Xsed "
  35. X    s|^CVSBIN=.*|CVSBIN=$2|
  36. X    s|^CVSLIB=.*|CVSLIB=$3|
  37. X    s|^RCSBIN=.*|RCSBIN=\${RCSBIN-$4}|
  38. X    s|^\([^#]*\)\[ \(.*\) \]|\1test \2|
  39. X" >$2/$1
  40. X
  41. Xchmod +x $2/$1
  42. + END-OF-FILE Install
  43. chmod 'u=rwx,g=rx,o=rx' 'Install'
  44. set `wc -c 'Install'`
  45. count=$1
  46. case $count in
  47. 738)    :;;
  48. *)    echo 'Bad character count in ''Install' >&2
  49.         echo 'Count should be 738' >&2
  50. esac
  51. echo Extracting 'AE'
  52. sed 's/^X//' > 'AE' << '+ END-OF-FILE ''AE'
  53. X#!/bin/sh
  54. X#    This file is part of the Concurrent Versions System CVS.
  55. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  56. X#    $Header: AE,v 3.2 89/10/02 15:14:23 dick Exp $
  57. X
  58. X#
  59. X#        A d d   E n t r y
  60. X#    The call AE [ -... ] filename ... adds new entries to the
  61. X#    present configuration; the options -... will be passed on
  62. X#    to rcs -i (see RCS manual).  For each file it asks for a
  63. X#    description, in RCS fashion.
  64. X#    The entries will be added to the RCS repository upon the
  65. X#    next call of CM.
  66. X#    The user files must already exist.
  67. X#    AE on a file removed with RM will resurrect the file.
  68. X#
  69. XName=AE; export Name
  70. X
  71. X# CVSBIN, CVSLIB and RCSBIN directories
  72. XCVSBIN=/home/top/dick/cvs
  73. XCVSLIB=/home/top/dick/cvs
  74. XRCSBIN=${RCSBIN-/usr/local/bin}
  75. Xexport CVSBIN CVSLIB RCSBIN
  76. X
  77. X# avoid spurious identifications
  78. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  79. X
  80. X# determine the name of the repository
  81. XRepository=""
  82. X. $CVSLIB/NR.aux
  83. X
  84. X# get possible options
  85. X. $CVSLIB/OP.aux            # sets $Options
  86. X
  87. X# is the number of parameters correct?
  88. Xcase $# in
  89. X0)
  90. X    echo Call is: $Name \<options\> filename ... \
  91. X                to add files to present configuration >&2
  92. X    exit 1
  93. X    ;;
  94. Xesac
  95. X
  96. XOK=yes
  97. Xfor User in $@
  98. Xdo
  99. X    case $User in
  100. X    */*)
  101. X        echo $Name: cannot add non-local files \($User\) >&2
  102. X        OK=no
  103. X        continue
  104. X        ;;
  105. X    esac
  106. X
  107. X    Rcs=$Repository/$User,v
  108. X    . $CVSLIB/VT.aux    # sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
  109. X    
  110. X    # what entry is this?
  111. X    case $VN_User in
  112. X    "")
  113. X        # no entry available, $TS_Rcs is invalid
  114. X        
  115. X        # how is the RCS file?
  116. X        case $VN_Rcs in
  117. X        "")
  118. X            # there is no RCS file either
  119. X            
  120. X            # how is the user file?
  121. X            case "$TS_User" in
  122. X            "")
  123. X                # there is no user file
  124. X                echo $Name: nothing known about $User >&2
  125. X                OK=no
  126. X                ;;
  127. X            *)
  128. X                # there is a user file
  129. X                . $CVSLIB/BE.aux    # build entry
  130. X                ;;
  131. X            esac
  132. X            ;;
  133. X        *)
  134. X            # there is an RCS file
  135. X            
  136. X            # illegal addition
  137. X            echo $Name: $User added independently \
  138. X                            by second party >&2
  139. X            OK=no
  140. X            ;;
  141. X        esac
  142. X        ;;
  143. X    
  144. X    0)
  145. X        # an entry for a new-born file, $TS_Rcs is dummy
  146. X        
  147. X        # but that is inappropriate here
  148. X        echo $Name: $User has already been entered >&2
  149. X        OK=no
  150. X        ;;
  151. X    
  152. X    -*)
  153. X        # an entry for a removed file, $TS_Rcs is valid
  154. X        
  155. X        # how is the user file?
  156. X        case "$TS_User" in
  157. X        "")
  158. X            # there is no user file (as it should be)
  159. X            
  160. X            # how is the RCS file?
  161. X            case -$VN_Rcs in
  162. X            -)
  163. X                # there is no RCS file
  164. X            
  165. X                # it has already been removed
  166. X                echo $Name: cannot resurrect $User, \
  167. X                    RCS file removed by second party >&2
  168. X                OK=no
  169. X                ;;
  170. X            *)
  171. X                # there is an RCS file
  172. X                
  173. X                # resurrection requested
  174. X                # remove initial minus from $VN_User
  175. X                VN_User=`expr $VN_User : '-\(.*\)' `
  176. X                $CVSLIB/RG.aux $User $VN_User \
  177. X                            "Resurrected $User"
  178. X                if    # we can restore the copy
  179. X                    $CVSBIN/UV $User
  180. X                then
  181. X                    echo $Name: $User, version $VN_User, \
  182. X                        resurrected >&2
  183. X                else
  184. X                    echo $Name: could not \
  185. X                            resurrect $User >&2
  186. X                    OK=no
  187. X                fi
  188. X                ;;
  189. X            esac
  190. X            ;;
  191. X        *)
  192. X            # user file shouldn't be there
  193. X            echo $Name: $User should be removed \
  194. X                and is still there >&2
  195. X            OK=no
  196. X            ;;
  197. X        esac
  198. X        ;;
  199. X    
  200. X    *)
  201. X        # a normal entry, $TS_Rcs is valid
  202. X        
  203. X        # illegal addition
  204. X        echo $Name: $User already exists, \
  205. X            with version number $VN_User >&2
  206. X        OK=no
  207. X        ;;
  208. X    esac
  209. Xdone
  210. X
  211. X$CVSLIB/EF.aux                # update CVS.adm/Files
  212. X
  213. X# did we succeed?
  214. Xcase $OK in
  215. Xno)
  216. X    exit 1
  217. X    ;;
  218. Xesac
  219. X
  220. Xexit 0
  221. + END-OF-FILE AE
  222. chmod 'u=rwx,g=rx,o=rx' 'AE'
  223. set `wc -c 'AE'`
  224. count=$1
  225. case $count in
  226. 3301)    :;;
  227. *)    echo 'Bad character count in ''AE' >&2
  228.         echo 'Count should be 3301' >&2
  229. esac
  230. echo Extracting 'CM'
  231. sed 's/^X//' > 'CM' << '+ END-OF-FILE ''CM'
  232. X#!/bin/sh
  233. X#    This file is part of the Concurrent Versions System CVS.
  234. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  235. X#    $Header: CM,v 3.1 89/09/25 16:29:59 dick Exp $
  236. X
  237. X#
  238. X#        C o m m i t
  239. X#    CM commits the present configuration to the RCS repository, AFTER
  240. X#    having done a test on conflicts.  The call is
  241. X#        CM [ -n ] 'log-message'
  242. X#    for a general commit, and
  243. X#        CM [ -n ] 'log-message' file ...
  244. X#    for a (dangerous) partial commit.
  245. X#
  246. X#    The -n option restricts the actions to reporting only.
  247. X#
  248. XName=CM; export Name
  249. X
  250. X# CVSBIN, CVSLIB and RCSBIN directories
  251. XCVSBIN=/home/top/dick/cvs
  252. XCVSLIB=/home/top/dick/cvs
  253. XRCSBIN=${RCSBIN-/usr/local/bin}
  254. Xexport CVSBIN CVSLIB RCSBIN
  255. X
  256. X# avoid spurious identifications
  257. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  258. X
  259. X# determine the name of the repository
  260. XRepository=""
  261. X. $CVSLIB/NR.aux
  262. X
  263. X# get possible options
  264. X. $CVSLIB/OP.aux            # sets $Options
  265. X
  266. X# to ACT or not to ACT, that is the question
  267. Xcase "$Options" in
  268. X*-n*)
  269. X    ACT=echo
  270. X    ;;
  271. Xesac
  272. X
  273. XMessage="$1"
  274. Xif    # there was no message
  275. X    [ "$Message" = "" ] \
  276. X||    # it was a file name
  277. X    [ -r "$Message" ]
  278. Xthen
  279. X    echo $Name: no modification message! >&2
  280. X    exit 1
  281. Xfi
  282. Xshift
  283. X
  284. XAutoRemove=yes                # with AutoRemove on,
  285. X. $CVSLIB/WL.aux            # set write lock to write in safety
  286. X
  287. X# determine the way we are called
  288. Xcase $# in
  289. X0)
  290. X    # no file names: treat all pertinent files
  291. X    set "`$CVSLIB/FN.aux $Repository`"
  292. X    NOPARAMS=yes
  293. X    ;;
  294. X*)
  295. X    NOPARAMS=no
  296. X    ;;
  297. Xesac
  298. X
  299. X# collect the sets of affected files
  300. X
  301. XOK=yes
  302. X. $CVSLIB/CS.aux    # sets CLIST, GLIST, MLIST, OLIST, ALIST, RLIST, WLIST
  303. X
  304. Xcase $OK in
  305. Xno)
  306. X    # this checks for CLIST as well, since CLIST != "" <-> OK=no
  307. X    exit 1
  308. Xesac
  309. X
  310. X# everything up to date?
  311. Xcase "$GLIST$OLIST$WLIST" in
  312. X"")
  313. X    ;;
  314. X*)
  315. X    echo $Name: the following files are not up to date\; use UV first >&2
  316. X    echo $GLIST$OLIST$WLIST >&2
  317. X    exit 1
  318. X    ;;
  319. Xesac
  320. X
  321. X# is there anything to do in the first place?
  322. Xcase "$MLIST$RLIST$ALIST" in
  323. X"")
  324. X    echo $Name: there is nothing to commit! >&2
  325. X    exit 1
  326. X    ;;
  327. Xesac
  328. X
  329. X# try to get exclusive control of all files to be affected
  330. XOK=yes
  331. Xfor User in $MLIST $RLIST
  332. Xdo
  333. X    Rcs=$Repository/$User,v
  334. X        
  335. X    if    # we can lock $Rcs
  336. X        $ACT $RCSBIN/rcs -q -l $Rcs
  337. X    then    # add it to the list LLIST
  338. X        LLIST="$LLIST $User"
  339. X    else
  340. X        echo $Name: could not lock $Rcs >&2
  341. X        OK=no
  342. X    fi
  343. Xdone
  344. X
  345. X# try to create all files in the add list
  346. Xfor User in $ALIST
  347. Xdo
  348. X    Rcs=$Repository/$User,v
  349. X    
  350. X    if    # create $Rcs, using the description files $User,[pt]
  351. X        $ACT $RCSBIN/rcs -i `cat $User,p` -t$User,t $Rcs
  352. X    then    :
  353. X    else    # something is wrong
  354. X        echo $Name: could not create $Rcs >&2
  355. X        OK=no
  356. X    fi
  357. Xdone
  358. X
  359. X# did we succeed?
  360. Xcase $OK in
  361. Xno)
  362. X    # something failed; unlock all locked files & remove all added files
  363. X    for User in $LLIST
  364. X    do    # unlock the RCS file
  365. X        Rcs=$Repository/$User,v
  366. X        if    # unlock $Rcs
  367. X            $ACT $RCSBIN/rcs -q -u $Rcs
  368. X        then    :
  369. X        else    # something very wrong
  370. X            echo $Name: could not UNlock $Rcs >&2
  371. X        fi
  372. X    done
  373. X    
  374. X    for User in $ALIST
  375. X    do    # remove the newly created RCS file
  376. X        Rcs=$Repository/$User,v
  377. X        $ACT rm -f $Rcs
  378. X    done
  379. X    
  380. X    # and give up
  381. X    exit 1
  382. X    ;;
  383. Xesac
  384. X
  385. X# got them all; now go ahead!
  386. X
  387. X# add the files in the ALIST
  388. X
  389. Xfor User in $ALIST
  390. Xdo
  391. X    . $CVSLIB/CI.aux        # a careful check-in; may set OK=no
  392. X    $ACT rm -f $User,[pt]        # throw away the info files from AE
  393. Xdone
  394. X
  395. X# modify the files in the MLIST
  396. Xfor User in $MLIST
  397. Xdo
  398. X    . $CVSLIB/CI.aux        # a careful check-in; may set OK=no
  399. Xdone
  400. X
  401. X# remove the RCS files in the RLIST
  402. Xcase "$RLIST" in
  403. X"")
  404. X    # no need for $Repository/Attic
  405. X    ;;
  406. X*)
  407. X    # $Repository/Attic needed
  408. X    Attic=$Repository/Attic
  409. X
  410. X    if    [ -d $Attic ]
  411. X    then    # $Attic exists
  412. X        :
  413. X    else    # $Attic must be made
  414. X        if    $ACT mkdir $Attic >/dev/null 2>/dev/null
  415. X        then    :
  416. X        else    echo $Name: could not make $Attic
  417. X            OK=no
  418. X        fi
  419. X    fi
  420. X
  421. X    if    [ -d $Attic ]
  422. X    then
  423. X        for User in $RLIST
  424. X        do
  425. X            Rcs=$Repository/$User,v
  426. X            Old=$Attic/$User,v
  427. X            
  428. X            if    # we can move the RCS file away
  429. X                (    # we can unlock $Rcs
  430. X                    $ACT $RCSBIN/rcs -u -q $Rcs \
  431. X                &&    # we can move it away
  432. X                    $ACT mv $Rcs $Old
  433. X                ) \
  434. X            ||    # the file was already removed
  435. X                ( [ ! -r $Rcs -a -r $Old ] )
  436. X            then    # scratch the entry as well
  437. X                $ACT $CVSLIB/SC.aux $User
  438. X            else
  439. X                echo $Name: attempt to move $Rcs \
  440. X                            to $Old failed >&2
  441. X                OK=no
  442. X            fi
  443. X        done
  444. X    fi
  445. Xesac
  446. X
  447. Xcase $NOPARAMS in
  448. Xyes)    # clear the Mod list, for full commit only
  449. X    $ACT cp /dev/null CVS.adm/Mod
  450. X    #set time of last update, since commit involves an update
  451. X    $ACT rm -f CVS.adm/LastUpdate
  452. X    $ACT cp /dev/null CVS.adm/LastUpdate
  453. X    ;;
  454. Xesac
  455. X
  456. X# did we succeed?
  457. Xcase $OK in
  458. Xno)
  459. X    exit 1
  460. X    ;;
  461. Xesac
  462. X
  463. X# All has gone well: register the commit
  464. X
  465. XAdmin=$Repository/Admin
  466. XCfr=CVS.confrec
  467. XRcsCfr=$Admin/$Cfr,v
  468. XUsrCfr=CVS.adm/$Cfr
  469. X
  470. X# we need the Admin directory
  471. Xif    # $Admin exists
  472. X    [ -d $Admin ]
  473. Xthen    :
  474. Xelse    # $Admin must be made
  475. X    if    $ACT mkdir $Admin >/dev/null 2>/dev/null
  476. X    then    :
  477. X    else    echo $Name: could not make $Admin >&2
  478. X        exit 1
  479. X    fi
  480. Xfi
  481. X
  482. X# create the new configuration history file
  483. X<CVS.adm/Entries sed 's/|.* /| /' >$UsrCfr
  484. X
  485. X# and commit it
  486. XRevision=
  487. X. $CVSLIB/CC.aux            # commit configuration record
  488. X
  489. Xexit 0
  490. X
  491. + END-OF-FILE CM
  492. chmod 'u=rwx,g=rx,o=rx' 'CM'
  493. set `wc -c 'CM'`
  494. count=$1
  495. case $count in
  496. 4949)    :;;
  497. *)    echo 'Bad character count in ''CM' >&2
  498.         echo 'Count should be 4949' >&2
  499. esac
  500. echo Extracting 'CV'
  501. sed 's/^X//' > 'CV' << '+ END-OF-FILE ''CV'
  502. X#!/bin/sh
  503. X#    This file is part of the Concurrent Versions System CVS.
  504. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  505. X#    $Header: CV,v 3.1 89/09/25 16:30:31 dick Exp $
  506. X
  507. X#
  508. X#        C r e a t e   V e r s i o n
  509. X#    CV creates a version of the configuration described by an RCS
  510. X#    repository.  This configuration is owned totally by the user and is
  511. X#    actually an independent copy, to be dealt with as seen fit.  Once CV
  512. X#    has been called in a given directory, it never needs to be called
  513. X#    again.  The user can keep up-to-date by calling UV when he feels like
  514. X#    it; this will supply him with a merge of his own modifications and
  515. X#    the changes made in the RCS original.  See UV for details.
  516. X#
  517. X#    When the user is satisfied with his own modifications, the
  518. X#    present configuration can be committed by CM; this keeps the present
  519. X#    configuration in tact.
  520. X#
  521. X#    The call is
  522. X#        CV <repository-name>
  523. X#    with preferably the full path name of the RCS repository.
  524. X#    CV will then make the initial copy (at RCS speed).
  525. X#
  526. X#    CV creates a directory ./CVS.adm, in which CVS keeps its
  527. X#    administration, in a number of files. Only the file
  528. X#    ./CVS.adm/Repository is of importance to the user, since it contains
  529. X#    the name of the repository.  This file is a normal file and can be
  530. X#    edited by the user, if necessary (when the repository is moved, e.g.)
  531. X#
  532. XName=CV; export Name
  533. X
  534. X# CVSBIN, CVSLIB and RCSBIN directories
  535. XCVSBIN=/home/top/dick/cvs
  536. XCVSLIB=/home/top/dick/cvs
  537. XRCSBIN=${RCSBIN-/usr/local/bin}
  538. Xexport CVSBIN CVSLIB RCSBIN
  539. X
  540. X# avoid spurious identifications
  541. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  542. X
  543. X# is the number of parameters correct?
  544. Xcase $# in
  545. X1)    # OK
  546. X    ;;
  547. X*)
  548. X    echo Call is: $Name repository-name >&2
  549. X    exit 1
  550. X    ;;
  551. Xesac
  552. X
  553. XRepository=$1
  554. X
  555. X# check the existence of the repository
  556. X. $CVSLIB/NR.aux
  557. X
  558. X# create the user administration directory
  559. X. $CVSLIB/CA.aux            # uses $Repository
  560. X
  561. X# make dummy entries for files already present, for UV to work on
  562. Xfor User in `$CVSLIB/FN.aux $Repository`
  563. Xdo
  564. X    Rcs=$Repository/$User,v
  565. X    . $CVSLIB/VT.aux    # sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
  566. X    
  567. X    case "$TS_User" in
  568. X    "")
  569. X        # no problem
  570. X        ;;
  571. X    *)
  572. X        # the file is already there, we acknowledge its presence
  573. X        $CVSLIB/RG.aux $User $VN_Rcs "Initial $User"
  574. X        ;;
  575. X    esac
  576. Xdone
  577. X
  578. X# call UV
  579. X$CVSBIN/UV
  580. + END-OF-FILE CV
  581. chmod 'u=rwx,g=rx,o=rx' 'CV'
  582. set `wc -c 'CV'`
  583. count=$1
  584. case $count in
  585. 2247)    :;;
  586. *)    echo 'Bad character count in ''CV' >&2
  587.         echo 'Count should be 2247' >&2
  588. esac
  589. echo Extracting 'DF'
  590. sed 's/^X//' > 'DF' << '+ END-OF-FILE ''DF'
  591. X#!/bin/sh
  592. X#    This file is part of the Concurrent Versions System CVS.
  593. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  594. X#    $Header: DF,v 3.1 89/09/25 16:31:00 dick Exp $
  595. X
  596. X#
  597. X#        D i f f e r e n c e
  598. X#    Does a nice form of diff(1) on each of its arguments and the
  599. X#    RCS file it derives from.
  600. X#    The call is
  601. X#        DF <options> [ file-name ... ]
  602. X#    If there are <options>, these are passed to diff(1) and the diff
  603. X#    format is adhered to; otherwise a more readable format is produced.
  604. X#    Standard diff(1) format can also be forced by a single -.
  605. X#    If there are no file names, DF treats the files that have been
  606. X#    modified since the last call to CM.  If the option is -n, diff(1) will
  607. X#    not be called, but the list of modified files will be displayed
  608. X#    instead.
  609. X#
  610. XName=DF; export Name
  611. X
  612. X# CVSBIN, CVSLIB and RCSBIN directories
  613. XCVSBIN=/home/top/dick/cvs
  614. XCVSLIB=/home/top/dick/cvs
  615. XRCSBIN=${RCSBIN-/usr/local/bin}
  616. Xexport CVSBIN CVSLIB RCSBIN
  617. X
  618. X# avoid spurious identifications
  619. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  620. X
  621. X# determine the name of the repository
  622. XRepository=""
  623. X. $CVSLIB/NR.aux
  624. X
  625. X# get possible options
  626. X. $CVSLIB/OP.aux            # sets $Options
  627. X
  628. X# special cases
  629. Xcase "$Options" in
  630. X" -")
  631. X    # single -, just plain old diff
  632. X    Options=" "
  633. X    ;;
  634. X" -n")
  635. X    # no diff at all, just list names of modified files
  636. X    $CVSLIB/MF.aux
  637. X    exit 0
  638. X    ;;
  639. Xesac
  640. X
  641. X# determine the way we are called
  642. Xcase $# in
  643. X0)
  644. X    # no file names: get list of modified files
  645. X    MODFILES=`$CVSLIB/MF.aux`
  646. X    if    # there are none
  647. X        [ "$MODFILES" = "" ]
  648. X    then
  649. X        echo $Name: no modifications to report
  650. X        exit 0
  651. X    fi
  652. X    set $MODFILES
  653. X    ;;
  654. Xesac
  655. X
  656. Xfor User in $@
  657. Xdo
  658. X    . $CVSLIB/LR.aux    # sets $Rcs to $Repository/$User,v or /Attic/
  659. X    . $CVSLIB/VT.aux    # sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
  660. X    
  661. X    # what entry is this?
  662. X    case $VN_User in
  663. X    "")
  664. X        # no entry available, $TS_Rcs is invalid
  665. X        
  666. X        echo $Name: I know nothing about $User >&2
  667. X        continue
  668. X        ;;
  669. X    
  670. X    0)
  671. X        # an entry for a new-born file, $TS_Rcs is dummy
  672. X        
  673. X        echo $Name: $User is a new entry, no comparison available >&2
  674. X        continue
  675. X        ;;
  676. X    
  677. X    -*)
  678. X        # an entry for a removed file, $TS_Rcs is valid
  679. X        
  680. X        echo $Name: $User was removed, no comparison available >&2
  681. X        continue
  682. X        ;;
  683. X    
  684. X    *)
  685. X        # a normal entry, $TS_Rcs is valid
  686. X        
  687. X        # how is the RCS file?
  688. X        case $VN_Rcs in
  689. X        "")
  690. X            # there is no RCS file
  691. X            
  692. X            echo $Name: cannot find $Rcs >&2
  693. X            continue
  694. X            ;;
  695. X        *)
  696. X            # there is an RCS file
  697. X            
  698. X            # how is the user file?
  699. X            case "$TS_User" in
  700. X            "")
  701. X                # there is no user file
  702. X                echo $Name: cannot find $User >&2
  703. X                continue
  704. X                ;;
  705. X            esac
  706. X            ;;
  707. X        esac
  708. X        ;;
  709. X    esac
  710. X
  711. X    echo FILE $User VERSUS $Rcs, version $VN_User
  712. X    $RCSBIN/co -p -q -r$VN_User $Rcs |
  713. X    diff $Options $User - |
  714. X    case "$Options" in
  715. X    "")
  716. X        # nothing special, user seems to like my taste in diffs
  717. X        sed '
  718. X            s/^[1-9][0-9]*/&/
  719. X            s/.*//
  720. X            s/^[1-9]/\
  721. XAT &/
  722. X            s/^> /WAS:    /
  723. X            s/^< /NEW:    /
  724. X        '
  725. X        ;;
  726. X    *)
  727. X        # have it you own way
  728. X        cat
  729. X        ;;
  730. X    esac
  731. X    echo ''
  732. X
  733. Xdone
  734. + END-OF-FILE DF
  735. chmod 'u=rwx,g=rx,o=rx' 'DF'
  736. set `wc -c 'DF'`
  737. count=$1
  738. case $count in
  739. 2887)    :;;
  740. *)    echo 'Bad character count in ''DF' >&2
  741.         echo 'Count should be 2887' >&2
  742. esac
  743. echo Extracting 'GC'
  744. sed 's/^X//' > 'GC' << '+ END-OF-FILE ''GC'
  745. X#!/bin/sh
  746. X#    This file is part of the Concurrent Versions System CVS.
  747. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  748. X#    $Header: GC,v 3.1 89/09/25 16:31:29 dick Exp $
  749. X
  750. X#
  751. X#        G a r b a g e   C o l l e c t i o n
  752. X#    Collects garbage, dust & dead wood; does consistency checks.
  753. X#    Should be called after crashes while a CVS-program was running,
  754. X#    and other mishaps.
  755. X#
  756. XName=GC; export Name
  757. X
  758. X# CVSBIN, CVSLIB and RCSBIN directories
  759. XCVSBIN=/home/top/dick/cvs
  760. XCVSLIB=/home/top/dick/cvs
  761. XRCSBIN=${RCSBIN-/usr/local/bin}
  762. Xexport CVSBIN CVSLIB RCSBIN
  763. X
  764. X# avoid spurious identifications
  765. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  766. X
  767. X# determine the name of the repository
  768. XRepository=""
  769. X. $CVSLIB/NR.aux
  770. X
  771. XTmp1=CVS.adm/\#GC.1
  772. XTmp2=CVS.adm/\#GC.2
  773. X
  774. X# are there duplicates in the CVS.adm/Entries file?
  775. Xcat CVS.adm/Entries |
  776. Xsed 's/.* \(.*\)|/\1/' |
  777. Xsort |
  778. Xuniq -c |
  779. Xgrep -v ' 1 ' >$Tmp1
  780. Xif    # this yielded something
  781. X    [ -s $Tmp1 ]
  782. Xthen    # report
  783. X    echo $Name: duplicates in CVS.adm/Entries:
  784. X    cat $Tmp1
  785. Xfi
  786. X
  787. X# try to find garbage in CVS.adm
  788. Xls CVS.adm |
  789. Xsed '
  790. X    /^Entries$/d
  791. X    /^Entries.Backup$/d
  792. X    /^Files$/d
  793. X    /^Mod$/d
  794. X    /^LastUpdate$/d
  795. X    /^Repository$/d
  796. X    /^#GC.[12]$/d
  797. X' >$Tmp1
  798. Xif    # this yielded something
  799. X    [ -s $Tmp1 ]
  800. Xthen    # report
  801. X    echo $Name: garbage in directory CVS.adm:
  802. X    cat $Tmp1 |
  803. X    sed 's/^/    CVS.adm\//'
  804. X    echo ''
  805. Xfi
  806. X
  807. X# try to find locked files in the repository
  808. X(
  809. X    cd $Repository
  810. X    if    # there are RCS files there
  811. X        [ "`echo *,v`" != "*,v" ]
  812. X    then    # check them
  813. X        $RCSBIN/rlog -Lh *,v
  814. X    fi
  815. X    if    # there are hidden RCS files there
  816. X        [ "`echo .*,v`" != ".*,v" ]
  817. X    then    # check them too
  818. X        $RCSBIN/rlog -Lh .*,v
  819. X    fi
  820. X)
  821. X
  822. X# try to find garbage left-over by RCS
  823. X(
  824. X    ls -d ,* $Repository/,* 2>&1
  825. X) |
  826. Xsed '
  827. X    /not found/d
  828. X' >$Tmp1
  829. Xif    # this yielded something
  830. X    [ -s $Tmp1 ]
  831. Xthen    # report
  832. X    echo $Name: RCS left-overs found:
  833. X    cat $Tmp1 |
  834. X    sed 's/^/    /'
  835. X    echo ''
  836. Xfi
  837. X
  838. X# try to find left-over locks & flags
  839. Xecho $Repository/\#cvs.* |
  840. Xgrep -v '\*' >$Tmp1
  841. Xif    # this yielded something
  842. X    [ -s $Tmp1 ]
  843. Xthen    # such garbage exists
  844. X    echo $Name: left-over flags and locks found:
  845. X    cat $Tmp1 |
  846. X    sed 's/^/    /'
  847. X    echo ''
  848. Xfi
  849. X
  850. X# If there is a $Header in the user file, see if it has the same
  851. X# version number as in the administration
  852. Xfor User in `$CVSLIB/FN.aux $Repository`
  853. Xdo
  854. X    . $CVSLIB/VT.aux    # sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
  855. X    . $CVSLIB/HN.aux    # sets $HN_User
  856. X    
  857. X    if    # there was a $Header
  858. X        [ "$HN_User" != "" ] \
  859. X    &&    # it is not equal to the one in Entries
  860. X        [ "$HN_User" != "$VN_User" ]
  861. X    then
  862. X        echo $Name: $User has version number $VN_User \
  863. X            in administration and $HN_User in Header
  864. X    fi
  865. Xdone
  866. X
  867. Xrm -f $Tmp1 $Tmp2
  868. + END-OF-FILE GC
  869. chmod 'u=rwx,g=rx,o=rx' 'GC'
  870. set `wc -c 'GC'`
  871. count=$1
  872. case $count in
  873. 2569)    :;;
  874. *)    echo 'Bad character count in ''GC' >&2
  875.         echo 'Count should be 2569' >&2
  876. esac
  877. echo Extracting 'HR'
  878. sed 's/^X//' > 'HR' << '+ END-OF-FILE ''HR'
  879. X#!/bin/sh
  880. X#    This file is part of the Concurrent Versions System CVS.
  881. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  882. X#    $Header: HR,v 3.1 89/09/25 16:31:50 dick Exp $
  883. X
  884. X#
  885. X#        H i g h e s t   R e l e a s e   N u m b e r
  886. X#    Writes the highest release number of the repository to standard output.
  887. X#    Applies to a repository or to the working directory.
  888. X#
  889. XName=HR; export Name
  890. X
  891. X# CVSBIN, CVSLIB and RCSBIN directories
  892. XCVSBIN=/home/top/dick/cvs
  893. XCVSLIB=/home/top/dick/cvs
  894. XRCSBIN=${RCSBIN-/usr/local/bin}
  895. Xexport CVSBIN CVSLIB RCSBIN
  896. X
  897. X# avoid spurious identifications
  898. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  899. X
  900. X# determine the name of the repository
  901. XRepository=$1                # if present
  902. X. $CVSLIB/NR.aux
  903. X
  904. X# set up names in Admin
  905. XAdmin=$Repository/Admin
  906. XHighest=$Admin/HighestRelease
  907. X
  908. X# we need the Admin directory
  909. Xif    # $Admin exists
  910. X    [ -d $Admin ]
  911. Xthen    :
  912. Xelse    # $Admin must be made
  913. X    if    $ACT mkdir $Admin >/dev/null 2>/dev/null
  914. X    then    :
  915. X    else    echo $Name: could not make $Admin >&2
  916. X        exit 1
  917. X    fi
  918. Xfi
  919. X
  920. X# we need the highest release number file
  921. Xif    # there is a highest release number file
  922. X    [ -r $Highest ]
  923. Xthen    :
  924. Xelse    # create it
  925. X    RCSFILES=`
  926. X        ls $Repository/*,v $Repository/Attic/*,v 2>/dev/null |
  927. X        grep -v "\*"
  928. X    `
  929. X    (
  930. X        echo 0            # in case the directory is empty
  931. X        for Rcs in $RCSFILES
  932. X        do
  933. X            $CVSLIB/VN.aux $Rcs
  934. X        done
  935. X    ) |
  936. X    sed 's/\..*//' |
  937. X    sort -nru |
  938. X    sed '1q' >$Highest
  939. Xfi
  940. X
  941. Xcat $Highest
  942. X
  943. + END-OF-FILE HR
  944. chmod 'u=rwx,g=rx,o=rx' 'HR'
  945. set `wc -c 'HR'`
  946. count=$1
  947. case $count in
  948. 1378)    :;;
  949. *)    echo 'Bad character count in ''HR' >&2
  950.         echo 'Count should be 1378' >&2
  951. esac
  952. echo Extracting 'LS'
  953. sed 's/^X//' > 'LS' << '+ END-OF-FILE ''LS'
  954. X#!/bin/sh
  955. X#    This file is part of the Concurrent Versions System CVS.
  956. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  957. X#    $Header: LS,v 3.1 89/09/25 16:32:40 dick Exp $
  958. X
  959. X#
  960. X#        L i s t   i n f o r m a t i o n
  961. X#    Prints three lines of information for each of its arguments,
  962. X#    one for the user file (line 1), one for the newest RCS file
  963. X#    (line 3) and one for the RCS file both derive from (line 2).
  964. X#
  965. X#    If the option -l is given, each report will be followed by
  966. X#    the log of the the file as kept by RCS.
  967. X#
  968. XName=LS; export Name
  969. X
  970. X# CVSBIN, CVSLIB and RCSBIN directories
  971. XCVSBIN=/home/top/dick/cvs
  972. XCVSLIB=/home/top/dick/cvs
  973. XRCSBIN=${RCSBIN-/usr/local/bin}
  974. Xexport CVSBIN CVSLIB RCSBIN
  975. X
  976. X# avoid spurious identifications
  977. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  978. X
  979. X# determine the name of the repository
  980. XRepository=""
  981. X. $CVSLIB/NR.aux
  982. X
  983. X# get possible options
  984. X. $CVSLIB/OP.aux            # sets $Options
  985. X
  986. X# check option
  987. Xcase "$Options" in
  988. X""|" -l")
  989. X    # OK
  990. X    ;;
  991. X*)
  992. X    echo Call is: $Name \[ -l \] filename ... >&2
  993. X    exit 1
  994. X    ;;
  995. Xesac
  996. X
  997. X# determine the way we are called
  998. Xcase $# in
  999. X0)
  1000. X    # no file names: all pertinent files
  1001. X    set "`$CVSLIB/FN.aux $Repository`"
  1002. X    ;;
  1003. Xesac
  1004. X
  1005. Xfor User in $@
  1006. Xdo
  1007. X    . $CVSLIB/LR.aux    # sets $Rcs to $Repository/$User,v or /Attic/
  1008. X    . $CVSLIB/VT.aux    # sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
  1009. X    . $CVSLIB/HN.aux    # sets $HN_User
  1010. X    
  1011. X    case "$TS_User" in
  1012. X    "")
  1013. X        echo "User:    no user file $User"
  1014. X        ;;
  1015. X    *)
  1016. X        echo "User:    $HN_User    $TS_User"
  1017. X        ;;
  1018. X    esac
  1019. X    
  1020. X    case $VN_User in
  1021. X    "")
  1022. X        echo "From:    no entry for $User"
  1023. X        ;;
  1024. X    0)
  1025. X        # a new file
  1026. X        echo "From:    new    message: `<$User,t sed '1!d'`"
  1027. X        ;;
  1028. X    *)
  1029. X        echo "From:    $VN_User    $TS_Rcs"
  1030. X        ;;
  1031. X    esac
  1032. X    
  1033. X    case $VN_Rcs in
  1034. X    "")
  1035. X        echo "RCS:    no $Rcs"
  1036. X        ;;
  1037. X    *)
  1038. X        echo "RCS:    $VN_Rcs    $Rcs"
  1039. X        ;;
  1040. X    esac
  1041. X    
  1042. X    if    # RCS log requested
  1043. X        [ "$Options" = " -l" ]
  1044. X    then
  1045. X        $RCSBIN/rlog $Rcs
  1046. X    fi
  1047. X    echo ''
  1048. Xdone
  1049. + END-OF-FILE LS
  1050. chmod 'u=rwx,g=rx,o=rx' 'LS'
  1051. set `wc -c 'LS'`
  1052. count=$1
  1053. case $count in
  1054. 1807)    :;;
  1055. *)    echo 'Bad character count in ''LS' >&2
  1056.         echo 'Count should be 1807' >&2
  1057. esac
  1058. echo Extracting 'NR'
  1059. sed 's/^X//' > 'NR' << '+ END-OF-FILE ''NR'
  1060. X#!/bin/sh
  1061. X#    This file is part of the Concurrent Versions System CVS.
  1062. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1063. X#    $Header: NR,v 3.1 89/09/25 16:33:18 dick Exp $
  1064. X
  1065. X#
  1066. X#        N e w   R e l e a s e
  1067. X#    NR <number> <repository-name> will raise the version number of all
  1068. X#    files in the repository to <number>.1  The <number> must be higher
  1069. X#    than the highest release number in the repository.
  1070. X#
  1071. XName=NR; export Name
  1072. X
  1073. X# CVSBIN, CVSLIB and RCSBIN directories
  1074. XCVSBIN=/home/top/dick/cvs
  1075. XCVSLIB=/home/top/dick/cvs
  1076. XRCSBIN=${RCSBIN-/usr/local/bin}
  1077. Xexport CVSBIN CVSLIB RCSBIN
  1078. X
  1079. X# avoid spurious identifications
  1080. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  1081. X
  1082. X# check parameters
  1083. Xcase $# in
  1084. X2)    # OK
  1085. X    ;;
  1086. X*)
  1087. X    echo Call is: $Name release-number repository >&2
  1088. X    exit 1
  1089. X    ;;
  1090. Xesac
  1091. X
  1092. X# check the existence of the repository
  1093. XRepository="$2"
  1094. X. $CVSLIB/NR.aux
  1095. X
  1096. X# is the repository properly locked?
  1097. XLCK=$Repository/\#cvs.lock        # the lock
  1098. XLFL=$Repository/\#cvs.lfl        # the general lock flag
  1099. X
  1100. Xif    # there is a lock and it comes from LCK
  1101. X    [ -d $LCK -a -f $LFL ]
  1102. Xthen    :
  1103. Xelse
  1104. X    echo $Name: repository $Repository was not locked by LCK on >&2
  1105. X    exit 1
  1106. Xfi
  1107. X
  1108. XNewNumber=$1
  1109. Xcase "$1" in
  1110. X[0-9]*)    # OK
  1111. X    ;;
  1112. X*)
  1113. X    echo $Name on $Repository: release-number $NewNumber \
  1114. X        is not numerical >&2
  1115. X    ;;
  1116. Xesac
  1117. X
  1118. X# set up names in Admin
  1119. XAdmin=$Repository/Admin
  1120. XCfr=CVS.confrec
  1121. XRcsCfr=$Admin/$Cfr,v
  1122. XUsrCfr=$Admin/$Cfr
  1123. XHighest=$Admin/HighestRelease
  1124. X
  1125. X# get the old release number (also insures the presence of $Repository/Admin)
  1126. XOldNumber=`$CVSBIN/HR $Repository`
  1127. X
  1128. Xif    [ $NewNumber -le $OldNumber ]
  1129. Xthen    # release number can only go up
  1130. X    echo $Name on $Repository: new release number $NewNumber \
  1131. X        not larger than old release number $OldNumber >&2
  1132. X    exit 1
  1133. Xfi
  1134. X
  1135. XMessage="Release number raised to $NewNumber"
  1136. X
  1137. X# make an empty scratch directory to check out the files
  1138. XNRDir=$Admin/NRDir
  1139. Xrm -rf $NRDir                # remove left-overs
  1140. Xif    # we can make such a directory
  1141. X    mkdir $NRDir
  1142. Xthen    :
  1143. Xelse
  1144. X    echo $Name: could not make scratch directory $NRDir >&2
  1145. X    exit 1
  1146. Xfi
  1147. X
  1148. X# set trap to remove scratch directory on interrupt and exit
  1149. Xtrap 'rm -rf $NRDir; exit 1' 1 2 3 15
  1150. Xtrap 'rm -rf $NRDir; exit 0' 0
  1151. X
  1152. X# clear the configuration record
  1153. Xcp /dev/null $UsrCfr
  1154. X
  1155. X# get all files in the repository
  1156. X(cd $Repository; ls *,v .*,v 2>/dev/null | grep -v '\*') |
  1157. Xwhile    read File
  1158. Xdo
  1159. X    Rcs=$Repository/$File
  1160. X    Working=$NRDir/`basename $File ,v`
  1161. X
  1162. X    if    # check out the RCS file into the scratch directory
  1163. X        $RCSBIN/co -l -q $Rcs $Working 2>&1
  1164. X    then    :
  1165. X    else
  1166. X        echo $Name: could not check out $Working >&2
  1167. X        exit 1
  1168. X    fi
  1169. X
  1170. X    if    # check in the user file with new release number
  1171. X        $RCSBIN/ci -r$NewNumber.1 -m"$Message" -f $Rcs $Working 2>&1
  1172. X    then    :
  1173. X    else    # something is very wrong
  1174. X        echo $Name: could not check in $Working >&2
  1175. X        rm $Working
  1176. X        if    # unlock $Rcs
  1177. X            $RCSBIN/rcs -u $Rcs
  1178. X        then    :
  1179. X        else
  1180. X            echo $Name: could not UNlock $Rcs >&2
  1181. X        fi
  1182. X        exit 1
  1183. X    fi
  1184. X
  1185. X    # add to configuration record
  1186. X    echo "$NewNumber| $File|" >>$UsrCfr
  1187. Xdone
  1188. X
  1189. X# check in the configuration record, to establish the new situation
  1190. X
  1191. XACT=                    # no -n option to NR
  1192. XRevision=-r$NewNumber.1
  1193. X. $CVSLIB/CC.aux            # commit configuration record
  1194. X
  1195. X# update $Highest
  1196. Xecho $NewNumber >$Highest
  1197. X
  1198. Xexit 0
  1199. X
  1200. + END-OF-FILE NR
  1201. chmod 'u=rwx,g=rx,o=rx' 'NR'
  1202. set `wc -c 'NR'`
  1203. count=$1
  1204. case $count in
  1205. 3147)    :;;
  1206. *)    echo 'Bad character count in ''NR' >&2
  1207.         echo 'Count should be 3147' >&2
  1208. esac
  1209. echo Extracting 'RC'
  1210. sed 's/^X//' > 'RC' << '+ END-OF-FILE ''RC'
  1211. X#!/bin/sh
  1212. X#    This file is part of the Concurrent Versions System CVS.
  1213. X#    Written by Erik Baalbergen, Vrije Universiteit, Amsterdam.
  1214. X#    $Header: RC,v 3.3 89/10/13 12:04:30 dick Exp $
  1215. X
  1216. X#
  1217. X#        R e a d   C o n f i g u r a t i o n   h i s t o r y
  1218. X#
  1219. X#    Reads the configuration history file, either of the working
  1220. X#    directory or of a repository.
  1221. X#        RC -i
  1222. X#    will display the present configuration identifier.
  1223. X#
  1224. XName=RC; export Name
  1225. X
  1226. X# CVSBIN, CVSLIB and RCSBIN directories
  1227. XCVSBIN=/home/top/dick/cvs
  1228. XCVSLIB=/home/top/dick/cvs
  1229. XRCSBIN=${RCSBIN-/usr/local/bin}
  1230. Xexport CVSBIN CVSLIB RCSBIN
  1231. X
  1232. X# avoid spurious identifications
  1233. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  1234. X
  1235. X# get the one possible option
  1236. Xcase "$1" in
  1237. X-i)
  1238. X    Option=$1
  1239. X    shift
  1240. X    ;;
  1241. X-*)
  1242. X    echo Call is: $Name \[ -i \] \[ repository-name \] >&2
  1243. X    exit 1
  1244. X    ;;
  1245. Xesac
  1246. X
  1247. X# determine the name of the repository
  1248. XRepository=$1
  1249. X. $CVSLIB/NR.aux
  1250. X
  1251. X# set up names in Admin
  1252. XAdmin=$Repository/Admin
  1253. XCfr=CVS.confrec
  1254. XRcsCfr=$Admin/$Cfr,v
  1255. X
  1256. Xif    [ -f $RcsCfr ]
  1257. Xthen
  1258. X    case "$Option" in
  1259. X    '')    # display the whole configuration history
  1260. X        # get the RCS log
  1261. X        if    $RCSBIN/rlog $RcsCfr
  1262. X        then    :
  1263. X        else
  1264. X            echo $Name: rlog failed on existing $RcsCfr >&2
  1265. X            exit 1
  1266. X        fi |
  1267. X        # remove all kinds of garbage
  1268. X        tr '\200-\377' '' |
  1269. X        # identify revision and date lines
  1270. X        sed '
  1271. X            /^-*$/{
  1272. X                N
  1273. X                s/\nrevision /\
  1274. X<REV> /
  1275. X                N
  1276. X                s/\ndate: /\
  1277. X<DATE> /
  1278. X            }
  1279. X        ' |
  1280. X        # edit date lines and remove crud
  1281. X        sed '
  1282. X            1,/^-*$/d
  1283. X            /^<DATE>/s/;  author: / /
  1284. X            /^<DATE>/s/;  .*//
  1285. X            /^-*$/d
  1286. X            /^=*$/d
  1287. X        ' |
  1288. X        # format output
  1289. X        awk '{
  1290. X            if ($1 == "<REV>") {
  1291. X                rev = $2;
  1292. X            }
  1293. X            else
  1294. X            if ($1 == "<DATE>") {
  1295. X                date = $2; time = $3; author = "(" $4 ")";
  1296. X            }
  1297. X            else {
  1298. X                printf("%s\t%s %s %s\t%s\n", \
  1299. X                    rev, date, time, author, $0);
  1300. X                rev = ""; date = "        "; time = "        ";
  1301. X                author = "\t";
  1302. X            }
  1303. X        }'
  1304. X        ;;
  1305. X
  1306. X    -i)    # display present configuration identifier
  1307. X        if    $RCSBIN/rlog $RcsCfr
  1308. X        then    :
  1309. X        else
  1310. X            echo $Name: rlog failed on existing $RcsCfr >&2
  1311. X            exit 1
  1312. X        fi |
  1313. X        grep '^revision ' |
  1314. X        sed '
  1315. X            s/revision //
  1316. X            s/ *$//
  1317. X            2,$d
  1318. X        '
  1319. X        ;;
  1320. X    esac
  1321. Xelse
  1322. X    echo $Name: no configuration history available for $Repository >&2
  1323. X    exit 1
  1324. Xfi
  1325. X
  1326. Xexit 0
  1327. + END-OF-FILE RC
  1328. chmod 'u=rwx,g=rx,o=rx' 'RC'
  1329. set `wc -c 'RC'`
  1330. count=$1
  1331. case $count in
  1332. 2149)    :;;
  1333. *)    echo 'Bad character count in ''RC' >&2
  1334.         echo 'Count should be 2149' >&2
  1335. esac
  1336. echo Extracting 'RM'
  1337. sed 's/^X//' > 'RM' << '+ END-OF-FILE ''RM'
  1338. X#!/bin/sh
  1339. X#    This file is part of the Concurrent Versions System CVS.
  1340. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1341. X#    $Header: RM,v 3.1 89/09/25 16:34:26 dick Exp $
  1342. X
  1343. X#
  1344. X#        R e m o v e   E n t r y
  1345. X#    RM filename ... : removes entries from the present configuration.
  1346. X#    The entries will be removed from the RCS repository upon the
  1347. X#    next CM.
  1348. X#
  1349. XName=RM; export Name
  1350. X
  1351. X# CVSBIN, CVSLIB and RCSBIN directories
  1352. XCVSBIN=/home/top/dick/cvs
  1353. XCVSLIB=/home/top/dick/cvs
  1354. XRCSBIN=${RCSBIN-/usr/local/bin}
  1355. Xexport CVSBIN CVSLIB RCSBIN
  1356. X
  1357. X# avoid spurious identifications
  1358. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  1359. X
  1360. X# determine the name of the repository
  1361. XRepository=""
  1362. X. $CVSLIB/NR.aux
  1363. X
  1364. X# is the number of parameters correct?
  1365. Xcase $# in
  1366. X0)
  1367. X    echo Call is: $Name filename ... \
  1368. X                to remove files from present configuration >&2
  1369. X    exit 1
  1370. X    ;;
  1371. Xesac
  1372. X
  1373. XOK=yes
  1374. Xfor User in $@
  1375. Xdo
  1376. X    Rcs=$Repository/$User,v
  1377. X    . $CVSLIB/VT.aux    # sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
  1378. X    
  1379. X    # $User may still exist
  1380. X    case "$TS_User" in
  1381. X    "")
  1382. X        ;;
  1383. X    *)
  1384. X        echo $Name: $User still exists >&2
  1385. X        OK=no
  1386. X        continue
  1387. X        ;;
  1388. X    esac
  1389. X    
  1390. X    # check its status
  1391. X    case $VN_User in
  1392. X    "")
  1393. X        echo $Name: there is no entry for $User >&2
  1394. X        OK=no
  1395. X        ;;
  1396. X    0)
  1397. X        # killed in the cradle
  1398. X        $CVSLIB/SC.aux $User
  1399. X        rm -f $User,?
  1400. X        ;;
  1401. X    -*)
  1402. X        echo $Name: $User was already removed >&2
  1403. X        OK=no
  1404. X        ;;
  1405. X    *)
  1406. X        # a full-grown entry; set it to removed
  1407. X        $CVSLIB/RG.aux $User -$VN_User "$TS_Rcs"
  1408. X        ;;
  1409. X    esac
  1410. Xdone
  1411. X
  1412. X$CVSLIB/EF.aux                # update CVS.adm/Files
  1413. X
  1414. X# did we succeed?
  1415. Xcase $OK in
  1416. Xno)
  1417. X    exit 1
  1418. X    ;;
  1419. Xesac
  1420. X
  1421. Xexit 0
  1422. + END-OF-FILE RM
  1423. chmod 'u=rwx,g=rx,o=rx' 'RM'
  1424. set `wc -c 'RM'`
  1425. count=$1
  1426. case $count in
  1427. 1515)    :;;
  1428. *)    echo 'Bad character count in ''RM' >&2
  1429.         echo 'Count should be 1515' >&2
  1430. esac
  1431. echo Extracting 'RV'
  1432. sed 's/^X//' > 'RV' << '+ END-OF-FILE ''RV'
  1433. X#!/bin/sh
  1434. X#    This file is part of the Concurrent Versions System CVS.
  1435. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1436. X#    $Header: RV,v 3.1 89/09/25 16:34:36 dick Exp $
  1437. X
  1438. X#
  1439. X#        R e s t o r e   V e r s i o n
  1440. X#    RV restores a version of the configuration, given the repository name
  1441. X#    and a configuration identifier.  The call is
  1442. X#        RV <repository-name> <configuration-identifier>
  1443. X#    The files will be reconstructed with the correct revision number,
  1444. X#    even if they have been removed by RM and CM in the meantime.
  1445. X#
  1446. X#    For backward compatibility, RV will still be able to work from
  1447. X#    SV-records, as created by the late program SV. The SV-record will be
  1448. X#    read from standard input by the call
  1449. X#        RV <repository-name> -
  1450. XName=RV; export Name
  1451. X
  1452. X# CVSBIN, CVSLIB and RCSBIN directories
  1453. XCVSBIN=/home/top/dick/cvs
  1454. XCVSLIB=/home/top/dick/cvs
  1455. XRCSBIN=${RCSBIN-/usr/local/bin}
  1456. Xexport CVSBIN CVSLIB RCSBIN
  1457. X
  1458. X# avoid spurious identifications
  1459. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  1460. X
  1461. X# is the number of parameters correct?
  1462. Xcase $# in
  1463. X2)    # OK
  1464. X    ;;
  1465. X*)
  1466. X    echo Call is: $Name repository-name configuration-identifier >&2
  1467. X    exit 1
  1468. X    ;;
  1469. Xesac
  1470. X
  1471. XRepository=$1
  1472. XConfIdf=$2                # configuration identifier;could be a -
  1473. X
  1474. X# check the existence of the repository
  1475. X. $CVSLIB/NR.aux
  1476. X
  1477. X# set up names in Admin
  1478. XAdmin=$Repository/Admin
  1479. XCfr=CVS.confrec
  1480. XRcsCfr=$Admin/$Cfr,v
  1481. X
  1482. Xcase $ConfIdf in
  1483. X-)    # obsolete case of a SV record
  1484. X    # create the administration directory
  1485. X    . $CVSLIB/CA.aux        # uses $Repository
  1486. X
  1487. X    # get the CVS.adm/Entries file from standard input
  1488. X    cat - >CVS.adm/Entries
  1489. X    ;;
  1490. X
  1491. X*)    # $ConfIdf is a real configuration identifier
  1492. X    if    [ -f $RcsCfr ]
  1493. X    then
  1494. X        # create the administration directory
  1495. X        . $CVSLIB/CA.aux    # uses $Repository
  1496. X
  1497. X        # get the configuration record of the denoted configuration
  1498. X        if    $RCSBIN/co -p -q -r$ConfIdf $RcsCfr >CVS.adm/Entries
  1499. X        then :
  1500. X        else
  1501. X            echo $Name: there is no configuration $ConfIdf >&2
  1502. X            exit 1
  1503. X        fi
  1504. X    else
  1505. X        echo $Name: no configuration history available \
  1506. X            for $Repository >&2
  1507. X        exit 1
  1508. X    fi
  1509. Xesac
  1510. X
  1511. X# construct list of files to check out
  1512. XOLIST=` <CVS.adm/Entries sed 's/.* \(.*\)|/\1/' `
  1513. X
  1514. X# see if any is already present
  1515. XOK=yes
  1516. Xfor User in $OLIST
  1517. Xdo
  1518. X    if    # there is a file $User already
  1519. X        [ -f $User ]
  1520. X    then
  1521. X        echo $Name on $Repository: $User already exists >&2
  1522. X        OK=no
  1523. X    fi
  1524. Xdone
  1525. X
  1526. Xcase $OK in
  1527. Xno)
  1528. X    echo $Name failed\; correct above errors first >&2
  1529. X    exit 1
  1530. X    ;;
  1531. Xesac
  1532. X
  1533. X# check out all files in $OLIST
  1534. Xfor User in $OLIST
  1535. Xdo
  1536. X    . $CVSLIB/LR.aux    # sets $Rcs to $Repository/$User,v or /Attic/
  1537. X    . $CVSLIB/VT.aux    # sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
  1538. X    
  1539. X    # how is the RCS file?
  1540. X    case $VN_Rcs in
  1541. X    "")
  1542. X        # there is no RCS file
  1543. X        
  1544. X        echo $Name: cannot find $Rcs >&2
  1545. X        OK=no
  1546. X        continue
  1547. X        ;;
  1548. X    *)
  1549. X        # there is an RCS file
  1550. X        
  1551. X        if    # check out correct version of $Rcs into $User
  1552. X            $RCSBIN/co -r$VN_User $Rcs $User
  1553. X        then    # adjust $User
  1554. X            chmod +w $User
  1555. X            # make a reference with the NEW time stamp
  1556. X            # and the OLD version number
  1557. X            . $CVSLIB/VT.aux
  1558. X            $CVSLIB/RG.aux $User $VN_User "$TS_User"
  1559. X        else
  1560. X            echo $Name on $Repository: could not check out \
  1561. X                $User >&2
  1562. X            OK=no
  1563. X        fi
  1564. X        ;;
  1565. X    esac
  1566. Xdone
  1567. X
  1568. X$CVSLIB/EF.aux                # update CVS.adm/Files
  1569. X
  1570. X# did we succeed?
  1571. Xcase $OK in
  1572. Xno)
  1573. X    exit 1
  1574. X    ;;
  1575. Xesac
  1576. X
  1577. Xexit 0
  1578. + END-OF-FILE RV
  1579. chmod 'u=rwx,g=rx,o=rx' 'RV'
  1580. set `wc -c 'RV'`
  1581. count=$1
  1582. case $count in
  1583. 3183)    :;;
  1584. *)    echo 'Bad character count in ''RV' >&2
  1585.         echo 'Count should be 3183' >&2
  1586. esac
  1587. echo Extracting 'UV'
  1588. sed 's/^X//' > 'UV' << '+ END-OF-FILE ''UV'
  1589. X#!/bin/sh
  1590. X#    This file is part of the Concurrent Versions System CVS.
  1591. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1592. X#    $Header: UV,v 3.1 89/09/25 16:35:08 dick Exp $
  1593. X
  1594. X#
  1595. X#        U p d a t e   V e r s i o n
  1596. X#    UV updates the configuration in the present directory with respect to
  1597. X#    the RCS repository.  The present configuration must have been created
  1598. X#    by CV.  The user can keep up-to-date by calling UV whenever he feels
  1599. X#    like it.  The present configuration can be committed by CM, but this
  1600. X#    keeps the configuration in tact.
  1601. X#
  1602. X#    The call is
  1603. X#        UV [ -n ]
  1604. X#    for a general update, or
  1605. X#        UV [ -n ] file ...
  1606. X#    for a partial update.
  1607. X#
  1608. X#    Modified or non-existent RCS files are checked out.
  1609. X#    Modified user files are reported as M <user_file>.  If both the
  1610. X#    RCS file and the user file have been modified, the user file
  1611. X#    is replaced by the result of rcsmerge.  If this throws up
  1612. X#    irreconcilable differences, the file is reported as C <user_file>,
  1613. X#    and as M <user_file> otherwise.
  1614. X#    Files added but not yet committed are reported as A <user_file>.
  1615. X#    Files removed but not yet decommitted are reported as R <user_file>.
  1616. X#
  1617. X#    The -n option restricts the actions to reporting only.
  1618. X#
  1619. XName=UV; export Name
  1620. X
  1621. X# CVSBIN, CVSLIB and RCSBIN directories
  1622. XCVSBIN=/home/top/dick/cvs
  1623. XCVSLIB=/home/top/dick/cvs
  1624. XRCSBIN=${RCSBIN-/usr/local/bin}
  1625. Xexport CVSBIN CVSLIB RCSBIN
  1626. X
  1627. X# avoid spurious identifications
  1628. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  1629. X
  1630. X# determine the name of the repository
  1631. XRepository=""
  1632. X. $CVSLIB/NR.aux
  1633. X
  1634. X# get possible options
  1635. X. $CVSLIB/OP.aux            # sets $Options
  1636. X
  1637. X# to ACT or not to ACT, that is the question
  1638. Xcase "$Options" in
  1639. X"")
  1640. X    ACT=
  1641. X    ;;
  1642. X" -n")
  1643. X    ACT=echo
  1644. X    ;;
  1645. X*)
  1646. X    echo Call is: $Name \[ -n \] \[ filename ... \] >&2
  1647. X    exit 1
  1648. X    ;;
  1649. Xesac
  1650. X
  1651. X#    A T T E M P T   R E A D   A C C E S S
  1652. X
  1653. XLCK=$Repository/\#cvs.lock        # the lock
  1654. XTFL=$Repository/\#cvs.tfl.$$        # a temporary test file
  1655. XRFL=$Repository/\#cvs.rfl.$$        # the personal read flag
  1656. X
  1657. Xif    # we have write access to $Repository
  1658. X    # (can't test with [ -w $Repository ] )
  1659. X    cp /dev/null $TFL >/dev/null 2>/dev/null
  1660. Xthen    # we can do a fully protected read
  1661. X    rm $TFL
  1662. X    
  1663. X    # set lock
  1664. X    . $CVSLIB/SL.aux        # persistently tries to mkdir $LCK
  1665. X    
  1666. X    #    C R I T I C A L   S E C T I O N
  1667. X    
  1668. X    cp /dev/null $RFL        # plant the personal read flag
  1669. X    rmdir $LCK            # remove lock
  1670. X    # set traps to remove flag on interrupt and exit
  1671. X    trap 'rm -f $RFL; exit 1' 1 2 3 15
  1672. X    trap 'rm -f $RFL; exit 0' 0
  1673. X    
  1674. X    #    E N D   O F   C R I T I C A L   S E C T I O N
  1675. X
  1676. Xelse    # just use your luck, and some heuristics
  1677. X    while    # the lock is there
  1678. X        [ -d $LCK ]
  1679. X    do
  1680. X        # we missed it this cycle
  1681. X        echo $Name: `date`: waiting for the lock \
  1682. X            in $Repository to disappear
  1683. X        sleep 60
  1684. X    done
  1685. Xfi
  1686. X
  1687. X# determine the way we are called
  1688. Xcase $# in
  1689. X0)
  1690. X    # no file names: all pertinent files
  1691. X    set "`$CVSLIB/FN.aux $Repository`"
  1692. X    $ACT cp /dev/null CVS.adm/Mod
  1693. X    NOPARAMS=yes
  1694. X    ;;
  1695. X*)
  1696. X    NOPARAMS=no
  1697. Xesac
  1698. X
  1699. X# collect the sets of affected files
  1700. X
  1701. XOK=yes
  1702. X. $CVSLIB/CS.aux    # sets CLIST, GLIST, MLIST, OLIST, ALIST, RLIST, WLIST
  1703. X
  1704. Xcase $OK in
  1705. Xno)
  1706. X    echo $Name failed\; correct above errors first >&2
  1707. X    exit 1
  1708. Xesac
  1709. X
  1710. X# remove superfluous administration entries
  1711. Xfor User in $WLIST
  1712. Xdo
  1713. X    $ACT $CVSLIB/SC.aux $User
  1714. Xdone
  1715. X
  1716. X# do all the check-outs
  1717. X
  1718. Xfor User in $OLIST
  1719. Xdo
  1720. X    Rcs=$Repository/$User,v
  1721. X    
  1722. X    Orig=,,$User
  1723. X    # put user file aside, if it exists, to preserve the inode
  1724. X    if    # $User exists
  1725. X        [ -r $User ]
  1726. X    then    # put it aside
  1727. X        $ACT mv $User $Orig
  1728. X    else    # avoid confusion
  1729. X        $ACT rm -f $Orig
  1730. X    fi
  1731. X    
  1732. X    if    # check out $Rcs into $User, creating a new inode
  1733. X        $ACT $RCSBIN/co -q $Rcs
  1734. X    then    # we now have a new copy of $User
  1735. X        if    # there was an original inode
  1736. X            [ -r $Orig ]
  1737. X        then    # bring it back after filling it with the new copy
  1738. X            $ACT cp $User $Orig
  1739. X            $ACT rm -f $User
  1740. X            $ACT mv $Orig $User
  1741. X        else    # make do with the copy just checked in
  1742. X            $ACT chmod +w $User
  1743. X        fi
  1744. X        # make a reference with the new time stamp
  1745. X        . $CVSLIB/VT.aux
  1746. X        $ACT $CVSLIB/RG.aux $User $VN_Rcs "$TS_User"
  1747. X    else    # something is wrong
  1748. X        if    # there was an original
  1749. X            [ -r $Orig ]
  1750. X        then    # restore $User from it
  1751. X            $ACT mv $Orig $User
  1752. X        fi
  1753. X        echo $Name: could not check out $User >&2
  1754. X        OK=no
  1755. X    fi
  1756. Xdone
  1757. X
  1758. X# report all modifications
  1759. Xfor User in $MLIST
  1760. Xdo
  1761. X    echo M $User
  1762. X    echo $User >>CVS.adm/Mod
  1763. Xdone
  1764. X
  1765. Xfor User in $ALIST
  1766. Xdo
  1767. X    echo A $User
  1768. Xdone
  1769. X
  1770. Xfor User in $RLIST
  1771. Xdo
  1772. X    echo R $User
  1773. Xdone
  1774. X
  1775. X# do all the merges
  1776. Xfor User in $GLIST
  1777. Xdo
  1778. X    Rcs=$Repository/$User,v
  1779. X    . $CVSLIB/VT.aux    # sets $VN_User, $VN_Rcs, $TS_User, $TS_Rcs
  1780. X    
  1781. X    if    # merge differences between $Rcs version $VN_User and
  1782. X        # head version of $Rcs into $User
  1783. X        $ACT $RCSBIN/rcsmerge -r$VN_User $Rcs 2>&1
  1784. X    then    :
  1785. X    else    # something very wrong
  1786. X        echo $Name: could not merge revision $VN_User of $User >&2
  1787. X        OK=no
  1788. X        continue
  1789. X    fi
  1790. X    
  1791. X    # register again with *OLD* time stamp and *NEW* version number
  1792. X    $ACT $CVSLIB/RG.aux $User $VN_Rcs "$TS_Rcs"
  1793. X    
  1794. X    if    # find out about conflicts the only way I know
  1795. X        grep '^>>>>>>> ' $User >/dev/null
  1796. X    then
  1797. X        echo $Name: conflicts found in $User >&2
  1798. X        echo C $User        # $User Conflict
  1799. X    else
  1800. X        echo M $User        # $User Modified
  1801. X    fi
  1802. X    echo $User >>CVS.adm/Mod
  1803. Xdone
  1804. X
  1805. X$ACT sort -u CVS.adm/Mod -o CVS.adm/Mod
  1806. X
  1807. Xcase $NOPARAMS in
  1808. Xyes)    # set last update time stamp, for full update only
  1809. X    $ACT rm -f CVS.adm/LastUpdate
  1810. X    $ACT cp /dev/null CVS.adm/LastUpdate
  1811. X    ;;
  1812. Xesac
  1813. X
  1814. X$ACT $CVSLIB/EF.aux            # update CVS.adm/Files
  1815. X
  1816. X# did we succeed?
  1817. Xcase $OK in
  1818. Xno)
  1819. X    exit 1
  1820. X    ;;
  1821. Xesac
  1822. X
  1823. Xexit 0
  1824. + END-OF-FILE UV
  1825. chmod 'u=rwx,g=rx,o=rx' 'UV'
  1826. set `wc -c 'UV'`
  1827. count=$1
  1828. case $count in
  1829. 5333)    :;;
  1830. *)    echo 'Bad character count in ''UV' >&2
  1831.         echo 'Count should be 5333' >&2
  1832. esac
  1833. echo Extracting 'REP'
  1834. sed 's/^X//' > 'REP' << '+ END-OF-FILE ''REP'
  1835. X#!/bin/sh
  1836. X#    This file is part of the Concurrent Versions System CVS.
  1837. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  1838. X#    $Header: REP,v 3.3 89/10/06 12:58:01 dick Exp $
  1839. X
  1840. X#
  1841. X#        R E P e a t   a   C V S   c o m m a n d
  1842. X#
  1843. XName=REP; export Name
  1844. X
  1845. X# CVSBIN, CVSLIB and RCSBIN directories
  1846. XCVSBIN=/home/top/dick/cvs
  1847. XCVSLIB=/home/top/dick/cvs
  1848. XRCSBIN=${RCSBIN-/usr/local/bin}
  1849. Xexport CVSBIN CVSLIB RCSBIN
  1850. X
  1851. X# avoid spurious identifications
  1852. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  1853. X
  1854. X# get the one possible option
  1855. Xcase "$1" in
  1856. X-n)
  1857. X    ACT=echo
  1858. X    shift
  1859. X    ;;
  1860. Xesac
  1861. X
  1862. XCOMMAND=$1
  1863. Xcase "$COMMAND" in
  1864. X""|-*)
  1865. X    echo Call is: $Name command \[ -n \] \[ parameters \] >&2
  1866. X    exit 1
  1867. X    ;;
  1868. Xesac
  1869. Xshift
  1870. X
  1871. Xcase "$COMMAND" in
  1872. X
  1873. XAE|RM)# unapplicable commands
  1874. X    echo $Name: command $COMMAND is not repeatable
  1875. X    exit 1
  1876. X    ;;
  1877. X
  1878. XDF|GC|LS|UV)# cat UserDir-list | REP $COMMAND
  1879. X    while    read UserDir
  1880. X    do
  1881. X        if    [ "$UserDir" = "" ]
  1882. X        then    continue
  1883. X        fi
  1884. X        (    echo Changing to directory $UserDir
  1885. X            $ACT cd $UserDir
  1886. X            $ACT $CVSBIN/$COMMAND
  1887. X        )
  1888. X    done
  1889. X    ;;
  1890. X
  1891. XCM)    # cat UserDir-list | REP $COMMAND 'message'
  1892. X    Message="$1"
  1893. X    case "$Message" in
  1894. X    "")
  1895. X        echo $Name: command $COMMAND requires a message parameter >&2
  1896. X        exit 1
  1897. X        ;;
  1898. X    esac
  1899. X    while    read UserDir
  1900. X    do
  1901. X        if    [ "$UserDir" = "" ]
  1902. X        then    continue
  1903. X        fi
  1904. X        (    echo Changing to directory $UserDir
  1905. X            $ACT cd $UserDir
  1906. X            $ACT $CVSBIN/$COMMAND "$Message"
  1907. X        )
  1908. X    done
  1909. X    ;;
  1910. X
  1911. XRC)    # cat Repository-list | REP $COMMAND [ -i ]
  1912. X    if    # special output requested
  1913. X        [ X"$1" = X-i ]
  1914. X    then    # edit the output
  1915. X        while    read Repository
  1916. X        do
  1917. X            if    [ "$Repository" = "" ]
  1918. X            then    continue
  1919. X            fi
  1920. X            $ACT $CVSBIN/$COMMAND -i $Repository |
  1921. X            sed 's|^|'"$Repository"' |'
  1922. X        done
  1923. X    else    # format the output
  1924. X        while    read Repository
  1925. X        do
  1926. X            if    [ "$Repository" = "" ]
  1927. X            then    continue
  1928. X            fi
  1929. X            echo Configuration history of $Repository
  1930. X            $ACT $CVSBIN/$COMMAND $Repository
  1931. X            echo ''
  1932. X        done
  1933. X    fi
  1934. X    ;;
  1935. X
  1936. XHR)    # cat Repository-list | REP $COMMAND
  1937. X    while    read Repository
  1938. X    do
  1939. X        if    [ "$Repository" = "" ]
  1940. X        then    continue
  1941. X        fi
  1942. X        $ACT $CVSBIN/$COMMAND $Repository
  1943. X    done |
  1944. X    sort -nru |
  1945. X    sed '1q'
  1946. X    ;;
  1947. X
  1948. XLCK)    # cat Repository-list | REP $COMMAND [ on | off ]
  1949. X    Request="$1"
  1950. X    case "$Request" in
  1951. X    on|off)    # OK
  1952. X        ;;
  1953. X    *)
  1954. X        echo $Name: command $COMMAND requires \
  1955. X            a request parameter \[ on \| off \] >&2
  1956. X        exit 1
  1957. X        ;;
  1958. X    esac
  1959. X    while    read Repository
  1960. X    do
  1961. X        if    [ "$Repository" = "" ]
  1962. X        then    continue
  1963. X        fi
  1964. X        $ACT $CVSBIN/$COMMAND $Request $Repository
  1965. X    done
  1966. X    ;;
  1967. X
  1968. XNR)    # cat Repository-list | REP $COMMAND release-number
  1969. X    RelNumber="$1"
  1970. X    case "$RelNumber" in
  1971. X    [0-9]*)    # OK
  1972. X        ;;
  1973. X    *)
  1974. X        echo $Name: command $COMMAND requires \
  1975. X            a release-number parameter >&2
  1976. X        exit 1
  1977. X        ;;
  1978. X    esac
  1979. X    while    read Repository
  1980. X    do
  1981. X        if    [ "$Repository" = "" ]
  1982. X        then    continue
  1983. X        fi
  1984. X        $ACT $CVSBIN/$COMMAND $RelNumber $Repository
  1985. X    done
  1986. X    ;;
  1987. X
  1988. XCV|RV)    # cat Repository-UserDir-list | REP $COMMAND
  1989. X    # cat Repository-UserDir-ConfIdf-list | REP $COMMAND
  1990. X    while    read Repository UserDir ConfIdf
  1991. X    do
  1992. X        if    [ "$Repository" = "" ]
  1993. X        then    continue
  1994. X        fi
  1995. X        if    [ "$UserDir" = "" ]
  1996. X        then    echo $Name: no user directory for command \
  1997. X                $COMMAND $Repository >&2
  1998. X            exit 1
  1999. X        fi
  2000. X        if    [ $COMMAND = "RV" -a "$ConfIdf" = "" ]
  2001. X        then    echo $Name: no configuration identifier for command \
  2002. X                $COMMAND $Repository >&2
  2003. X            exit 1
  2004. X        fi
  2005. X        if    # $UsedDir does not exist
  2006. X            [ ! -d $UserDir ]
  2007. X        then    # try to create it
  2008. X            if    $ACT mkdir $UserDir
  2009. X            then    :
  2010. X            else    echo $Name: cannot make $UserDir >&2
  2011. X                exit 1
  2012. X            fi
  2013. X        fi
  2014. X
  2015. X        (    echo Changing to directory $UserDir
  2016. X            $ACT cd $UserDir
  2017. X            $ACT $CVSBIN/$COMMAND $Repository $ConfIdf
  2018. X        )
  2019. X    done
  2020. X    ;;
  2021. X
  2022. X*)
  2023. X    echo $Name: $COMMAND is an unknown command >&2
  2024. X    exit 1
  2025. X    ;;
  2026. Xesac
  2027. X
  2028. Xexit 0
  2029. X
  2030. + END-OF-FILE REP
  2031. chmod 'u=rwx,g=rx,o=rx' 'REP'
  2032. set `wc -c 'REP'`
  2033. count=$1
  2034. case $count in
  2035. 3579)    :;;
  2036. *)    echo 'Bad character count in ''REP' >&2
  2037.         echo 'Count should be 3579' >&2
  2038. esac
  2039. echo Extracting 'LAR'
  2040. sed 's/^X//' > 'LAR' << '+ END-OF-FILE ''LAR'
  2041. X#!/bin/sh
  2042. X#    This file is part of the Concurrent Versions System CVS.
  2043. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  2044. X#    $Header: LAR,v 3.1 89/09/25 16:32:08 dick Exp $
  2045. X
  2046. X#
  2047. X#        L i s t   A l l   R e p o s i t o r i e s
  2048. X#    LAR <directory> lists all repositories that are subdirectories of
  2049. X#    <directory>, according to the criterion that a repository contains RCS
  2050. X#    files and that it is not named Attic or Admin.
  2051. X#
  2052. XName=LAR; export Name
  2053. X
  2054. X# CVSBIN, CVSLIB and RCSBIN directories
  2055. XCVSBIN=/home/top/dick/cvs
  2056. XCVSLIB=/home/top/dick/cvs
  2057. XRCSBIN=${RCSBIN-/usr/local/bin}
  2058. Xexport CVSBIN CVSLIB RCSBIN
  2059. X
  2060. X# avoid spurious identifications
  2061. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  2062. X
  2063. XDIR=$1
  2064. Xcase "$DIR" in
  2065. X"")
  2066. X    echo Call is: $Name directory >&2
  2067. X    exit 1
  2068. X    ;;
  2069. Xesac
  2070. Xshift
  2071. X
  2072. Xfind $DIR -type d -a -print |
  2073. Xwhile    read Repository
  2074. Xdo
  2075. X    BASENAME=`basename $Repository`
  2076. X    if    # this is definitely not a repository
  2077. X        [ "$BASENAME" = Admin -o "$BASENAME" = Attic ]
  2078. X    then    # skip it
  2079. X        :
  2080. X    elif    # this is definitely a repository
  2081. X        [ -d $Repository/Admin -o -d $Repository/Attic \
  2082. X        -o "`echo $Repository/*,v`" != "$Repository/*,v" \
  2083. X        -o "`echo $Repository/.*,v`" != "$Repository/.*,v" \
  2084. X        ]
  2085. X    then    # report it
  2086. X        echo $Repository
  2087. X    else    # we suppose it isn't
  2088. X        :
  2089. X    fi
  2090. Xdone
  2091. X
  2092. Xexit 0
  2093. + END-OF-FILE LAR
  2094. chmod 'u=rwx,g=rx,o=rx' 'LAR'
  2095. set `wc -c 'LAR'`
  2096. count=$1
  2097. case $count in
  2098. 1241)    :;;
  2099. *)    echo 'Bad character count in ''LAR' >&2
  2100.         echo 'Count should be 1241' >&2
  2101. esac
  2102. echo Extracting 'LAU'
  2103. sed 's/^X//' > 'LAU' << '+ END-OF-FILE ''LAU'
  2104. X#!/bin/sh
  2105. X#    This file is part of the Concurrent Versions System CVS.
  2106. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  2107. X#    $Header: LAU,v 3.1 89/09/25 16:32:18 dick Exp $
  2108. X
  2109. X#
  2110. X#        L i s t   A l l   U s e r   d i r e c t o r i e s
  2111. X#    LAU lists all user directories under CVS that are subdirectories of
  2112. X#    the working directory, according to the criterion that a user
  2113. X#    directory under CVS contains a directory CVS.adm.
  2114. X#
  2115. XName=LAU; export Name
  2116. X
  2117. X# CVSBIN, CVSLIB and RCSBIN directories
  2118. XCVSBIN=/home/top/dick/cvs
  2119. XCVSLIB=/home/top/dick/cvs
  2120. XRCSBIN=${RCSBIN-/usr/local/bin}
  2121. Xexport CVSBIN CVSLIB RCSBIN
  2122. X
  2123. X# avoid spurious identifications
  2124. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  2125. X
  2126. Xcase "$1" in
  2127. X"")    # OK
  2128. X    ;;
  2129. X*)    # error
  2130. X    echo Call is: $Name \(works on working directory\) >&2
  2131. X    exit 1
  2132. X    ;;
  2133. Xesac
  2134. X
  2135. Xfind . -type d -a -print |
  2136. Xwhile    read UserDir
  2137. Xdo
  2138. X    if    # this is a directory under CVS
  2139. X        [ -d $UserDir/CVS.adm ]
  2140. X    then    # report it
  2141. X        echo $UserDir
  2142. X    fi
  2143. Xdone
  2144. X
  2145. Xexit 0
  2146. + END-OF-FILE LAU
  2147. chmod 'u=rwx,g=rx,o=rx' 'LAU'
  2148. set `wc -c 'LAU'`
  2149. count=$1
  2150. case $count in
  2151. 945)    :;;
  2152. *)    echo 'Bad character count in ''LAU' >&2
  2153.         echo 'Count should be 945' >&2
  2154. esac
  2155. echo Extracting 'LCK'
  2156. sed 's/^X//' > 'LCK' << '+ END-OF-FILE ''LCK'
  2157. X#!/bin/sh
  2158. X#    This file is part of the Concurrent Versions System CVS.
  2159. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  2160. X#    $Header: LCK,v 3.1 89/09/25 16:32:25 dick Exp $
  2161. X
  2162. X#
  2163. X#        L o C K
  2164. X#    LCK on <repository>   sets a lock in <repository>
  2165. X#    LCK off <repository>   removes the lock.
  2166. X#    For maintenance only. NOT to be used by the normal user; CM and UV
  2167. X#    handle all normal cases.
  2168. X#
  2169. XName=LCK; export Name
  2170. X
  2171. X# CVSBIN, CVSLIB and RCSBIN directories
  2172. XCVSBIN=/home/top/dick/cvs
  2173. XCVSLIB=/home/top/dick/cvs
  2174. XRCSBIN=${RCSBIN-/usr/local/bin}
  2175. Xexport CVSBIN CVSLIB RCSBIN
  2176. X
  2177. X# avoid spurious identifications
  2178. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  2179. X
  2180. X# get the request
  2181. XRequest=$1
  2182. Xcase "$Request" in
  2183. Xon|off)    # OK
  2184. X    ;;
  2185. X*)
  2186. X    echo Call is: $Name \[ on \| off \] repository-name >&2
  2187. X    exit 1
  2188. Xesac
  2189. Xshift
  2190. X
  2191. X# is the number of parameters correct?
  2192. Xcase $# in
  2193. X1)    # OK
  2194. X    ;;
  2195. X*)
  2196. X    echo Call is: $Name \[ on \| off \] repository-name >&2
  2197. X    exit 1
  2198. X    ;;
  2199. Xesac
  2200. X
  2201. XRepository=$1
  2202. X
  2203. X# check the existence of the repository
  2204. X. $CVSLIB/NR.aux
  2205. X
  2206. XLCK=$Repository/\#cvs.lock        # the lock
  2207. XTFL=$Repository/\#cvs.tfl        # pattern of temporary test files
  2208. XRFL=$Repository/\#cvs.rfl        # pattern of the read flags
  2209. XWFL=$Repository/\#cvs.wfl        # the general write flag
  2210. XLFL=$Repository/\#cvs.lfl        # the general lock flag
  2211. X
  2212. Xcase $Request in
  2213. Xon)    # now just lock the repository
  2214. X    AutoRemove=no            # with AutoRemove off,
  2215. X    . $CVSLIB/WL.aux        # set write lock
  2216. X    cp /dev/null $LFL        # and plant the lock flag
  2217. X    ;;
  2218. X
  2219. Xoff)    # let's have a look
  2220. X    if    # there is a lock
  2221. X        [ -d $LCK ]
  2222. X    then    # we must first remove the non-lock flags
  2223. X        rm -f $TFL.* $RFL.* $WFL
  2224. X        # and then the lock (otherwise somebody can plant a flag
  2225. X        # just after the rmdir and just before the rm $WFL !
  2226. X        if    rmdir $LCK
  2227. X        then    :
  2228. X        else
  2229. X            echo $Name: could not remove existing lock \
  2230. X                in $Repository >&2
  2231. X            exit 1
  2232. X        fi
  2233. X        rm -f $LFL
  2234. X    else
  2235. X        echo $Name: there is no lock in $Repository >&2
  2236. X        exit 1
  2237. X    fi
  2238. X    ;;
  2239. Xesac
  2240. X
  2241. Xexit 0
  2242. X
  2243. + END-OF-FILE LCK
  2244. chmod 'u=rwx,g=rx,o=rx' 'LCK'
  2245. set `wc -c 'LCK'`
  2246. count=$1
  2247. case $count in
  2248. 1899)    :;;
  2249. *)    echo 'Bad character count in ''LCK' >&2
  2250.         echo 'Count should be 1899' >&2
  2251. esac
  2252. echo Extracting 'hist2'
  2253. sed 's/^X//' > 'hist2' << '+ END-OF-FILE ''hist2'
  2254. X#!/bin/sh
  2255. X#    This file is part of the Concurrent Versions System CVS.
  2256. X#    Written by Dick Grune, Vrije Universiteit, Amsterdam.
  2257. X#    $Header: hist2,v 3.2 89/10/13 11:54:54 dick Exp $
  2258. X
  2259. X#
  2260. X#    Historian: ad-hoc configuration history reconstruction program, part 2
  2261. X#
  2262. X#        hist2 [ repository ]
  2263. X#    reads the output of hist1 from standard input and writes on standard
  2264. X#    output a shell script that will reconstruct the configuration history
  2265. X#    file of the repository. If no repository is given, the repository of
  2266. X#    the present directory is used.
  2267. X#
  2268. XName=hist2; export Name
  2269. X
  2270. X# CVSBIN, CVSLIB and RCSBIN directories
  2271. XCVSBIN=/home/top/dick/cvs
  2272. XCVSLIB=/home/top/dick/cvs
  2273. XRCSBIN=${RCSBIN-/usr/local/bin}
  2274. Xexport CVSBIN CVSLIB RCSBIN
  2275. X
  2276. X# avoid spurious identifications
  2277. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  2278. X
  2279. X# determine the name of the repository
  2280. XRepository=$1
  2281. X. $CVSLIB/NR.aux
  2282. X
  2283. X# write the header
  2284. Xecho '#!/bin/sh'
  2285. Xecho ''
  2286. Xecho '#'
  2287. Xecho '#    This file was created by the CVS historian to reconstruct'
  2288. Xecho '#    the configuration history file of repository'
  2289. Xecho '#    '$Repository
  2290. Xecho '#'
  2291. Xecho 'Name=confrec.reconstructor; export Name'
  2292. Xecho ''
  2293. Xecho 'set -e'
  2294. Xecho ''
  2295. Xecho '# CVSBIN, CVSLIB and RCSBIN directories'
  2296. Xecho 'CVSBIN='$CVSBIN
  2297. Xecho 'CVSLIB='$CVSLIB
  2298. Xecho 'RCSBIN='$RCSBIN
  2299. Xecho 'export CVSBIN CVSLIB RCSBIN'
  2300. Xecho ''
  2301. Xecho '# avoid spurious identifications'
  2302. Xecho 'PATH=${CVSPATH-/bin:/usr/bin}; export PATH'
  2303. Xecho ''
  2304. Xecho '# determine the name of the repository'
  2305. Xecho 'Repository='$Repository
  2306. Xecho ''
  2307. Xecho 'Admin=$Repository/Admin'
  2308. Xecho 'Cfr=CVS.confrec'
  2309. Xecho 'RcsCfr=$Admin/$Cfr,v'
  2310. Xecho 'UsrCfr=$Admin/$Cfr'
  2311. Xecho ''
  2312. Xecho 'if    # there is a configuration history file'
  2313. Xecho '    [ -r $RcsCfr ]'
  2314. Xecho 'then    # we are not going to overwrite it'
  2315. Xecho '    echo $Name: there is a configuration history file already, $RcsCfr >&2'
  2316. Xecho '    exit 1'
  2317. Xecho 'fi'
  2318. Xecho ''
  2319. Xecho '# we need the Admin directory'
  2320. Xecho 'if    # $Admin exists'
  2321. Xecho '    [ -d $Admin ]'
  2322. Xecho 'then    :'
  2323. Xecho 'else    # $Admin must be made'
  2324. Xecho '    if    mkdir $Admin >/dev/null 2>/dev/null'
  2325. Xecho '    then    :'
  2326. Xecho '    else    echo $Name: could not make $Admin >&2'
  2327. Xecho '        exit 1'
  2328. Xecho '    fi'
  2329. Xecho 'fi'
  2330. Xecho ''
  2331. Xecho 'ACT='
  2332. Xecho 'Revision='
  2333. Xecho ''
  2334. X
  2335. X# create a shell script with the appropriate calls to $RCSBIN/ci
  2336. X
  2337. X# construct the successive configuration records
  2338. Xawk '
  2339. X    BEGIN {                # awk has problems with empty arrays
  2340. X        rev[""] = "-";        # so we "declare" it
  2341. X    }
  2342. X    NF == 0 {            # empty line, end of one CM
  2343. X        print "# New configuration record";
  2344. X        print "cp /dev/null $UsrCfr";
  2345. X        for (f in rev) {
  2346. X            if (rev[f] != "-") {
  2347. X                print "echo '\''" rev[f] "| " f "|'\'' >>$UsrCfr";
  2348. X            }
  2349. X        }
  2350. X        print "CI " msg;    # provisional form of call to ci
  2351. X        print "DT " date "@" author;# provisional form of dating
  2352. X    }
  2353. X    NF == 1 {            # single file name, to be removed
  2354. X        rev[$1] = "-";
  2355. X    }
  2356. X    NF > 1 {            # normal modification
  2357. X        date = $1 "." $2;
  2358. X        rev[$3] = $4;
  2359. X        author = $5;
  2360. X        msg = $0;        # to preserve the message
  2361. X    }
  2362. X' |
  2363. X
  2364. X# double all backslashes; the shell "read" seems to strip them off again
  2365. Xsed 's/\\/&&/g' |
  2366. X
  2367. X# expand the CI and DT lines
  2368. Xwhile read LINE
  2369. Xdo
  2370. X    case "$LINE" in
  2371. X    CI*)                # the ci lines
  2372. X        echo '# check it in'
  2373. X        echo "$LINE" |
  2374. X        sed '
  2375. X            # mark first semicolon
  2376. X            s/;.*/;;;&/
  2377. X            # discard anything in front of it and itself
  2378. X            s/.*;;;; //
  2379. X            # quote funny characters
  2380. X            s/\\/\\&/g
  2381. X            s/"/\\&/g
  2382. X            s/`/\\&/g
  2383. X            s/\$/\\&/g
  2384. X            # edit into $Message for $CVSLIB/CC.aux
  2385. X            s/.*/Message="&"/
  2386. X            s/\\\\n/\
  2387. X/g
  2388. X        '
  2389. X        echo '. $CVSLIB/CC.aux            # commit confrec file'
  2390. X        echo ''
  2391. X        ;;
  2392. X
  2393. X    DT*)                    # the dating lines
  2394. X        echo '# fake the creation date and author of this entry'
  2395. X        echo '# the RCS file is unwritable; correct'
  2396. X        echo 'chmod +w $RcsCfr'
  2397. X        echo '# edit the $RcsCfr by brute force'
  2398. X        echo 'ed - $RcsCfr <<\!'
  2399. X        echo '/^date     /s/^date     .................;//'
  2400. X        echo 's/^ *author[^;]*;//'
  2401. X        echo "$LINE" |
  2402. X        sed '
  2403. X            s/\//./g
  2404. X            s/:/./g
  2405. X            s/DT //
  2406. X            s/@/;  author /
  2407. X            s/.*/s\/^\/date     &;\//
  2408. X        '
  2409. X        echo 'w'
  2410. X        echo 'q'
  2411. X        echo '!'
  2412. X        echo '# make the RCS unwritable again'
  2413. X        echo 'chmod -w $RcsCfr'
  2414. X        echo ''
  2415. X        ;;
  2416. X
  2417. X    *)                    # normal lines
  2418. X        echo "$LINE"
  2419. X        ;;
  2420. X    esac
  2421. Xdone
  2422. X
  2423. Xecho 'exit 0'
  2424. X
  2425. Xexit 0
  2426. X
  2427. + END-OF-FILE hist2
  2428. chmod 'u=rwx,g=rx,o=rx' 'hist2'
  2429. set `wc -c 'hist2'`
  2430. count=$1
  2431. case $count in
  2432. 4077)    :;;
  2433. *)    echo 'Bad character count in ''hist2' >&2
  2434.         echo 'Count should be 4077' >&2
  2435. esac
  2436. echo Extracting 'coALL'
  2437. sed 's/^X//' > 'coALL' << '+ END-OF-FILE ''coALL'
  2438. X#!/bin/sh
  2439. X
  2440. X#
  2441. X#    Historian's aid: check out ALL versions of a file ($1)
  2442. X#
  2443. X#    coALL    creates a directory $1.ALL in which it checks out ALL
  2444. X#    versions of the file $1. Done to the Makefile, this can help in
  2445. X#    determining when exactly a file was RM-ed, to faithfully reconstruct
  2446. X#    the configuration history of the repository.
  2447. X#
  2448. XName=coALL; export Name
  2449. X
  2450. X# CVSBIN, CVSLIB and RCSBIN directories
  2451. XCVSBIN=/home/top/dick/cvs
  2452. XCVSLIB=/home/top/dick/cvs
  2453. XRCSBIN=${RCSBIN-/usr/local/bin}
  2454. Xexport CVSBIN CVSLIB RCSBIN
  2455. X
  2456. X# avoid spurious identifications
  2457. XPATH=${CVSPATH-/bin:/usr/bin}; export PATH
  2458. X
  2459. X# determine the name of the repository
  2460. XRepository=""
  2461. X. $CVSLIB/NR.aux
  2462. X
  2463. XUser=$1
  2464. X
  2465. Xset -e
  2466. Xmkdir $User.ALL
  2467. Xcd $User.ALL
  2468. X
  2469. X$RCSBIN/rlog $Repository/$User,v |
  2470. Xgrep '^revision' |
  2471. Xsed 's/revision //' |
  2472. Xwhile read VN_User
  2473. Xdo
  2474. X    $RCSBIN/co -q -r$VN_User $Repository/$User,v
  2475. X    mv $User $VN_User
  2476. X    chmod +w $VN_User
  2477. Xdone
  2478. X
  2479. + END-OF-FILE coALL
  2480. chmod 'u=rwx,g=rx,o=rx' 'coALL'
  2481. set `wc -c 'coALL'`
  2482. count=$1
  2483. case $count in
  2484. 880)    :;;
  2485. *)    echo 'Bad character count in ''coALL' >&2
  2486.         echo 'Count should be 880' >&2
  2487. esac
  2488. exit 0
  2489.  
  2490. exit 0
  2491.  
  2492. exit 0 # Just in case...
  2493.