summaryrefslogtreecommitdiff
path: root/usr.bin/rcs
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-05-05 01:30:00 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-05-05 01:30:00 +0000
commit33fade9e1ab2b17b91558c27d469d81de39591a4 (patch)
tree93b3ae1db4b3789af03122b36b67aa0a7f58e424 /usr.bin/rcs
parent279bf209f80fbecedcda6ea0adb0f03d4a65d2bc (diff)
o GNU ci returns 0 when a file is reverted (co -l file; ci file).
o Don't unlock file after revert. o Fix spelling. Passes extra tests in GNU rcstest. OK niallo@.
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r--usr.bin/rcs/ci.c14
-rw-r--r--usr.bin/rcs/co.c11
2 files changed, 12 insertions, 13 deletions
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c
index cbadf6db726..e7c2ad10fad 100644
--- a/usr.bin/rcs/ci.c
+++ b/usr.bin/rcs/ci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ci.c,v 1.168 2006/05/04 07:06:58 xsa Exp $ */
+/* $OpenBSD: ci.c,v 1.169 2006/05/05 01:29:59 ray Exp $ */
/*
* Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
@@ -508,7 +508,7 @@ checkin_update(struct checkin_params *pb)
*/
if (!(pb->flags & FORCE) && (strlen(pb->deltatext) < 1)) {
checkin_revert(pb);
- goto fail;
+ goto out;
}
/* If no log message specified, get it interactively. */
@@ -567,8 +567,6 @@ checkin_update(struct checkin_params *pb)
pb->file->rf_mode = st.st_mode &
(S_IXUSR|S_IXGRP|S_IXOTH|S_IRUSR|S_IRGRP|S_IROTH);
- xfree(pb->deltatext);
- xfree(filec);
(void)close(workfile_fd);
(void)unlink(pb->filename);
@@ -585,6 +583,11 @@ checkin_update(struct checkin_params *pb)
xfree(pb->rcs_msg);
pb->rcs_msg = NULL;
}
+
+out:
+ xfree(pb->deltatext);
+ xfree(filec);
+
return (0);
fail:
@@ -781,9 +784,6 @@ checkin_revert(struct checkin_params *pb)
if ((pb->flags & CO_LOCK) || (pb->flags & CO_UNLOCK))
checkout_rev(pb->file, pb->frev, pb->filename,
pb->flags, pb->username, pb->author, NULL, NULL);
- if (rcs_lock_remove(pb->file, pb->username, pb->frev) < 0)
- if (rcs_errno != RCS_ERR_NOENT)
- warnx("failed to remove lock");
}
/*
diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c
index 20d9e83fb17..6cd15e1245d 100644
--- a/usr.bin/rcs/co.c
+++ b/usr.bin/rcs/co.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: co.c,v 1.87 2006/04/29 05:31:28 ray Exp $ */
+/* $OpenBSD: co.c,v 1.88 2006/05/05 01:29:59 ray Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -231,7 +231,7 @@ checkout_usage(void)
/*
* Checkout revision <rev> from RCSFILE <file>, writing it to the path <dst>
- * Currenly recognised <flags> are CO_LOCK, CO_UNLOCK and CO_REVDATE.
+ * Currently recognised <flags> are CO_LOCK, CO_UNLOCK and CO_REVDATE.
*
* Looks up revision based upon <lockname>, <author>, <state> and <date>
*
@@ -349,9 +349,6 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
!(flags & CO_REVERT) && file->rf_ndelta != 0)
printf("revision %s", buf);
- if (!(flags & QUIET) && (flags & CO_REVERT))
- printf("done");
-
if (file->rf_ndelta != 0) {
if ((bp = rcs_getrev(file, rev)) == NULL) {
warnx("cannot find revision `%s'", buf);
@@ -424,7 +421,9 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
warnx("no revisions, so nothing can be %s",
(flags & CO_LOCK) ? "locked" : "unlocked");
} else if (file->rf_ndelta != 0) {
- if (!(flags & QUIET) && !(flags & NEWFILE))
+ /* XXX - Not a good way to detect if a newline is needed. */
+ if (!(flags & QUIET) && !(flags & NEWFILE) &&
+ !(flags & CO_REVERT))
printf("\n");
}