summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2009-02-21 13:44:19 +0000
committerJoris Vink <joris@cvs.openbsd.org>2009-02-21 13:44:19 +0000
commit0a714506acc136f72755d08ad7651e3840ae2573 (patch)
tree10a1fb9d9d1f16fd59b9e25f386de6e6f7a600eb
parentfcdb267cb4a93ef44b07b50fe1d8d818fa469aed (diff)
use file_flags for 2 more reasons:
- mark a file as being inside the Attic/ - mark a file as existing in the working copy (both in local and remote mode) this way we no longer will need to check if cf->fd == -1 and think about wether or not we are in local or remote mode.
-rw-r--r--usr.bin/cvs/checkout.c4
-rw-r--r--usr.bin/cvs/file.c8
-rw-r--r--usr.bin/cvs/file.h3
-rw-r--r--usr.bin/cvs/repository.c18
-rw-r--r--usr.bin/cvs/repository.h3
5 files changed, 24 insertions, 12 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index 8e77f67078d..98e51c08edb 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.157 2009/01/28 17:40:13 pyr Exp $ */
+/* $OpenBSD: checkout.c,v 1.158 2009/02/21 13:44:18 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -448,7 +448,7 @@ checkout_repository(const char *repobase, const char *wdbase)
cvs_repository_lock(repobase, 0);
cvs_repository_getdir(repobase, wdbase, &fl, &dl,
- flags & CR_RECURSE_DIRS ? 1 : 0);
+ flags & CR_RECURSE_DIRS ? REPOSITORY_DODIRS : 0);
cvs_file_walklist(&fl, &cr);
cvs_file_freelist(&fl);
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index 30bf7734b8b..d3681b57de9 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.250 2009/02/21 12:47:19 joris Exp $ */
+/* $OpenBSD: file.c,v 1.251 2009/02/21 13:44:18 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -585,7 +585,8 @@ walkrepo:
if (stat(fpath, &st) == -1 || build_dirs == 1)
cvs_repository_getdir(repo, cf->file_path, &fl, &dl,
- (cr->flags & CR_RECURSE_DIRS));
+ (cr->flags & CR_RECURSE_DIRS) ?
+ REPOSITORY_DODIRS : 0);
}
cvs_file_walklist(&fl, cr);
@@ -761,6 +762,9 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
ismodified = 0;
}
+ if ((server_has_file == 1) || (cf->fd != -1))
+ cf->file_flags |= FILE_ON_DISK;
+
if (ismodified == 1 && cf->fd != -1 && cf->file_rcs != NULL &&
cf->file_ent != NULL && !RCSNUM_ISBRANCH(cf->file_ent->ce_rev) &&
cf->file_ent->ce_status != CVS_ENT_ADDED) {
diff --git a/usr.bin/cvs/file.h b/usr.bin/cvs/file.h
index f220ad593b7..2845cbeed00 100644
--- a/usr.bin/cvs/file.h
+++ b/usr.bin/cvs/file.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.h,v 1.50 2009/02/21 12:47:19 joris Exp $ */
+/* $OpenBSD: file.h,v 1.51 2009/02/21 13:44:18 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -73,6 +73,7 @@ struct cvs_file {
#define FILE_HAS_TAG 0x01
#define FILE_USER_SUPPLIED 0x02
#define FILE_INSIDE_ATTIC 0x04
+#define FILE_ON_DISK 0x08
struct cvs_filelist {
char *file_path;
diff --git a/usr.bin/cvs/repository.c b/usr.bin/cvs/repository.c
index bc002c7f448..78153f1512b 100644
--- a/usr.bin/cvs/repository.c
+++ b/usr.bin/cvs/repository.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: repository.c,v 1.20 2008/03/09 03:14:52 joris Exp $ */
+/* $OpenBSD: repository.c,v 1.21 2009/02/21 13:44:18 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -96,7 +96,7 @@ cvs_repository_lock(const char *repo, int wantlock)
void
cvs_repository_getdir(const char *dir, const char *wdir,
- struct cvs_flisthead *fl, struct cvs_flisthead *dl, int dodirs)
+ struct cvs_flisthead *fl, struct cvs_flisthead *dl, int flags)
{
int type;
DIR *dirp;
@@ -157,21 +157,25 @@ cvs_repository_getdir(const char *dir, const char *wdir,
}
}
- if (dodirs == 0 && type == CVS_DIR)
+ if (!(flags & REPOSITORY_DODIRS) && type == CVS_DIR)
continue;
switch (type) {
case CVS_DIR:
- if (!strcmp(dp->d_name, CVS_PATH_ATTIC))
- cvs_repository_getdir(rpath, wdir, fl, dl, 0);
- else
+ if (!strcmp(dp->d_name, CVS_PATH_ATTIC)) {
+ cvs_repository_getdir(rpath, wdir, fl, dl,
+ REPOSITORY_IS_ATTIC);
+ } else {
cvs_file_get(fpath, 0, dl);
+ }
break;
case CVS_FILE:
if ((s = strrchr(fpath, ',')) != NULL &&
s != fpath && !strcmp(s, RCS_FILE_EXT)) {
*s = '\0';
- cvs_file_get(fpath, 0, fl);
+ cvs_file_get(fpath,
+ (flags & REPOSITORY_IS_ATTIC) ?
+ FILE_INSIDE_ATTIC : 0, fl);
}
break;
default:
diff --git a/usr.bin/cvs/repository.h b/usr.bin/cvs/repository.h
index 7ac540e02dd..bcf47e043fe 100644
--- a/usr.bin/cvs/repository.h
+++ b/usr.bin/cvs/repository.h
@@ -22,6 +22,9 @@
#define CVS_LOCK_SLEEP 30
#define CVS_LOCK_TRIES 5
+#define REPOSITORY_DODIRS 0x01
+#define REPOSITORY_IS_ATTIC 0x02
+
extern struct cvs_wklhead repo_locks;
void cvs_repository_unlock(const char *);