summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNiall O'Higgins <niallo@cvs.openbsd.org>2005-10-15 21:23:55 +0000
committerNiall O'Higgins <niallo@cvs.openbsd.org>2005-10-15 21:23:55 +0000
commit41f65192659d14d856042ef878cf9b1587bb75b1 (patch)
tree475ab2d3b5fdb2cb66d7d8762d135fc1e02f62c6 /usr.bin
parent0ce6ecc53d8f35cbf65ef1d586ca78726686d00a (diff)
- if revision passed to checkout_rev() is > HEAD, assume HEAD
(like GNU RCS). - move verbose output into checkout_rev() function itself. "looks sane" joris@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rcs/co.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c
index ff654df3228..f73687aee84 100644
--- a/usr.bin/rcs/co.c
+++ b/usr.bin/rcs/co.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: co.c,v 1.14 2005/10/15 18:26:24 niallo Exp $ */
+/* $OpenBSD: co.c,v 1.15 2005/10/15 21:23:54 niallo Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -133,15 +133,6 @@ checkout_main(int argc, char **argv)
continue;
}
rcs_close(file);
- if (verbose == 1) {
- printf("revision %s ", buf);
- if (lock == LOCK_LOCK)
- printf("(locked)");
- else if (lock == LOCK_UNLOCK)
- printf("(unlocked)");
- printf("\n");
- printf("done\n");
- }
}
if (rev != RCS_HEAD_REV)
@@ -173,12 +164,15 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int lkmode,
char buf[16];
mode_t mode = 0444;
BUF *bp;
- rcsnum_tostr(frev, buf, sizeof(buf));
/*
- * XXX: GNU RCS will check out the latest revision if <frev> is
- * greater than HEAD
+ * Check out the latest revision if <frev> is greater than HEAD
*/
+ if (rcsnum_cmp(frev, file->rf_head, 0) == -1)
+ frev = file->rf_head;
+
+ rcsnum_tostr(frev, buf, sizeof(buf));
+
if ((bp = rcs_getrev(file, frev)) == NULL) {
cvs_log(LP_ERR, "cannot find revision `%s'", buf);
return (-1);
@@ -207,6 +201,15 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int lkmode,
return (-1);
}
cvs_buf_free(bp);
+ if (verbose == 1) {
+ cvs_printf("revision %s ", buf);
+ if (lkmode == LOCK_LOCK)
+ cvs_printf("(locked)");
+ else if (lkmode == LOCK_UNLOCK)
+ cvs_printf("(unlocked)");
+ cvs_printf("\n");
+ cvs_printf("done\n");
+ }
return (0);
}