diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2006-05-31 22:26:00 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2006-05-31 22:26:00 +0000 |
commit | 716e0314b64d510286bd82fd5f761ba08a881d50 (patch) | |
tree | eade46f13482673e99452014e1c2d6c59380c46b /usr.bin/cvs | |
parent | b59294d37b551983fbf7b23539b9982c6fb34ab7 (diff) |
add support for the export command.
export does exactly the same as checkout except it does
not create any administrative (CVS/) directories.
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/checkout.c | 12 | ||||
-rw-r--r-- | usr.bin/cvs/cmd.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/update.c | 22 |
4 files changed, 36 insertions, 6 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c index f44664d686c..b7cbae9188f 100644 --- a/usr.bin/cvs/checkout.c +++ b/usr.bin/cvs/checkout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: checkout.c,v 1.58 2006/05/28 01:24:28 joris Exp $ */ +/* $OpenBSD: checkout.c,v 1.59 2006/05/31 22:25:59 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -39,6 +39,16 @@ struct cvs_cmd cvs_cmd_checkout = { cvs_checkout }; +struct cvs_cmd cvs_cmd_export = { + CVS_OP_EXPORT, CVS_REQ_EXPORT, "export", + { "exp", "ex" }, + "Export sources from CVS, similar to checkout", + "module ...", + "", + NULL, + cvs_checkout +}; + int cvs_checkout(int argc, char **argv) { diff --git a/usr.bin/cvs/cmd.c b/usr.bin/cvs/cmd.c index afb63f01204..df457d0df9c 100644 --- a/usr.bin/cvs/cmd.c +++ b/usr.bin/cvs/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.48 2006/05/30 07:00:30 joris Exp $ */ +/* $OpenBSD: cmd.c,v 1.49 2006/05/31 22:25:59 joris Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -36,6 +36,7 @@ struct cvs_cmd *cvs_cdt[] = { &cvs_cmd_commit, &cvs_cmd_checkout, &cvs_cmd_diff, + &cvs_cmd_export, &cvs_cmd_import, &cvs_cmd_log, &cvs_cmd_update, @@ -47,7 +48,6 @@ struct cvs_cmd *cvs_cdt[] = { &cvs_cmd_checkout, &cvs_cmd_edit, &cvs_cmd_editors, - &cvs_cmd_export, &cvs_cmd_history, &cvs_cmd_init, #if 0 diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index ce6e76cbc4d..dc0be399bee 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.178 2006/05/31 18:26:14 joris Exp $ */ +/* $OpenBSD: rcs.c,v 1.179 2006/05/31 22:25:59 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -2985,6 +2985,8 @@ rcs_translate_tag(const char *revstr, RCSFILE *rfp) } if (brp == NULL) { + if (cvs_cmdop == CVS_OP_IMPORT) + return (NULL); rcsnum_cpy(rdp->rd_num, rev, 0); return (rev); } diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c index a299e403155..73222b2d65f 100644 --- a/usr.bin/cvs/update.c +++ b/usr.bin/cvs/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.68 2006/05/30 21:32:52 joris Exp $ */ +/* $OpenBSD: update.c,v 1.69 2006/05/31 22:25:59 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -140,7 +140,7 @@ cvs_update_leavedir(struct cvs_file *cf) { long base; int nbytes; - int isempty; + int isempty, l; size_t bufsize; struct stat st; struct dirent *dp; @@ -148,9 +148,26 @@ cvs_update_leavedir(struct cvs_file *cf) struct cvs_ent *ent; struct cvs_ent_line *line; CVSENTRIES *entlist; + char *export; cvs_log(LP_TRACE, "cvs_update_leavedir(%s)", cf->file_path); + if (cvs_cmdop == CVS_OP_EXPORT) { + export = xmalloc(MAXPATHLEN); + l = snprintf(export, MAXPATHLEN, "%s/%s", cf->file_path, + CVS_PATH_CVSDIR); + if (l == -1 || l >= MAXPATHLEN) + fatal("cvs_update_leavedir: overflow"); + + /* XXX */ + if (cvs_rmdir(export) == -1) + fatal("cvs_update_leavedir: %s: %s:", export, + strerror(errno)); + + xfree(export); + return; + } + if (fstat(cf->fd, &st) == -1) fatal("cvs_update_leavedir: %s", strerror(errno)); @@ -209,6 +226,7 @@ cvs_update_leavedir(struct cvs_file *cf) xfree(buf); if (isempty == 1 && prune_dirs == 1) { + /* XXX */ cvs_rmdir(cf->file_path); entlist = cvs_ent_open(cf->file_wd); |