cvs diff: Diffing modules/cvslog
Index: modules/cvslog/README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cvslog/README.txt,v
retrieving revision 1.3.2.1
diff -u -F^f -r1.3.2.1 README.txt
--- modules/cvslog/README.txt 21 Jun 2006 22:57:07 -0000 1.3.2.1
+++ modules/cvslog/README.txt 4 Oct 2006 22:42:54 -0000
@@ -16,5 +16,10 @@
* Each commit message can be modified in a theme_cvs_entry($cvs) function,
the parameter is an object containing user, timestamp, and message.
+Site-specific customization:
+ * Parts of this code are very specific to how this module is used
+ on drupal.org. I'm trying to isolate as many of these
+ site-specific hacks as possible into the cvs_local.inc file.
+
Note that you must customize the xcvs/xcvs-config.php file if you wish
to use those scripts on your site. See xcvs/README.txt for details.
Index: modules/cvslog/cvs.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cvslog/cvs.module,v
retrieving revision 1.106.2.19
diff -u -F^f -r1.106.2.19 cvs.module
--- modules/cvslog/cvs.module 18 Sep 2006 10:37:43 -0000 1.106.2.19
+++ modules/cvslog/cvs.module 4 Oct 2006 22:42:55 -0000
@@ -17,6 +17,11 @@
define('CVS_MESSAGE_ANON', 'The Concurrent Versioning System (CVS) is a software development tool available to volunteers with experience in software development, translation, themeing, or documentation who wish to participate in the Drupal project. To request access to the Drupal CVS repository you must create an account and login. Come back to this page after you have logged on.');
define('CVS_MESSAGE_AUTH', 'The Concurrent Versioning System (CVS) is a software development tool used to manage programs and files for the Drupal project. It is available to volunteers with experience in software development, translation, themeing, or documentation who wish to participate in the project. If you are an Open Source software developer, themer, translator, or documentation writer, you can use the form below to request access to Drupal\'s CVS repository. Note that there are two repositories, core and contributions. Access to the Drupal core repository is only available to a handful of people, and CVS access is not required to contribute patches to core. For that, you should submit an issue into the issue queue for Drupal core. You are also not allowed to commit patches to modules maintained by other people without obtaining permission from them to do so. Please do not duplicate modules that overlap with a significant portion of functionality with what you are proposing to write.');
+$path = drupal_get_path('module', 'cvs');
+if (file_exists("$path/cvs_local.inc")) {
+ require_once "$path/cvs_local.inc";
+}
+
/**
* Implementation of hook_help().
*/
@@ -384,39 +389,132 @@ function cvs_nodeapi(&$node, $op, $arg =
*/
function cvs_form_alter($form_id, &$form) {
if ($form_id == 'project_project_node_form') {
- $node = $form['#node'];
- $result = db_query("SELECT rid, name FROM {cvs_repositories}");
- while ($repository = db_fetch_object($result)) {
- $repositories[$repository->rid] = $repository->name;
- }
- $form['cvs_nodeapi'] = array(
- '#type' => 'fieldset',
- '#title' => t('CVS integration'),
- '#collapsible' => TRUE,
- '#collapsed' => $node->cvs_directory ? TRUE : FALSE,
- );
- $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', '');
- if (!empty($repositories)) {
- $form['cvs_nodeapi']['cvs_repository'] = array(
- '#type' => 'select',
- '#title' => t('Repository'),
- '#default_value' => $default_repo,
- '#options' => $allow_repo ? $repositories : array($default_repo => $repositories[$default_repo]),
- '#description' => t("Specify the project's CVS repository."),
- );
- }
- $form['cvs_nodeapi']['cvs_directory'] = array(
- '#type' => 'textfield',
- '#title' => t('CVS directory'),
- '#default_value' => $node->cvs_directory,
- '#size' => 40,
- '#maxlength' => 255,
- '#description' => t("Specify the project's directory within the specified CVS repository. Directory names should start with a leading slash and end with a trailing slash, and must be unique for each project. For example: /modules/foo/, /themes/foo/ or /translations/foo/."),
+ return cvs_alter_project_project_form($form);
+ }
+ if ($form_id == 'project_release_node_form') {
+ return cvs_alter_project_release_form($form);
+ }
+}
+
+/**
+ * Alters the project_project node form to add CVS integration
+ * @see cvs_form_alter
+ */
+function cvs_alter_project_project_form(&$form) {
+ $node = $form['#node'];
+ $result = db_query("SELECT rid, name FROM {cvs_repositories}");
+ while ($repository = db_fetch_object($result)) {
+ $repositories[$repository->rid] = $repository->name;
+ }
+ $form['cvs_nodeapi'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('CVS integration'),
+ '#collapsible' => TRUE,
+ '#collapsed' => $node->cvs_directory ? TRUE : FALSE,
+ );
+ $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', '');
+ if (!empty($repositories)) {
+ $form['cvs_nodeapi']['cvs_repository'] = array(
+ '#type' => 'select',
+ '#title' => t('Repository'),
+ '#default_value' => $default_repo,
+ '#options' => $allow_repo ? $repositories : array($default_repo => $repositories[$default_repo]),
+ '#description' => t("Specify the project's CVS repository."),
+ );
+ }
+ $form['cvs_nodeapi']['cvs_directory'] = array(
+ '#type' => 'textfield',
+ '#title' => t('CVS directory'),
+ '#default_value' => $node->cvs_directory,
+ '#size' => 40,
+ '#maxlength' => 255,
+ '#description' => t("Specify the project's directory within the specified CVS repository. Directory names should start with a leading slash and end with a trailing slash, and must be unique for each project. For example: /modules/foo/, /themes/foo/ or /translations/foo/."),
+ '#required' => TRUE,
+ );
+}
+
+/**
+ * Alters the project_release node to add build tag UI
+ * @see cvs_form_alter
+ */
+function cvs_alter_project_release_form(&$form) {
+ $release = $form['#node'];
+ $project = $form['project']['#value'];
+
+ if (!isset($project->releases)) {
+ // This project has no releases, nothing to alter
+ return $form;
+ }
+
+ $tags = array();
+ $tags['Tags'] = array();
+ $tags['Branches']['TRUNK'] = 'TRUNK';
+ $result = db_query("SELECT c.nid, c.tag, c.branch FROM {cvs_tags} c LEFT JOIN {project_release_nodes} p ON c.nid = p.pid AND p.tag = c.tag WHERE c.nid = %d AND p.tag IS NULL ORDER BY c.tag DESC", $release->pid);
+ while ($tag = db_fetch_object($result)) {
+ $version = project_release_get_version(cvs_get_version_from_tag($tag, $project), $project);
+ if ($tag->branch) {
+ $tags['Branches'][$tag->tag] = $tag->tag .' ('. $version .')';
+ }
+ else {
+ $tags['Tags'][$tag->tag] = $tag->tag .' ('. $version .')';
+ }
+ }
+
+ // TODO: have to handle the TRUNK special case (allow you to specify
+ // the version, change the tag from TRUNK to the appropriate branch
+ // later, etc)...
+ // TODO: in fact, this all needs to be a multi-page form
+
+ if (!empty($tags)) {
+ $form['cvs_tag'] = array(
+ '#type' => 'select',
+ '#title' => t('CVS tag'),
+ '#options' => $tags,
+ '#weight' => -10,
'#required' => TRUE,
+ '#description' => t("Select the CVS tag (and therefore version number) for this release."),
);
}
+ else {
+ drupal_set_message(t('WARNING: There are no CVS tags for this module that do not already have a release associated with them'));
+ // TODO: print out something reasonable
+ }
+
+ // Clear out all the existing verison number field UI elements
+ $form['version_super_major'] = array(
+ '#type' => 'value',
+ '#value' => $release->version_super_major,
+ );
+ $form['version_super_minor'] = array(
+ '#type' => 'value',
+ '#value' => $release->version_super_minor,
+ );
+ $form['version_major'] = array(
+ '#type' => 'value',
+ '#value' => $release->version_major,
+ );
+ $form['version_minor'] = array(
+ '#type' => 'value',
+ '#value' => $release->version_minor,
+ );
+ $form['version_patch'] = array(
+ '#type' => 'value',
+ '#value' => $release->version_patch,
+ );
+ $form['version_extra'] = array(
+ '#type' => 'value',
+ '#value' => $release->version_extra,
+ );
+ // We also want to clear out the file upload UI element, since we'll
+ // automaticaly create the file based on the tag.
+ // TODO: this should be optional, per project, set by admin.
+ $form['file'] = array(
+ '#type' => 'value',
+ '#value' => $release->file_path,
+ );
+
}
/**
Index: modules/cvslog/cvs_local.inc
===================================================================
RCS file: modules/cvslog/cvs_local.inc
diff -N modules/cvslog/cvs_local.inc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/cvslog/cvs_local.inc 4 Oct 2006 22:42:55 -0000
@@ -0,0 +1,58 @@
+tag);
+ $super = explode('-', $super_ver, 5);
+ $base = empty($base_ver) ? array() : explode('-', $base_ver);
+
+ if ($project->nid == 3060) {
+ if (isset($super[3])) {
+ // Looks like "DRUPAL-X-Y-Z", must be a release tag from before 5.x.
+ // Ignore the 'DRUPAL' part in $super[0]
+ $version->version_major = $super[1];
+ $version->version_minor = $super[2];
+ $version->version_patch = $super[3];
+ $version->version_extra = $super[4];
+ }
+ else {
+ // Looks like "DRUPAL-X-Y", could be either "DRUPAL-4-7" (branch) or
+ // "DRUPAL-5-0" (the 5.0 release tag). Use $tag->branch to decide.
+ if ($tag->branch) {
+ $version->version_major = $super[1];
+ $version->version_minor = $super[2];
+ $version->version_patch = 'x';
+ $version->version_extra = 'branch';
+ }
+ else {
+ $version->version_major = $super[1];
+ $version->version_patch = $super[2];
+ }
+ }
+ }
+ else {
+ // Contrib tags don't need any special cases
+ $version->version_super_major = $super[1];
+ $version->version_super_minor = $super[2];
+ $version->version_major = $base[0] ? $base[0] : 0;
+ $version->version_patch = $tag->branch ? 'X' : $base[1];
+ $version->version_extra = $tag->branch ? 'branch' : $base[2];
+ }
+ // TODO: add code to validate we parsed something reasonable, and ignore bad tags.
+ return $version;
+}
+
cvs diff: Diffing modules/cvslog/xcvs