summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/commit.c
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-05-20 05:13:45 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-05-20 05:13:45 +0000
commit92227c2873d2aa52cc72cac6ba11491f2ca43785 (patch)
tree882a1bd003526e597fff3b8ed9fe90a9bd50f95d /usr.bin/cvs/commit.c
parent953436ae010ef8b64f902cafa1e45d52112eb747 (diff)
execute the command callback at the same time we are building
the in-memory filelist. cuts down on execution time for larger trees. "put it in!" jfb@
Diffstat (limited to 'usr.bin/cvs/commit.c')
-rw-r--r--usr.bin/cvs/commit.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c
index f6f2cb857f2..a4474608c3f 100644
--- a/usr.bin/cvs/commit.c
+++ b/usr.bin/cvs/commit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commit.c,v 1.31 2005/04/24 02:06:27 joris Exp $ */
+/* $OpenBSD: commit.c,v 1.32 2005/05/20 05:13:44 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -58,6 +58,8 @@ struct cvs_cmd_info cvs_commit = {
};
static char *mfile = NULL;
+static char **commit_files = NULL;
+static int commit_fcount = 0;
int
cvs_commit_options(char *opt, int argc, char **argv, int *arg)
@@ -100,6 +102,10 @@ cvs_commit_options(char *opt, int argc, char **argv, int *arg)
return (CVS_EX_DATA);
*arg = optind;
+
+ commit_files = (argv + optind);
+ commit_fcount = (argc - optind);
+
return (0);
}
@@ -108,16 +114,32 @@ cvs_commit_helper(void)
{
struct cvs_flist cl;
CVSFILE *cfp;
-
+ CVSFILE *tmp;
+ int flags = CF_RECURSE | CF_IGNORE | CF_SORT;
+
SIMPLEQ_INIT(&cl);
- cvs_file_examine(cvs_files, cvs_commit_prepare, &cl);
- if (SIMPLEQ_EMPTY(&cl))
+
+ if (commit_fcount != 0) {
+ tmp = cvs_file_getspec(commit_files, commit_fcount,
+ flags, cvs_commit_prepare, &cl);
+ } else {
+ tmp = cvs_file_get(".", flags, cvs_commit_prepare, &cl);
+ }
+
+ if (tmp == NULL)
+ return (CVS_EX_DATA);
+
+ if (SIMPLEQ_EMPTY(&cl)) {
+ cvs_file_free(tmp);
return (0);
+ }
if (cvs_msg == NULL)
- cvs_msg = cvs_logmsg_get(CVS_FILE_NAME(cvs_files),
+ cvs_msg = cvs_logmsg_get(CVS_FILE_NAME(tmp),
NULL, &cl, NULL);
+ cvs_file_free(tmp);
+
while (!SIMPLEQ_EMPTY(&cl)) {
cfp = SIMPLEQ_FIRST(&cl);
SIMPLEQ_REMOVE_HEAD(&cl, cf_list);