diff options
author | 2016-10-18 17:11:43 +0000 | |
---|---|---|
committer | 2016-10-18 17:11:43 +0000 | |
commit | aaa6eb81036639bb709fd03c78a171041e5dcda0 (patch) | |
tree | 71dc978ef794e27ea8ccd471882b50a2d0f501fb /usr.bin/cvs | |
parent | Merge fs/msdosfs/ and newfs_msdos/ into msdos/. (diff) | |
download | wireguard-openbsd-aaa6eb81036639bb709fd03c78a171041e5dcda0.tar.xz wireguard-openbsd-aaa6eb81036639bb709fd03c78a171041e5dcda0.zip |
Add the branch revision to the status output much like GNU cvs does.
OK millert@
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/status.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c index aedf41bf462..3aa0ff44b20 100644 --- a/usr.bin/cvs/status.c +++ b/usr.bin/cvs/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.96 2015/04/04 14:20:11 stsp Exp $ */ +/* $OpenBSD: status.c,v 1.97 2016/10/18 17:11:43 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2005-2008 Xavier Santolaria <xsa@openbsd.org> @@ -16,6 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <stdlib.h> #include <string.h> #include <time.h> #include <unistd.h> @@ -119,7 +120,7 @@ void cvs_status_local(struct cvs_file *cf) { size_t len; - RCSNUM *head; + RCSNUM *head, *brev; const char *status; struct rcs_delta *rdp; char buf[PATH_MAX + CVS_REV_BUFSZ + 128]; @@ -223,11 +224,23 @@ cvs_status_local(struct cvs_file *cf) } if (cf->file_ent != NULL) { - if (cf->file_ent->ce_tag != NULL) - cvs_printf(" Sticky Tag:\t\t%s\n", - cf->file_ent->ce_tag); - else if (verbosity > 0) + if (cf->file_ent->ce_tag != NULL) { + if ((brev = rcs_sym_getrev(cf->file_rcs, + cf->file_ent->ce_tag)) == NULL) { + (void)strlcpy(buf, "- MISSING from RCS file!", + sizeof(buf)); + } else { + rcsnum_tostr(brev, revbuf, sizeof(revbuf)); + (void)xsnprintf(buf, sizeof(buf), + "(branch: %s)", revbuf); + free(brev); + } + + cvs_printf(" Sticky Tag:\t\t%s %s\n", + cf->file_ent->ce_tag, buf); + } else if (verbosity > 0) { cvs_printf(" Sticky Tag:\t\t(none)\n"); + } if (cf->file_ent->ce_date != -1) { struct tm datetm; |