diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2006-05-30 21:32:53 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2006-05-30 21:32:53 +0000 |
commit | f7e543c9413a632a7869f451136f104056a9a934 (patch) | |
tree | f1550d664e8eea31c2987547cf051667fb59ec47 /usr.bin/cvs | |
parent | 1dd44c7700dd786d40d48ae0f90537f2a5d65e01 (diff) |
fill in the correct revision number we will want in file_rcsrev
for each cvs_file struct, this will help us with sticky tags,
commiting to branches and importing into existing repositories.
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/add.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/commit.c | 6 | ||||
-rw-r--r-- | usr.bin/cvs/diff.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/file.c | 21 | ||||
-rw-r--r-- | usr.bin/cvs/file.h | 5 | ||||
-rw-r--r-- | usr.bin/cvs/remove.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/status.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/update.c | 14 |
8 files changed, 35 insertions, 27 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c index 92478a002b8..cef95503659 100644 --- a/usr.bin/cvs/add.c +++ b/usr.bin/cvs/add.c @@ -1,4 +1,4 @@ -/* $OpenBSD: add.c,v 1.50 2006/05/30 09:11:24 xsa Exp $ */ +/* $OpenBSD: add.c,v 1.51 2006/05/30 21:32:52 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -82,7 +82,7 @@ cvs_add_local(struct cvs_file *cf) { cvs_log(LP_TRACE, "cvs_add_local(%s)", cf->file_path); - cvs_file_classify(cf, 0); + cvs_file_classify(cf, NULL, 0); /* dont use `cvs add *' */ if (strcmp(cf->file_name, ".") == 0 || diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c index 80a78dae576..26a57c708bf 100644 --- a/usr.bin/cvs/commit.c +++ b/usr.bin/cvs/commit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: commit.c,v 1.64 2006/05/30 04:20:27 joris Exp $ */ +/* $OpenBSD: commit.c,v 1.65 2006/05/30 21:32:52 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -113,7 +113,7 @@ cvs_commit_check_conflicts(struct cvs_file *cf) * cvs_file_classify makes the noise for us * XXX - we want that? */ - cvs_file_classify(cf, 1); + cvs_file_classify(cf, NULL, 1); if (cf->file_type == CVS_DIR) { if (verbosity > 1) @@ -156,7 +156,7 @@ cvs_commit_local(struct cvs_file *cf) char *attic, *repo; cvs_log(LP_TRACE, "cvs_commit_local(%s)", cf->file_path); - cvs_file_classify(cf, 0); + cvs_file_classify(cf, NULL, 0); if (cf->file_type != CVS_FILE) fatal("cvs_commit_local: '%s' is not a file", cf->file_path); diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c index 6cf5f26e2ab..252b4990a1a 100644 --- a/usr.bin/cvs/diff.c +++ b/usr.bin/cvs/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.97 2006/05/29 07:17:30 joris Exp $ */ +/* $OpenBSD: diff.c,v 1.98 2006/05/30 21:32:52 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -124,7 +124,7 @@ cvs_diff_local(struct cvs_file *cf) return; } - cvs_file_classify(cf, 0); + cvs_file_classify(cf, NULL, 0); if (cf->file_status == FILE_LOST) { cvs_log(LP_ERR, "cannot find file %s", cf->file_path); diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index 01303ce9658..310dd42faae 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.152 2006/05/30 19:16:51 joris Exp $ */ +/* $OpenBSD: file.c,v 1.153 2006/05/30 21:32:52 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -537,7 +537,7 @@ cvs_file_freelist(struct cvs_flisthead *fl) } void -cvs_file_classify(struct cvs_file *cf, int loud) +cvs_file_classify(struct cvs_file *cf, const char *tag, int loud) { size_t len; time_t mtime; @@ -639,10 +639,17 @@ cvs_file_classify(struct cvs_file *cf, int loud) } } + if (tag != NULL && cf->file_rcs != NULL) + cf->file_rcsrev = rcs_translate_tag(tag, cf->file_rcs); + else if (cf->file_rcs != NULL) + cf->file_rcsrev = cf->file_rcs->rf_head; + else + cf->file_rcsrev = NULL; + if (cf->file_ent != NULL) rcsnum_tostr(cf->file_ent->ce_rev, r1, sizeof(r1)); - if (cf->file_rcs != NULL) - rcsnum_tostr(cf->file_rcs->rf_head, r2, sizeof(r2)); + if (cf->file_rcsrev != NULL) + rcsnum_tostr(cf->file_rcsrev, r2, sizeof(r2)); ismodified = rcsdead = 0; if (cf->fd != -1 && cf->file_ent != NULL) { @@ -658,11 +665,11 @@ cvs_file_classify(struct cvs_file *cf, int loud) } if (ismodified == 1 && cf->fd != -1 && cf->file_rcs != NULL) { - b1 = rcs_getrev(cf->file_rcs, cf->file_rcs->rf_head); + b1 = rcs_getrev(cf->file_rcs, cf->file_rcsrev); if (b1 == NULL) fatal("failed to get HEAD revision for comparison"); - b1 = rcs_kwexp_buf(b1, cf->file_rcs, cf->file_rcs->rf_head); + b1 = rcs_kwexp_buf(b1, cf->file_rcs, cf->file_rcsrev); /* XXX */ b2 = cvs_buf_load(cf->file_path, BUF_AUTOEXT); @@ -677,7 +684,7 @@ cvs_file_classify(struct cvs_file *cf, int loud) } if (cf->file_rcs != NULL) { - state = rcs_state_get(cf->file_rcs, cf->file_rcs->rf_head); + state = rcs_state_get(cf->file_rcs, cf->file_rcsrev); if (state == NULL) fatal("failed to get state for HEAD for %s", cf->file_path); diff --git a/usr.bin/cvs/file.h b/usr.bin/cvs/file.h index 017b39231f7..00f5854de27 100644 --- a/usr.bin/cvs/file.h +++ b/usr.bin/cvs/file.h @@ -1,4 +1,4 @@ -/* $OpenBSD: file.h,v 1.36 2006/05/28 17:25:18 joris Exp $ */ +/* $OpenBSD: file.h,v 1.37 2006/05/30 21:32:52 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -42,6 +42,7 @@ struct cvs_file { int file_status; int file_flags; + RCSNUM *file_rcsrev; RCSFILE *file_rcs; struct cvs_ent *file_ent; }; @@ -93,7 +94,7 @@ TAILQ_HEAD(ignore_head, cvs_ignpat); void cvs_file_init(void); void cvs_file_ignore(const char *, struct ignore_head *); -void cvs_file_classify(struct cvs_file *, int); +void cvs_file_classify(struct cvs_file *, const char *, int); void cvs_file_free(struct cvs_file *); void cvs_file_run(int, char **, struct cvs_recursion *); void cvs_file_walklist(struct cvs_flisthead *, struct cvs_recursion *); diff --git a/usr.bin/cvs/remove.c b/usr.bin/cvs/remove.c index 2ab36aaf2b6..97a949bd1cb 100644 --- a/usr.bin/cvs/remove.c +++ b/usr.bin/cvs/remove.c @@ -1,4 +1,4 @@ -/* $OpenBSD: remove.c,v 1.49 2006/05/30 21:00:42 joris Exp $ */ +/* $OpenBSD: remove.c,v 1.50 2006/05/30 21:32:52 joris Exp $ */ /* * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> * @@ -108,7 +108,7 @@ cvs_remove_local(struct cvs_file *cf) return; } - cvs_file_classify(cf, 0); + cvs_file_classify(cf, NULL, 0); if (force_remove == 1) { if (unlink(cf->file_path) == -1) diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c index 25d505cb1eb..737f9b082ea 100644 --- a/usr.bin/cvs/status.c +++ b/usr.bin/cvs/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.60 2006/05/30 07:24:08 xsa Exp $ */ +/* $OpenBSD: status.c,v 1.61 2006/05/30 21:32:52 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -102,7 +102,7 @@ cvs_status_local(struct cvs_file *cf) cvs_log(LP_TRACE, "cvs_status_local(%s)", cf->file_path); - cvs_file_classify(cf, 1); + cvs_file_classify(cf, NULL, 1); if (cf->file_type == CVS_DIR) { if (verbosity > 1) diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c index a3ee80418a1..a299e403155 100644 --- a/usr.bin/cvs/update.c +++ b/usr.bin/cvs/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.67 2006/05/28 17:25:18 joris Exp $ */ +/* $OpenBSD: update.c,v 1.68 2006/05/30 21:32:52 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -113,7 +113,7 @@ cvs_update_enterdir(struct cvs_file *cf) cvs_log(LP_TRACE, "cvs_update_enterdir(%s)", cf->file_path); - cvs_file_classify(cf, 0); + cvs_file_classify(cf, NULL, 0); if (cf->file_status == DIR_CREATE && build_dirs == 1) { cvs_mkpath(cf->file_path); @@ -241,7 +241,7 @@ cvs_update_local(struct cvs_file *cf) * which is called from cvs_checkout_file(). */ bp = NULL; - cvs_file_classify(cf, 1); + cvs_file_classify(cf, NULL, 1); switch (cf->file_status) { case FILE_UNKNOWN: @@ -269,20 +269,20 @@ cvs_update_local(struct cvs_file *cf) case FILE_LOST: case FILE_CHECKOUT: case FILE_PATCH: - bp = rcs_getrev(cf->file_rcs, cf->file_rcs->rf_head); + bp = rcs_getrev(cf->file_rcs, cf->file_rcsrev); if (bp == NULL) fatal("cvs_update_local: failed to get HEAD"); - cvs_checkout_file(cf, cf->file_rcs->rf_head, bp, 0); + cvs_checkout_file(cf, cf->file_rcsrev, bp, 0); cvs_printf("U %s\n", cf->file_path); break; case FILE_MERGE: bp = cvs_diff3(cf->file_rcs, cf->file_path, - cf->file_ent->ce_rev, cf->file_rcs->rf_head, 1); + cf->file_ent->ce_rev, cf->file_rcsrev, 1); if (bp == NULL) fatal("cvs_update_local: failed to merge"); - cvs_checkout_file(cf, cf->file_rcs->rf_head, bp, CO_MERGE); + cvs_checkout_file(cf, cf->file_rcsrev, bp, CO_MERGE); if (diff3_conflicts != 0) { cvs_printf("C %s\n", cf->file_path); |