Index: modules/cvslog/cvs.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cvslog/cvs.module,v
retrieving revision 1.100
diff -u -F^f -r1.100 cvs.module
--- modules/cvslog/cvs.module	19 May 2006 11:27:35 -0000	1.100
+++ modules/cvslog/cvs.module	20 May 2006 07:11:10 -0000
@@ -252,6 +252,24 @@ function cvs_settings() {
     '#options' => array(t('Disabled'), t('Enabled')),
     '#description' => t('When enabled, this will store log messages in a temporary file to reduce memory consumption.'),
   );
+  $result = db_query("SELECT * FROM {cvs_repositories} ORDER BY rid");
+  while ($repo = db_fetch_object($result)) {
+    $options[$repo->rid] = $repo->name;
+  }
+  $form['cvs_default_repo'] = array(
+    '#title' => t('Default CVS repository for projects'),
+    '#type' => 'radios',
+    '#options' => $options,
+    '#default_value' => variable_get('cvs_default_repo', 1),
+    '#description' => t('Choose the repository that should be used by default when projects are being edited'),
+  );
+  $form['cvs_allow_repo_selection'] = array(
+    '#title' => t('Projects that can select their CVS repository'),
+    '#type' => 'textfield',
+    '#autocomplete_path' => 'project/autocomplete',
+    '#default_value' => variable_get('cvs_allow_repo_selection', ''),
+    '#description' => t('This comma-separated list of project titles controls which projects are allowed to select their CVS repository. Any projects not listed here will automatically use the default repository.'),
+  );
 
   return $form;
 }
@@ -309,13 +327,15 @@ function cvs_form_alter($form_id, &$form
       $repositories[$repository->rid] = $repository->name;
     }
     $form['cvs_nodeapi'] = array('#type' => 'fieldset', '#title' => t('CVS integration'));
-    $form['cvs_nodeapi']['repository']  = array(
+    $projects_allowing_repo = explode(',', strtolower(variable_get('cvs_allow_repo_selection', '')));
+    $allow_repo = in_array(strtolower($node->title), $projects_allowing_repo);
+    $default_repo = $node->cvs_repository ? $node->cvs_repository : variable_get('cvs_default_repo', 1);
+    $form['cvs_nodeapi']['cvs_repository'] = array(
       '#type' => 'select', 
       '#title' => t('Repository'), 
-      '#default_value' => $node->cvs_repository, 
-      '#options' => $repositories, 
+      '#default_value' => $default_repo,
+      '#options' => $allow_repo ? $repositories : array($repositories[$default_repo]),
       '#description' => t("Specify the project's CVS repository."), 
-      '#multiple' => TRUE,
     );
     $form['cvs_nodeapi']['cvs_directory'] = array(
       '#type' => 'textfield',
Index: modules/project/project.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/project.module,v
retrieving revision 1.239
diff -u -F^f -r1.239 project.module
--- modules/project/project.module	16 May 2006 08:15:17 -0000	1.239
+++ modules/project/project.module	20 May 2006 07:11:11 -0000
@@ -367,6 +367,12 @@ function project_menu($may_cache) {
       'access' => $access,
       'type' => MENU_CALLBACK);
 
+    $items[] = array('path' => 'project/autocomplete',
+      'title' => t('autocomplete project'),
+      'callback' => 'project_autocomplete',
+      'access' => $access,
+      'type' => MENU_CALLBACK);
+
     // Project browsing pages
     if (module_exist('taxonomy')) {
       $terms = taxonomy_get_tree(_project_get_vid());
@@ -1031,3 +1037,35 @@ function theme_project_type($term) {
   }
   return $output;
 }
+
+/**
+ * Returns a string of valid project names formatted to be suitable
+ * for use with JS autocomplete fields. 
+ */
+function project_autocomplete($string) {
+
+  // The user enters a comma-separated list of project names. We only
+  // autocomplete the last one.  This code is stolen heavily from 
+  // taxonomy_autocomplete().
+
+  // This regexp allows the following types of user input:
+  // this, "somecmpany, llc", "and ""this"" w,o.rks", foo bar
+  $regexp = '%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x';
+  preg_match_all($regexp, $string, $matches);
+  $array = $matches[1];
+
+  // Fetch last project
+  $last_string = trim(array_pop($array));
+
+  if ($last_string != '') {
+    $result = db_query_range("SELECT n.title FROM {node} n INNER JOIN {project_projects} p ON n.nid = p.nid WHERE LOWER(n.title) LIKE LOWER('%%%s%%')", $last_string, 0, 10);
+    $prefix = count($array) ? implode(', ', $array) .', ' : '';
+    $matches = array();
+    while ($project = db_fetch_object($result)) {
+      $t = $project->title;
+      $matches[$prefix . $t] = check_plain($project->title);
+    }
+    print drupal_to_js($matches);
+    exit();
+  }
+}
