Index: modules/cvslog/xcvs/xcvs-loginfo.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/cvslog/xcvs/xcvs-loginfo.php,v retrieving revision 1.7 diff -u -p -r1.7 xcvs-loginfo.php --- modules/cvslog/xcvs/xcvs-loginfo.php 13 Jan 2007 03:57:05 -0000 1.7 +++ modules/cvslog/xcvs/xcvs-loginfo.php 21 Jan 2007 18:00:39 -0000 @@ -207,7 +207,7 @@ function xcvs_init($argc, $argv) { $connection = xcvs_db_connect($xcvs); // Lock the affected tables so avoid clashes (transactions): - mysql_query('LOCK TABLES cvs_messages, cvs_files, cvs_users'); + mysql_query('LOCK TABLES cvs_messages, cvs_files, cvs_users, cvs_tags'); $cid = mysql_result(mysql_query("SELECT id FROM sequences WHERE name = 'cvs_messages_cid'"), 0) + 1; mysql_query("REPLACE INTO sequences VALUES ('cvs_messages_cid', $cid)"); @@ -222,6 +222,19 @@ function xcvs_init($argc, $argv) { else $nid = 0; mysql_query("INSERT INTO cvs_files (cid, rid, uid, nid, file, branch, revision, lines_added, lines_removed) VALUES ($cid, $xcvs[cvs_repo_id], $uid, $nid, '$cvslog_file->file', '$tag', '$cvslog_file->revision', $cvslog_file->lines_added, $cvslog_file->lines_removed)"); + + if (!empty($tag)) { + // Since people refuse to learn how to use "cvs tag -b" to + // add branches, we have an additional check here to try + // to keep the {cvs_tags} table accurate. Every time + // someone commits a file to a branch, we make sure + // there's a valid entry in {cvs_tags} for that project + + // branch, and if not, we add it here. + $db_tag = mysql_query("SELECT * from cvs_tags WHERE nid = $nid AND tag = '" . mysql_escape_string($tag) . "'"); + if (!($db_tag && mysql_num_rows($db_tag) > 0)) { + mysql_query("INSERT INTO cvs_tags (nid, branch, tag) VALUES ($nid, 1, '" . mysql_escape_string($tag) . "')"); + } + } } // Lock the affected tables so avoid clashes (transactions):