-
Notifications
You must be signed in to change notification settings - Fork 1
/
.kshsccs
769 lines (721 loc) · 18.2 KB
/
.kshsccs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
#
# .kshsccs - ksh SCCS helpers
#
# Written by Greg A. Woods <woods@robohack.{UUCP,ca}> <woods@planix.{com,ca}>
#
#ident "@(#)HOME:.kshsccs 37.8 24/10/16 16:43:02 (woods)"
#
# Copyright (c) 2001 Greg A. Woods
#
# Redistribution of this software in both source and binary forms, with
# or without modification, is permitted provided that all of the
# following conditions are met:
#
# 1. Redistributions of source code, either alone or as part of a
# collective work, must retain this entire copyright notice, and the
# following disclaimer, without alteration, in each file that
# contains part of this software.
#
# 2. Redistributions of this software in binary form, either alone or
# as part of a collective work, must reproduce this entire copyright
# notice, and the following disclaimer, without alteration, in
# either the documentation (as text files in electronic media, or in
# printed matter), and/or any original header files from this
# software as per the previous term, and/or other materials provided
# as part of the distribution.
#
# 3. Collective works including this software must also include the
# following acknowledgement, either alone or as part of this entire
# copyright license, in any printed documentation accompanying a
# physical distribution (if there is printed documentation), and in
# a plain text file separate from the archive files (but perhaps
# along with other similar acknowledgments) on any electronic
# medium:
#
# This product includes software developed by Greg A. Woods.
#
# 4. The name of the author may NOT be used to endorse or promote
# products derived from this software without specific prior written
# permission. The use of the author's name strictly to meet the
# requirements of the previous terms is not to be considered
# promotion or endorsement under this term.
#
# 5. Altered versions (derivative works) must be plainly marked as
# such, and must not be misrepresented as being the original
# software. This copyright notice, and the following disclaimer,
# must not be removed from any derivative work and must not be
# changed in any way.
#
# All other rights are reserved.
#
# DISCLAIMER:
#
# THIS SOFTWARE IS PROVIDED BY GREG A. WOODS ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# These aliases and functions provide some release and configuration
# management functions over and above sccs(1). They are useful for small
# single-directory projects, but do not (yet) incorporate any recursive
# directory traversal functionality.
#
# There's no support (yet) for handling file deletion (and re-adding).
#
# There's no support for importing (eg. 3rd-party source) yet.
#
# WARNING: There are some non-obvious caveats, assumptions, and limitations!
#
# For example, branches are not really supported, other than by careful
# use of '-t' to the right commands, though not all functions accept this
# option.
#
# Many of the functions should probably be separate scripts.....
# explicitly setting this makes life with "sccs" easier overall
#
: ${PROJECT:="SCCS"}
export PROJECT
# this makes it possible to easily use a different front-end
#
: ${SCCS:="sccs"}
export SCCS
# a likely story....
if ${SCCS} help sccs > /dev/null 2>&1; then
export SCCS_SCHILY=true
alias vannotate='${SCCS} -p $PROJECT get -p -Am'
alias vann='${SCCS} -p $PROJECT get -p -Am'
else
export SCCS_SCHILY=false
alias vannotate='${SCCS} -p $PROJECT get -p -m'
alias vann='${SCCS} -p $PROJECT get -p -m'
fi
# TODO: if the 'x' bit is set on the SCCS file, set it on the g-file too
alias vadmin='${SCCS} -p $PROJECT admin'
alias vcdc='${SCCS} -p $PROJECT cdc'
alias vcheck='${SCCS} -p $PROJECT check'
alias vclean='${SCCS} -p $PROJECT clean'
alias vcreate='${SCCS} -p $PROJECT create'
alias vdeled='${SCCS} -p $PROJECT deledit'
alias vdeledit='${SCCS} -p $PROJECT deledit'
alias vdelget='${SCCS} -p $PROJECT delget'
alias vdelta='${SCCS} -p $PROJECT delta'
alias vdiff='${SCCS} -p $PROJECT diffs'
alias vedit='${SCCS} -p $PROJECT edit'
alias vfix='${SCCS} -p $PROJECT fix'
alias vgeted='${SCCS} -p $PROJECT edit'
alias vgetedit='${SCCS} -p $PROJECT edit'
alias vhelp='${SCCS} help'
alias vinfo='${SCCS} -p $PROJECT info'
alias vnoproj='unset PROJECTDIR; vproj SCCS'
alias vrdiff='${SCCS} -p $PROJECT sccsdiff'
alias vrmdel='${SCCS} -p $PROJECT rmdel'
alias vsccsdiff='${SCCS} -p $PROJECT sccsdiff'
alias vtell='${SCCS} -p $PROJECT tell'
alias vunedit='${SCCS} -p $PROJECT unedit'
alias vunget='${SCCS} -p $PROJECT unget'
alias vval='${SCCS} -p $PROJECT val'
alias vpident='echo "#ident \"%Z\045%Y\045:%M\045 %I\045 %E\045 %U\045 (%Q\045)\""'
#
# vproj - set project name
#
function vproj
{
typeset TRYHOME
if [ $# -gt 1 ] ; then
echo "Usage: $0 project-name" >&2
return 2
fi
case "$1" in
-*)
echo "Usage: $0 project-name" >&2
return 2
;;
esac
if [ -n "${PROJECTDIR}" ] ; then
eval TRYHOME="~${PROJECTDIR}"
if [ -d ${TRYHOME}/src/${1}/SCCS ] ; then
export PROJECT=${1}/SCCS
elif [ -d ${TRYHOME}/source/${1}/SCCS ] ; then
export PROJECT=${1}/SCCS
else
export PROJECT=${1}
fi
else
export PROJECT=${1}
fi
}
#
# vprojdir - set project directory
#
function vprojdir
{
if [ $# -ne 1 ] ; then
echo "Usage: $0 project-directory | project-owner" >&2
return 2
fi
case "$1" in
"")
# hmmm... does this unexport from the executing shell?
unset PROJECTDIR
;;
-*)
echo "Usage: $0 project-name | project-owner" >&2
return 2
;;
*)
export PROJECTDIR=${1}
;;
esac
}
#
# vwproj - display project directory
#
function vwproj
{
typeset TRYHOME
# should mimic how sccs(1) finds things.... From the manual:
#
# If the environment variable PROJECTDIR is set to contain an
# absolute pathname (beginning with a slash), sccs searches
# for SCCS history files in the directory given by that vari-
# able. If PROJECTDIR does not begin with a slash, it is tak-
# en as the name of a user, and sccs searches the src or
# source subdirectory of that user's home directory for histo-
# ry files.
#
# Note though that vproj may set PROJECT to be $1/SCCS
#
case "${PROJECTDIR}" in
"")
echo $PROJECT
;;
/*)
echo ${PROJECTDIR}/${PROJECT}
;;
*)
eval TRYHOME="~${PROJECTDIR}"
if [ -d ${TRYHOME}/src/${PROJECT}/SCCS ] ; then
echo ${TRYHOME}/src/${PROJECT}/SCCS
elif [ -d ${TRYHOME}/source/${PROJECT}/SCCS ] ; then
echo ${TRYHOME}/source/${PROJECT}/SCCS
elif [ -d ${TRYHOME}/src/${PROJECT} ] ; then
echo ${TRYHOME}/src/${PROJECT}
elif [ -d ${TRYHOME}/source/${PROJECT} ] ; then
echo ${TRYHOME}/source/${PROJECT}
fi
;;
esac
}
#
# mksccs - create a new s-file with approprate flags
#
# based on:
#ident "mksccs.sh,v 1.9 1993/01/18 22:25:14 woods Exp "
#
alias vmksccs=mksccs
function mksccs
{
typeset USAGE="Usage: $0 [-dDEFBR] [-h] [-o] [-qQFLAG] [-rSID] [-tMTYPE] [-yCOMMENT] file ..."
typeset HELP="$USAGE
-dDEFBR set DEFBR as the default delta (i.e. branch)
-h print this help message
-o this is a SCCS_SCHILY option only (ignored)
-qQFLAG set the user-defined keyword to QFLAG, (e.g. owner id) (for :Q:)
(defaults to \$USER)
-rSID set the release level to REL (defaults to current release level)
-tMTYPE set the module type to MTYPE (for :Y:)
(defaults to HOME if in home directory, else basename of \$PWD)
-DDESCR set the file description to DESCR (default is none)
-yCOMMENT set the initial comment to COMMENT
(defaults to: 'date and time created YY/MM/DD HH:MM:SS by \$USER')
$0 enters a new file into the SCCS repository for project $PROJECT.
e.g.: $0 -q\$USER -tHOME .newfile
"
typeset DEFBR=""
typeset DESCR=""
typeset OFLAG=""
typeset QFLAG=""
typeset REL=""
typeset TFLAG=""
typeset TMPFILE=""
typeset currentrel=$(vcurrentrel 2>/dev/null)
if [ -n "${currentrel}" ] ; then
REL="-r${currentrel}"
fi
while getopts D:d:hoq:r:t:y: OPTCH
do
case $OPTCH in
D)
TMPFILE=`mktemp -t ${0##*/}`
if [ $? -ne 0 ]; then
echo "$0: Cannot create a temporary file for the description, exiting..."
return 1
fi
# n.b. at least for pdksh EXIT doesn't fire for functions...
trap "rm -f ${TMPFILE}" EXIT HUP INT TERM
printf "%s\n" "${OPTARG}" > ${TMPFILE}
DESCR="-t${TMPFILE}"
;;
d)
# default delta (branch)
DEFBR="-fd${OPTARG}"
;;
h)
echo "$HELP"
return 2
;;
o)
# this is a SCCS_SCHILY option....
OFLAG="-o"
;;
q)
# user-defined keyword (e.g. owner id) (:Q:)
QFLAG="${OPTARG}"
;;
r)
# REL defaults to current release level
REL="-r${OPTARG}"
;;
t)
# module type (:Y:)
TFLAG="${OPTARG}"
;;
y)
YOPT="-y${OPTARG}"
;;
*)
echo "$USAGE" >&2
return 2
;;
esac
done
shift $(( $OPTIND - 1 ))
if [ $# -lt 1 ] ; then
echo $USAGE >&2
return 2
fi
# we don't really use "$sdir" -- we only want to be sure it exists
# and if it doesn't then we'll create it now....
typeset sdir="$(vwproj)"
if [ -z "$sdir" ] ; then
echo "$0: no project set!" >&2
return 1
fi
if [ ! -d "$sdir" ] ; then
mkdir $sdir
fi
if [ ! -d "$sdir" ] ; then
return 1
fi
# safer, more secure, than $LOGNAME or $USER, so long as you have id(1)
typeset mksccsuid=$(id | sed -e 's/^uid=[0-9]*(\(.*\)) gid=.*/\1/')
# XXX this should be PROJECTDIR iff is a username
if [ -z "$QFLAG" -a -z "$PROJOWNER" ] ; then
QFLAG="${mksccsuid}"
elif [ -z "$QFLAG" ]; then
QFLAG="${PROJOWNER}"
fi
if [ -z "$TFLAG" -a "$PROJECT" = "SCCS" ] ; then
if [ "$(pwd)" = "$HOME" ]; then
TFLAG="HOME"
else
TFLAG="$(basename $(pwd))"
fi
elif [ -z "$TFLAG" ]; then
TFLAG="$PROJECT"
fi
typeset file=""
${SCCS} -p $PROJECT enter $OFLAG $REL ${YOPT:+"${YOPT}"} $@
if [ $? -eq 0 ] ; then
# xxx hmmmm.... '-fn' too ???
${SCCS} -p $PROJECT admin $DEFBR -fb -fq"${QFLAG}" -ft"${TFLAG}" ${DESCR:+"${DESCR}"} $@
else
return 1
fi
typeset rc=$?
if [ -n "${TMPFILE}" ]; then
rm -f ${TMPFILE}
fi
if [ $rc -eq 0 ] && ${SCCS} -p $PROJECT val $@ ; then
: # It's all OK Jim....
else
echo "$0: failed to enter one or more files (try vval...)" >&2
fi
for file in $@; do
if [ -x $file ]; then
chmod +x $PROJECT/$file
fi
done
${SCCS} -p $PROJECT get $@
rc=$(( $rc + $? ))
if [ $rc -eq 0 ] ; then
# pretty sure of ourselves! :-)
/bin/rm -f ,*
fi
return $rc
}
#
# venter - suggest using vmksccs instead!
#
function venter
{
typeset yn
trap '' 2
echo $n "Are you sure you want to use 'venter' instead of 'vmksccs'? (y/[n]) $c"
read yn
trap 2
case "$yn" in
[yY]*)
${SCCS} -p $PROJECT enter $@
${SCCS} -p $PROJECT get $@
;;
esac
}
#
# vget - get a file, or all the files
#
# n.b.: if one wants to supply options _and_ get all the files then one must
# supply '$(vwproj)' as the last argument.
#
# XXX we should pass any '-rREL' to vrmempty !!!
#
function vget
{
if [ $# -eq 0 ] ; then
${SCCS} -p $PROJECT get $(vwproj)
else
${SCCS} -p $PROJECT get $@
fi
vrmempty
}
#
# vlog - get the log files (i.e. in l.FILE)
#
# N.B.: Schily SCCS hasa a "sccs log" command producing a ChangeLog
#
function vlog
{
if [ $# -eq 0 ] ; then
${SCCS} -p $PROJECT get -l -s -p $(vwproj) > /dev/null
else
${SCCS} -p $PROJECT get -l -s -p $@ > /dev/null
fi
}
function vprint
{
if [ $# -eq 0 ] ; then
${SCCS} -p $PROJECT print $(vwproj)
else
${SCCS} -p $PROJECT print $@
fi
}
function vprs
{
if [ $# -eq 0 ] ; then
${SCCS} -p $PROJECT prs $(vwproj)
else
${SCCS} -p $PROJECT prs $@
fi
}
function vprt
{
if [ $# -eq 0 ] ; then
${SCCS} -p $PROJECT prt $(vwproj)
else
${SCCS} -p $PROJECT prt $@
fi
}
#
# vrm - remove a file from the project
#
# Note: Schily SCCS has a "sccs remove" command, but it is actually still
# "unimplemented" (just boilerplate). It is documented as a form of "staging"
# or preparation operation that will "mark the file for removal with the next
# commit" (and there's a proposed but unimplemented "sccs commit" command as
# well). (Similarly there's a proposed but unimplemented "sccs rename", and
# this is apparently all to be tied together with "changeset" support as
# documented in sccschangeset(5).)
#
# For now we will simply check in an empty file and the new SID to the list of
# locked releases.
#
function vrm
{
if [ $# -ne 1 ]; then
echo "Usage: $0 file" >&2
return 2
fi
# XXX perhaps this should look through the list from vtell?
typeset sdir=$(vwproj)
if [ ! -s ${sdir}/p.$1 ]; then
vgeted $1
>$1
elif [ -s $1 ]; then
echo "$0: file '$1' should be empty!" >&2
return 1
fi
#XXX#
#XXX# the idea here was to lock the SID for the removal delta, but one can only
#XXX# lock whole releases. we will have to rely on vrmempty instead for now....
#XXX#
#XXX# # xxx the next should use 'vsact', but that's not yet implemented in CSSC's sccs(1)!
#XXX# typeset rmsid=$(awk '{print $2}' < ${sdir}/p.$1)
vdelta -y"file is now removed" $1
#XXX# typeset lsids=$(vprs -d:LK: $1)
#XXX# if [ ${lsids} = "none" ]; then
#XXX# lsids=""
#XXX# fi
#XXX# vadmin -fl"${lsids:+${lsids},}${rmsid}" $1
}
#
# vverify - check that all the files in the project are present
#
function vverify
{
typeset sdir="$(vwproj)"
typeset sfile
typeset rc=0
for sfile in $(vprs -d:F: $(vwproj)) ; do
typeset file=${sfile##s.}
if [ ! -r "${file}" ] ; then
if [ -z "$(${SCCS} get -sp ${file} 2>/dev/null)" ]; then
: OK, removed
else
echo "${file}: missing (needs vget?)!" >&2
: $((rc++))
fi
fi
if [ -w "${file}" -a ! -f "${sdir}/p.${file}" ] ; then
echo "${file}: writable but not being edited!" >&2
: $((rc++))
fi
done
return $rc
}
#
# vlist - print interesting info about s-files
#
function vlist
{
typeset PRSLIST=":Z::Y:\::M:\t:I:\t(:Q:)\t:D: :T: :P:\tBF=:BF: MF=:MF:"
# work around some silly pdksh bug....
if expr "$PRSLIST" : '.*\\' > /dev/null ; then
PRSLIST=":Z::Y:::M:\t:I:\t(:Q:)\t:D: :T: :P:\tBF=:BF: MF=:MF:"
fi
if [ "$1" = "-m" ] ; then
PRSLIST="$PRSLIST :MR:"
shift
fi
${SCCS} -p $PROJECT prs -d"$PRSLIST" ${1+"$@"} $PROJECT
}
#
# vls - do ls in ${PROJECTDIR} with optional ls options
#
function vls
{
ls $@ $(vwproj)
}
#
# vfiles - generate a list of project files
#
function vfiles
{
if [ $# -ne 0 ] ; then
echo "Usage: $0" >&2
return 2
fi
ls $(vwproj) | awk '/^s\./{print substr($1, 3)}'
}
#
# vwhat - a saner version of what
#
function vwhat
{
if [ $# -eq 0 ] ; then
echo "Usage: $0 file ..." >&2
return 2
fi
what $@ | awk 'NF > 1 {print $0}' | sort -u
}
#
# vsact - wrapper for sact
#
# Note: without any args you probably want to discard stderr...
#
function vsact
{
if [ $# -eq 0 ] ; then
${SCCS} -p $PROJECT sact $(vwproj)
else
${SCCS} -p $PROJECT sact $@
fi
}
#
# vcommitters - get the list of all UIDs for all commits
#
function vcommitters
{
if [ $# -eq 0 ] ; then
${SCCS} -p $PROJECT prs -e -d:P: $(vwproj)
else
${SCCS} -p $PROJECT prs -e -d:P: $@
fi | sort -u
}
#
# vcurrentrel - find the current release level
#
# Note the new '-r' edit level when vnewrel is run is/will-be the "next"
# release.
#
function vcurrentrel
{
if [ $# -ne 0 ] ; then
echo "Usage: $0" >&2
return 2
fi
vprs -d:R: $(vwproj) | sort -nu | tail -1
}
#
# vremoved - list the removed files
#
function vremoved
{
typeset RELOPT=""
typeset USAGE="Usage: $0 [-rREL]"
while getopts r: OPTCH
do
case $OPTCH in
r)
RELOPT="-r${OPTARG}"
;;
*)
echo "$USAGE" >&2
return 2
;;
esac
done
shift $(( $OPTIND - 1 ))
if [ $# -ne 0 ] ; then
echo "$USAGE" >&2
return 2
fi
# list empty tracked files
for sfile in $(vprs -d:F: $(vwproj)) ; do
typeset file=${sfile##s.}
if [ -z "$(${SCCS} get ${RELOPT:+"${RELOPT}"} -sp ${file} 2>/dev/null)" ]; then
echo ${file}
fi
done
}
#
# vrmempty - clean out empty (i.e. removed) g-files
#
function vrmempty
{
typeset RELOPT=""
typeset USAGE="Usage: $0 [-rREL]"
while getopts r: OPTCH
do
case $OPTCH in
r)
RELOPT="-r${OPTARG}"
;;
*)
echo "$USAGE" >&2
return 2
;;
esac
done
shift $(( $OPTIND - 1 ))
if [ $# -ne 0 ] ; then
echo "$USAGE" >&2
return 2
fi
typeset removed=$(vremoved ${RELOPT:+"${RELOPT}"})
if [ -n "${removed}" ]; then
rm -f ${removed}
fi
}
#
# vnewrel - start a new release
#
# Make an archive of your source files first, then run this to begin
# the NEXT release...
#
# (i.e. roll up the release number on all files in the project)
#
# WARNING: Note there's no "module" locking here!
#
# NOTE: If you do this accidentally before you wrapped up the last release,
# then you can go back easily enough with "vgetprev", then use "vget" to return
# to this next/new release
#
function vnewrel
{
typeset USAGE="Usage: $0 [RELEASE]"
vcheck || {
echo "$0: files are still being edited!" >&2
return 1
}
typeset REL
if [ $# -eq 1 ] ; then
REL=$1
# XXX error check that it's an integer?
elif [ $# -eq 0 ] ; then
REL=$(( $(vcurrentrel) + 1 ))
else
echo "$USAGE" >&2
return 2
fi
vedit -r$REL $PROJECT
# un-edit empty files -- don't give them a new release level!
typeset sdir="$(vwproj)"
for sfile in $(vprs -d:F: $(vwproj)) ; do
typeset file=${sfile##s.}
if [ -s ${file} ]; then
: OK
else
vunedit ${file}
fi
done
vdelget -y"START RELEASE $REL" $PROJECT
# xxx vdelget may not get everything/anything when run on the whole
# $PROJECT directory, and it does not deal with removed files (vget also
# calls vrmempty)
#
vget
}
alias vmkrel='vnewrel'
#
# vgetprev - check out a previous release
#
# Use vget to return to the working versions
#
function vgetprev
{
typeset USAGE="Usage: $0 [RELEASE]"
vcheck || {
echo "$0: files still being edited!" >&2
return 1
}
typeset REL
if [ $# -eq 1 ] ; then
REL=$1
# XXX error check that it's an integer?
elif [ $# -eq 0 ] ; then
REL=$(( $(vcurrentrel) - 1 ))
else
echo "$USAGE" >&2
return 2
fi
# vget also calls vrmempty, so we don't want to use it here!
${SCCS} get -r$REL $PROJECT
vrmempty -r$REL
}
alias vgetcur='vgetprev $(vcurrentrel)'