From 3901dfa5eef7af01847d8f8fe385eb2c6392a158 Mon Sep 17 00:00:00 2001 From: joris Date: Mon, 18 Jun 2007 17:54:12 +0000 Subject: first stab at history stuff for opencvs, currently only writes to CVSROOT/history but cannot parse it yet with the 'history' command. "Commit it." ray@ --- usr.bin/cvs/commit.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'usr.bin/cvs/commit.c') diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c index 4c68519b07f..2d686047b7a 100644 --- a/usr.bin/cvs/commit.c +++ b/usr.bin/cvs/commit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: commit.c,v 1.106 2007/06/01 17:47:47 niallo Exp $ */ +/* $OpenBSD: commit.c,v 1.107 2007/06/18 17:54:13 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink * Copyright (c) 2006 Xavier Santolaria @@ -207,7 +207,7 @@ void cvs_commit_local(struct cvs_file *cf) { BUF *b, *d; - int isnew; + int isnew, histtype; RCSNUM *head; int openflags, rcsflags; char rbuf[24], nbuf[24]; @@ -223,6 +223,13 @@ cvs_commit_local(struct cvs_file *cf) if (cf->file_type != CVS_FILE) fatal("cvs_commit_local: '%s' is not a file", cf->file_path); + if (cf->file_status != FILE_MODIFIED && + cf->file_status != FILE_ADDED && + cf->file_status != FILE_REMOVED) { + cvs_log(LP_ERR, "skipping bogus file `%s'", cf->file_path); + return; + } + if (cf->file_status == FILE_MODIFIED || cf->file_status == FILE_REMOVED || (cf->file_status == FILE_ADDED && cf->file_rcs != NULL && cf->file_rcs->rf_dead == 1)) { @@ -379,6 +386,20 @@ cvs_commit_local(struct cvs_file *cf) cvs_log(LP_NOTICE, "checking in '%s'; revision %s -> %s", cf->file_path, rbuf, nbuf); } + + switch (cf->file_status) { + case FILE_MODIFIED: + histtype = CVS_HISTORY_COMMIT_MODIFIED; + break; + case FILE_ADDED: + histtype = CVS_HISTORY_COMMIT_ADDED; + break; + case FILE_REMOVED: + histtype = CVS_HISTORY_COMMIT_REMOVED; + break; + } + + cvs_history_add(histtype, cf, NULL); } static BUF * -- cgit v1.2.3-59-g8ed1b