aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorEric S. Raymond1993-03-19 23:01:33 +0000
committerEric S. Raymond1993-03-19 23:01:33 +0000
commit17457b8df3890c70ebfab8883b6f03d55d8382bd (patch)
tree16903824c896ea4df50b5ef2352d060cf78df7d8 /lib-src
parenteed3d5af4540bd0cdbcbcb7579a179cc82fe658a (diff)
downloademacs-17457b8df3890c70ebfab8883b6f03d55d8382bd.tar.gz
emacs-17457b8df3890c70ebfab8883b6f03d55d8382bd.zip
Initial revision
Diffstat (limited to 'lib-src')
-rwxr-xr-xlib-src/rcs-checkin75
1 files changed, 75 insertions, 0 deletions
diff --git a/lib-src/rcs-checkin b/lib-src/rcs-checkin
new file mode 100755
index 00000000000..d813377d0cd
--- /dev/null
+++ b/lib-src/rcs-checkin
@@ -0,0 +1,75 @@
1#!/bin/sh
2
3case $# in
40)
5 echo "rcs-checkin: usage: rcs-checkin file ..."
6 echo "rcs-checkin: function: checks file.~*~ and file into a new RCS file"
7 echo "rcs-checkin: function: uses the file's first line for the description"
8esac
9
10# expr pattern to extract owner from ls -l output
11ls_owner_pattern='[^ ][^ ]* *[^ ][^ ]* *\([^ ][^ ]*\)'
12
13for file
14do
15 # Check that file is readable.
16 <$file || exit
17
18 # Make it easier to say `rcs-checkin *'
19 # by ignoring file names that already contain `~', or end in `,v'.
20 case $file in
21 *~* | *,v) continue
22 esac
23 # Ignore non-files too.
24 test -f "$file" || continue
25
26 # If the RCS file does not already exist,
27 # initialize it with a description from $file's first line.
28 rlog -R "$file" >/dev/null 2>&1 ||
29 rcs -i -q -t-"`sed 1q $file`" "$file" || exit
30
31 # Get list of old files.
32 oldfiles=`
33 ls $file.~[0-9]*~ 2>/dev/null |
34 sort -t~ -n +1
35 `
36
37 # Check that they are properly sorted by date.
38 case $oldfiles in
39 ?*)
40 oldfiles_by_date=`ls -rt $file $oldfiles`
41 test " $oldfiles
42$file" = " $oldfiles_by_date" || {
43 echo >&2 "rcs-checkin: skipping $file, because its mod times are out of order.
44
45Sorted by mod time:
46$oldfiles_by_date
47
48Sorted by name:
49$oldfiles
50$file"
51 continue
52 }
53 esac
54
55 echo >&2 rcs-checkin: checking in: $oldfiles $file
56
57 # Save $file as $file.~-~ temporarily.
58 mv "$file" "$file.~-~" || exit
59
60 # Rename each old file to $file, and check it in.
61 for oldfile in $oldfiles
62 do
63 mv "$oldfile" "$file" || exit
64 ls_l=`ls -l "$file"` || exit
65 owner=-w`expr " $ls_l" : " $ls_owner_pattern"` || owner=
66 ci -d -l -q $owner "$file" </dev/null || exit
67 done
68
69 # Bring $file back from $file.~-~, and check it in.
70 mv "$file.~-~" "$file" || exit
71 ls_l=`ls -l "$file"` || exit
72 owner=-w`expr " $ls_l" : " $ls_owner_pattern"` || owner=
73 ci -d -q -u $owner -m"entered into RCS" "$file" || exit
74done
75