summaryrefslogtreecommitdiff
path: root/usr.bin/rcs/ci.c
diff options
context:
space:
mode:
authorNiall O'Higgins <niallo@cvs.openbsd.org>2006-03-11 22:44:12 +0000
committerNiall O'Higgins <niallo@cvs.openbsd.org>2006-03-11 22:44:12 +0000
commit8396d7871ce26544eb8554d070277994d427a910 (patch)
treef84277b70eaf9bf4553cea4e022d750046dcd2c9 /usr.bin/rcs/ci.c
parentad743ae786746e4bd8f93f6afa2caff7bce0442a (diff)
- implement GNU-compatible handling of revisions specified as single
digits. e.g. ci -l4 or ci -u5 will work like GNU now. ok joris@
Diffstat (limited to 'usr.bin/rcs/ci.c')
-rw-r--r--usr.bin/rcs/ci.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c
index 9002f17f081..d3028ba23fa 100644
--- a/usr.bin/rcs/ci.c
+++ b/usr.bin/rcs/ci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ci.c,v 1.114 2006/03/11 18:38:54 niallo Exp $ */
+/* $OpenBSD: ci.c,v 1.115 2006/03/11 22:44:11 niallo Exp $ */
/*
* Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
@@ -51,6 +51,8 @@
#define KW_NUMTOKS_STATE 3
#define KW_NUMTOKS_REVISION 3
+#define RCSNUM_ZERO_ENDING(x) (x->rn_id[x->rn_len - 1] == 0)
+
extern struct rcs_kw rcs_expkw[];
struct checkin_params {
@@ -453,6 +455,10 @@ checkin_update(struct checkin_params *pb)
*/
pb->frev = pb->file->rf_head;
+ /* If this is a zero-ending RCSNUM eg 4.0, increment it (eg to 4.1) */
+ if ((pb->newrev != NULL) && (RCSNUM_ZERO_ENDING(pb->newrev)))
+ pb->newrev = rcsnum_inc(pb->newrev);
+
if (checkin_checklock(pb) < 0)
return (-1);
@@ -606,8 +612,17 @@ checkin_init(struct checkin_params *pb)
{
BUF *bp, *dp;
char *filec, numb[64];
+ int fetchlog = 0;
const char *rcs_desc;
+ /* If this is a zero-ending RCSNUM eg 4.0, increment it (eg to 4.1) */
+ if ((pb->newrev != NULL) && (RCSNUM_ZERO_ENDING(pb->newrev))) {
+ pb->frev = rcsnum_alloc();
+ rcsnum_cpy(pb->newrev, pb->frev, 0);
+ pb->newrev = rcsnum_inc(pb->newrev);
+ fetchlog = 1;
+ }
+
/* Load file contents */
if ((bp = cvs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL) {
rcs_close(pb->file);
@@ -654,6 +669,14 @@ checkin_init(struct checkin_params *pb)
rcs_desc_set(pb->file, rcs_desc);
/*
+ * If the user had specified a zero-ending revision number e.g. 4
+ * emulate odd GNU behaviour and fetch log message.
+ */
+ if (fetchlog == 1) {
+ pb->rcs_msg = checkin_getlogmsg(pb->frev, pb->newrev);
+ rcsnum_free(pb->frev);
+ }
+ /*
* Set the date of the revision to be the last modification
* time of the working file if -d has no argument.
*/