diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2006-07-01 20:30:47 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2006-07-01 20:30:47 +0000 |
commit | 26d72c779cc523a9bd732928204054e76149fea4 (patch) | |
tree | e40de37dc0faf785ad5733fdceee0e7128ad4f4f /usr.bin | |
parent | 030973ef7bde4f5193a68e81bd08f76a2022eeb1 (diff) |
implement the -p (dump) flag for cvs update
ok joris@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/checkout.c | 9 | ||||
-rw-r--r-- | usr.bin/cvs/cvs.h | 3 | ||||
-rw-r--r-- | usr.bin/cvs/update.c | 18 |
3 files changed, 27 insertions, 3 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c index e86bd49de4c..ce59cb2c704 100644 --- a/usr.bin/cvs/checkout.c +++ b/usr.bin/cvs/checkout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: checkout.c,v 1.64 2006/06/19 05:05:17 joris Exp $ */ +/* $OpenBSD: checkout.c,v 1.65 2006/07/01 20:30:46 reyk Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -176,6 +176,13 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, BUF *bp, int flags) nbp = rcs_kwexp_buf(bp, cf->file_rcs, rnum); + if (flags & CO_DUMP) { + if (cvs_buf_write_fd(nbp, STDOUT_FILENO) == -1) + fatal("cvs_checkout_file: %s", strerror(errno)); + cvs_buf_free(nbp); + return; + } + oflags = O_WRONLY | O_TRUNC; if (cf->fd != -1) { exists = 1; diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h index fd14180dbae..381e35f80e8 100644 --- a/usr.bin/cvs/cvs.h +++ b/usr.bin/cvs/cvs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.h,v 1.114 2006/06/19 05:05:17 joris Exp $ */ +/* $OpenBSD: cvs.h,v 1.115 2006/07/01 20:30:46 reyk Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -356,5 +356,6 @@ int update_has_conflict_markers(struct cvs_file *); #define CO_MERGE 0x01 #define CO_SETSTICKY 0x02 +#define CO_DUMP 0x04 #endif diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c index b0ceafc04ac..d5955e3fa28 100644 --- a/usr.bin/cvs/update.c +++ b/usr.bin/cvs/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.75 2006/06/19 05:05:17 joris Exp $ */ +/* $OpenBSD: update.c,v 1.76 2006/07/01 20:30:46 reyk Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -23,6 +23,7 @@ int cvs_update(int, char **); int prune_dirs = 0; +int dump = 0; int build_dirs = 0; int reset_stickies = 0; static char *tag = NULL; @@ -77,6 +78,7 @@ cvs_update(int argc, char **argv) prune_dirs = 1; break; case 'p': + dump = 1; break; case 'Q': case 'q': @@ -244,6 +246,7 @@ cvs_update_local(struct cvs_file *cf) BUF *bp; int ret, flags; CVSENTRIES *entlist; + char rbuf[16]; cvs_log(LP_TRACE, "cvs_update_local(%s)", cf->file_path); @@ -271,6 +274,19 @@ cvs_update_local(struct cvs_file *cf) cf->file_rcsrev = rcs_head_get(cf->file_rcs); } + if (dump && cf->file_status != FILE_UNKNOWN) { + bp = rcs_getrev(cf->file_rcs, cf->file_rcsrev); + if (bp == NULL) + fatal("cvs_update_local: failed to get HEAD"); + rcsnum_tostr(cf->file_rcsrev, rbuf, sizeof(rbuf)); + if (verbosity > 1) + cvs_printf("%s\nChecking out %s\n" + "RCS:\t%s\nVERS:\t%s\n***************\n", + RCS_DIFF_DIV, cf->file_path, cf->file_rpath, rbuf); + cvs_checkout_file(cf, cf->file_rcsrev, bp, CO_DUMP); + return; + } + switch (cf->file_status) { case FILE_UNKNOWN: cvs_printf("? %s\n", cf->file_path); |