Contributing a Module with TortoiseCVS

This article is largely taken from http://drupal.org/node/112902. The following is essentially a walk-through focusing on the actual process involved when submitting modules to Drupal.org using TortoiseCVS. This is by no means a detailed CVS guide and I am not a CVS expert.

It is highly recommended that you read the detailed CVS instructions in the Drupal Handbook at some point. This guide is for Windows users and a CVS client is used, so you don't have to use command-line. There are decent instructions already available for Linux users. There is also a video available to help you out.

I also recommend that you familiarize yourself with the Drupal coding standards. I then suggest you download and install the Coder module for checking your application of the standards. [I now consider a Coder review a necessary step before committing changes.] Then it's always nice to at least lay the groundwork for translation of your module, so check out the Translation Template Extractor module. There will be more on this later.

The assumption is that a stable release will be submitted, meaning that the module has been tested thoroughly (preferably by others), the PHP code has been checked for security vulnerabilities, the CSS has been validated etc, and the module is ready to share with the Drupal community. Also make sure you have decided on the directory structure for your module. Renaming files in CVS is hard, and moving around directories is really hard (without the help of the extremely busy CVS admins). If you have your directories structured and files named how you want them before your first CVS commit, you will save yourself (and those busy admins) a ton of grief.

Adding a module to Drupal CVS

  1. First you will need to apply for a CVS account with Drupal.org.
  2. After you have installed TortoiseCVS, browse to the folder that contains all of the files for your module. The commands for TortoiseCVS are accessed via the context menu when you right-click on a folder.
  3. Right-click the folder for your module. Select CVS > Make New Module. Make sure that Password server (:pserver:) is selected for Protocol:. For CVSROOT: copy and paste or type the following line, replacing "username" with your username for your CVS account with Drupal (note: username is case-sensitive).
  4. :pserver:username@cvs.drupal.org:/cvs/drupal-contrib

  5. For the Module: field, copy and paste or type in the following line replacing "modulename" with the name of your module. This should match the name of the folder which contains your module files:
  6. contributions/modules/modulename

    Press OK. TortoiseCVS will do its thing and should report that the operation was successful. This has created a directory in Drupal CVS to contain the files for your module. You can verify that the directory was created by visiting the Index of contributions.

  7. Time to add the files. Right-click on the module folder again and select CVS Add Contents. All of the files in your module folder will be selected automatically. Press OK.
  8. Now the files have to be committed. Open the folder for your module. You will see orange plus signs on all of the files indicating that they have been added. Select these files, right-click and choose CVS Commit. In the Comment field, add something like "Initial Release for Drupal 5.0" and press OK. If your module folder contains sub-folders i.e. "/images" etc. you may need to repeat this procedure for all of the files in each sub-folder since the commit command is not always recursive.
  9. When this is complete, the module has been registered on Drupal CVS.

    Creating a project for your module on Drupal.org

  10. It is now time to add your project on Drupal.org. Login to your account. Click on Create content > Project. Most of the fields on the Submit project form should be self-explanatory. The Short project name should match the name of the folder that contains your module files. For CVS tree, use the following URL and replace "modulename" with the short project name you entered earlier:
  11. http://cvs.drupal.org/viewcvs/drupal/contributions/modules/modulename

    After everything applicable has been filled in, click Submit. Don't worry, you can come back and fill in missing details later.

  12. You now need to return to CVS to create a CVS tag for the specific version of the module you are releasing. This helps to keep track of different releases. Since this is the initial stable release you will start with 1.0. Use one of the following tags below depending on the version of Drupal:
    DRUPAL-6--1-0
    DRUPAL-5--1-0
    DRUPAL-4-7--1-0
  13. Now to add the release that was uploaded to CVS earlier. This is an easy step to forget, but don't or you will have wasted all your time. Click the Add new release link for your project - the one on the project page (the "create content » release" doesn't do it). Select the appropriate CVS identifier. The next screen is fairly self-explanatory. Click Submit.

That's it! Whew! Now your module is officially managed through Drupal CVS and included as a project on Drupal.org. If you want to add a screenshot, first read the Theme screenshot guidelines. You will need to Submit an issue with the Drupal.org webmasters in order to have your screenshot added.

So there you have it. Ten "easy" steps to add your module to Drupal. Perhaps not that easy, but it is to be expected that there will be some tedious procedures to deal with in order to keep the quality of contributions high while maintaining a community effort like Drupal. Hopefully this has been informative and will save some time and headache for people who aren't familiar with CVS but would like to contribute a Drupal module. Again, it is recommended that you read through the Drupal handbook so that you have a more complete understanding of CVS; here is a good place to start.

Needs a little edit

add1sun - November 18, 2007 - 16:13

Great page but it needs a bit of a rearrangement according to the Module Maintainer guide Create a CVS project that states:

Please note that you must create a project node before you add any CVS tags or branches to your contribution, or you will run into errors when you try to make releases.

So we need to move the branching and tagging after the node creation part. I'm leaving this as a comment so others will know this when they go through this. I'll try to make the edits within the next day or so and then remove this comment when done.

Hmm...

NancyDru - November 18, 2007 - 16:35

Are you sure that is correct any more? I've added 6 modules following this process and not had any problems.

I have seen some changes that seem to have been made since the original source of this post, which would also need this change.

I'll be happy to move that part if we know it is still correct to do so.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

May be a problem

alexj - March 5, 2008 - 00:18

I followed these instructions exactly and I was unable to create a release. After re-tagging it worked fine, but I'd recommend creating the project page first, just in case.

I understand

NancyDru - March 5, 2008 - 03:08

The powers-that-be changed this page without consulting with me and deliberately took a major necessary step out. For those who read this, I can tell you it no longer works - you must create a branch before you create a tag.

No branch needed

add1sun - March 5, 2008 - 13:57

No you don't need to make a branch to tag. You can tag directly from HEAD and if you only have one version of your module when you start (e.g. only Drupal 6) then this is the simplest thing to do and you can wait to branch until you make a new version. Using HEAD (and not a branch) for the code that is currently compatible with the latest version of Drupal is definitely one of the primary ways to use HEAD and by most "CVS gurus" is considered best practice.

The CVS docs are on deck for a major reorg/rewrite in the next few weeks so hopefully we can make all of this information clearer and presented in a flow that is much less confusing for everyone.

Lullabot loves you | Be a Ninja, join the Drupal Dojo

And...

NancyDru - March 5, 2008 - 17:35

For those of us who are maintaining both a 5.x version and a 6.x version, not creating a branch causes unpredictable code mixing. I tried to create a new module with the instructions as they exist now, and both versions got clobbered. The only thing that fixed it was creating branches for both versions.

Remember to open CVS Port

Drupal-id.com - June 5, 2008 - 06:46

I can not create new module, and i found that since we use pserver (Password Server) for CVS's protocol then we need to open port 2401.
Check your firewall setting.

 
 

Drupal is a registered trademark of Dries Buytaert.