summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/import.c
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-12-03 01:02:10 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-12-03 01:02:10 +0000
commitef47fbf93d2302d521921cce5f98a093b4779e9f (patch)
tree50d76a77cc19c09cea910a3890611cb290e63bab /usr.bin/cvs/import.c
parent1c6cd252eaeaeedbd87c69d5843ae9550b20ee91 (diff)
add very basic support for the following stuff:
- checkout in local mode (example: /cvs) - update in local and server mode (example: /cvs and user@host:/cvs) - import in local and server mode (example: /cvs and user@host:/cvs) what remains to be done: - not all options are supported yet, and update cannot pick up newly added files yet. these things are pending and will be commited real soon. - checkout only works locally right now. - fix rcs parsing code so that we don't fucking hog 100% cpu on really BIG BIG BIG ass trees. mainly tested by pedro@ and myself, thanks a lot pedro! "go for it" niallo@
Diffstat (limited to 'usr.bin/cvs/import.c')
-rw-r--r--usr.bin/cvs/import.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/usr.bin/cvs/import.c b/usr.bin/cvs/import.c
index 39661d7febf..6e3c6a80c4e 100644
--- a/usr.bin/cvs/import.c
+++ b/usr.bin/cvs/import.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: import.c,v 1.29 2005/11/28 08:49:25 xsa Exp $ */
+/* $OpenBSD: import.c,v 1.30 2005/12/03 01:02:09 joris Exp $ */
/*
* Copyright (c) 2004 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -243,6 +243,7 @@ cvs_import_local(CVSFILE *cf, void *arg)
size_t len;
int l;
time_t stamp;
+ char *fcont;
char fpath[MAXPATHLEN], rpath[MAXPATHLEN], repo[MAXPATHLEN];
const char *comment;
struct stat fst;
@@ -250,6 +251,7 @@ cvs_import_local(CVSFILE *cf, void *arg)
struct cvsroot *root;
RCSFILE *rf;
RCSNUM *rev;
+ BUF *bp;
root = CVS_DIR_ROOT(cf);
@@ -367,6 +369,26 @@ cvs_import_local(CVSFILE *cf, void *arg)
return (CVS_EX_DATA);
}
+ if ((bp = cvs_buf_load(fpath, BUF_AUTOEXT)) == NULL) {
+ rcs_close(rf);
+ (void)unlink(rpath);
+ return (CVS_EX_DATA);
+ }
+
+ if (cvs_buf_putc(bp, '\0') < 0) {
+ rcs_close(rf);
+ (void)unlink(rpath);
+ return (CVS_EX_DATA);
+ }
+
+ fcont = cvs_buf_release(bp);
+
+ if (rcs_deltatext_set(rf, rev, fcont) < 0) {
+ rcs_close(rf);
+ (void)unlink(rpath);
+ return (CVS_EX_DATA);
+ }
+
/* add the vendor tag and release tag as symbols */
rcs_close(rf);