I need to create a 6.x branch of my module.

The 5.x version of the module is on my local filesystem here:

  contributions/modules/og_user_roles

My typical procedure for creating a new 5.x release:

cvs login
[root@db module_downloads]# cd contributions
[root@db contributions]# cd modules
[root@db modules]# cd og_user_roles
[root@db og_user_roles]# cvs update -dP -r DRUPAL-5
[root@db og_user_roles]# cvs commit -m "#156939: CVS Version of og_user_roles not updating."
[root@db og_user_roles]# cvs tag DRUPAL-5--1-5

Now, I wish to maintain the 5.x version, but add a 6.x branch.

I've pretty much figured out that the "branch" command is something like:

cvs co -d mymodule-1.2 -r BRANCH-VERSION-1.2 mymodule 
(http://docs.fedoraproject.org/documentation-guide/en_US/sn-cvs-cvscommands.html)
cvs checkout -r DRUPAL-4-7 contributions/modules/fileshare
(http://drupal.org/node/17570#comment-135324)
cvs tag -b DRUPAL-6--1 modules/example
(http://drupal.org/handbook/cvs/quickstart#before-branching)
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-5--1-0 -d moduleName contributions/modules/moduleName
(http://drupal.org/node/261297)

What I can't seem to figure out is:
a. *which* command to use
b. *where* I need to be on my local filesystem when I execute one of these commands, and
c. *where* the 6.x files need to physically be on my local filesystem

I've read a bunch of documentation, including the handbook, but nothing that has helped me to figure out what needs to be where locally for branching to 6.x. I don't want to start doing a bunch of trial and error since this is a live module.

Can anyone help me with this?

Comments

jvandyk’s picture

Hi, SomebodySysop. From examining the repository here, it appears you have already created a Drupal 6 branch called DRUPAL-6--1. Good job.

So what you will want to do now is

1. Check out the files from the Drupal 6 branch to your local workspace.
2. Modify the files so that they contain the code that is compatible with Drupal 6.
3. Commit those files back to the repository, where they will appear on the Drupal 6 branch of the repository.

So all you really need to do is go to your local workspace and do that.

$ cd /my/local/workspace/og_user_roles
$ ls
CVS			README.txt		og_user_roles.info	og_user_roles.install	og_user_roles.module	og_users_roles.sql

This is showing the HEAD version of og_user_roles, because that's just what I happened to have on my machine. Now I am going to update the local workspace to have the 5.x-3.3 version of og_user_roles, just for fun.

$ cvs update -dP -r DRUPAL-5--3-3
cvs update: Updating .
P README.txt
U TAC_OG_README.txt
U node.module.multinode-5.10.patch
U node.module.multinode.patch
P og_user_roles.info
U og_user_roles.install
U og_user_roles.module
U og_user_roles.user.module.5.2.patch
U og_user_roles.user.module.5.3.patch
P og_users_roles.sql
$ ls
CVS					node.module.multinode-5.10.patch	og_user_roles.install			og_user_roles.user.module.5.3.patch
README.txt				node.module.multinode.patch		og_user_roles.module			og_users_roles.sql
TAC_OG_README.txt			og_user_roles.info			og_user_roles.user.module.5.2.patch

So now my local workspace contains the 5.x-3.3 version. Now I'm going to go ahead and put the latest version from the 6--1 branch into my workspace:

$ cvs update -dP -r DRUPAL-6--1
cvs update: Updating .
P README.txt
cvs update: `node.module.multinode-5.10.patch' is no longer in the repository
U node.module.multinode.patch
U og_user_roles.module
$ ls
CVS					node.module.multinode.patch		og_user_roles.module			og_users_roles.sql
README.txt				og_user_roles.info			og_user_roles.user.module.5.2.patch
TAC_OG_README.txt			og_user_roles.install			og_user_roles.user.module.5.3.patch

There we go. Now, I could open og_user_roles.module and replace the code inside with Drupal 6 code. And I'd probably want to get rid of some of the Drupal-5-specific stuff, like

$rm og_user_roles.user.module.5.2.patch
cvs delete og_user_roles.user.module.5.2.patch
cvs commit -m "Removed the 5.2 patch since this is the 6--1 branch."

And when you're all done editing the module, .info, .install and such and are all ready to put them on the 6--1 branch:

cvs commit -m "Drupal 6-compatible version"

Finally, when you're all ready to make a release for Drupal 6, you do it in the usual way by putting a DRUPAL-6--1-0 tag on the DRUPAL-6--1 branch:

cvs tag DRUPAL-6--1-0

Let me know if you have trouble with the above.

somebodysysop’s picture

I created the 6.x branch by accident.

I only have one question: It sounds like I need to use the same exact local workspace for the 5.x and 6.x commits. Is this correct?

That is, in your example, your local workspace is

/my/local/workspace/og_user_roles

When you want to update 5.x, you copy the 5.x files here? And, when you want to update 6.x, you copy the 6.x files to the same directory?

Or, do I create a different directory for 6.x?

This has been my biggest question from the start.

But, this step by step seems like it will get me way further than I am now. I really appreciate it.

jvandyk’s picture

You can have as many workspaces as you like on your local machine.

For example, you could check out the entire 6--1 branch of the contrib repository, find your module inside it, edit the code, and check it in from there.

Or you could go to your home directory, check out the 6--1 branch of your module only -- to your home directory, so you'd have a og_user_roles directory in your home directory. Then you could edit the code and check in from there.

You can make a workspace anywhere as long as you properly authenticate to the cvs pserver.

Honestly what I usually do is to copy the module directory into the Drupal site where I'm testing it. I keep a copy of the HEAD of the contributions repository on my local machine. So on my machine I do

cp -R ~/cvs/contributions/modules/modulename ~/Sites/drupal65/sites/all/modules/modulename

Then I double-check to make sure I'm working with the right branch!

cd ~/Sites/drupal65/sites/all/modules/modulename
cvs update -dP -r DRUPAL-6--1

That way I can run it inside the Drupal site, poke it, improve it, etc. Then when I'm ready to commit my code I do

cd ~/Sites/drupal65/sites/all/modules/modulename
cvs diff
cvs commit -m '#12345 by Futon: Add intergalactic death ray'

The cvs diff is in there to make sure I'm about to check in the changes I think I'm about to check in. The cvs status command is useful for that, too.

Chapter 21 of Pro Drupal Development, Second Edition covers this in detail. :)

somebodysysop’s picture

Thank you. I've actually been able to create the 6.x directory (workspace) using checkout. Now I'm ready to go. Just need to clean up the code in the module itself.

This was really helpful to me. Again, thank you so much.

somebodysysop’s picture

OK, created workspace. Copied correct files to it. Used "cvs remove" to delete unwanted files. Tagged it:

[root@db og_user_roles]# cvs tag -b DRUPAL-6--1
cvs tag: Tagging .
W README.txt : DRUPAL-6--1 already exists on branch 1.1.2.13.2.1 : NOT MOVING tag to branch 1.1.2.13.2.1.0.2
W node.module.multinode.patch : DRUPAL-6--1 already exists on branch 1.1.2.1.2.1 : NOT MOVING tag to branch 1.1.2.1.2.1.0.2
W og_user_roles.info : DRUPAL-6--1 already exists on branch 1.1.2.5.2.1 : NOT MOVING tag to branch 1.1.2.5.2.1.0.2
W og_user_roles.install : DRUPAL-6--1 already exists on branch 1.1.2.5.2.1 : NOT MOVING tag to branch 1.1.2.5.2.1.0.2
W og_user_roles.module : DRUPAL-6--1 already exists on branch 1.1.2.15.2.1 : NOT MOVING tag to branch 1.1.2.15.2.1.0.2

The correct files seem to be here:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/og_user_rol...
Along with the ones I thought I deleted.
I went to my project page, but I don't see anything there for 6.x. I'd like this to be a development version.

I tried branching for a development version again, according to the handbook instructions I read here http://drupal.org/node/17570#development :

[root@db og_user_roles]# cvs update -dP -r DRUPAL-6--1
cvs update: Updating .
You have new mail in /var/spool/mail/root
[root@db og_user_roles]# cvs commit -m "#294761 : Initial OGUR 6.x release. 2nd try."
cvs commit: Examining .
[root@db og_user_roles]# cvs tag -b DRUPAL-6--2
cvs tag: Tagging .
T README.txt
T node.module.multinode.patch
T og_user_roles.info
T og_user_roles.install
T og_user_roles.module
[root@db og_user_roles]#

Got this, which looks worse:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/og_user_rol...

This is more or less the process I use for 5.x.

Sorry to be a pain, but this stuff is like voodoo to me. I see something in cvs, but not under "Releases" on my project page. Anything I'm missing here?

frjo’s picture

First you need to add releases for you new DRUPAL-6--1 and DRUPAL-6--2 branches:

http://drupal.org/node/add/project_release/149373

It can take up to 12 hours I believe for the tar balls for the releases to be built, it's a cron job on d.o. When it's done you go to:

http://drupal.org/node/149373/edit/releases

Where you can set witch releases should show on the project page.

When you want to work on the 6--2 branch you must check it out to a separate directory.

cvs -d :pserver:somebodysysop@cvs.drupal.org:/cvs/drupal-contrib checkout -d og_user_roles -r DRUPAL-6--1 contributions/modules/og_user_roles

You should now have three separate checkouts of og_user_roles. One each for Drupal-5, DRUPAL-6--1 and DRUPAL-6--2.

If you want to remove something from one of them you go to that directory. Remove (trash) the file in question, issue the "cvs remove" command for the file and then finally use "cvs commit" command to commit the changes (that the file is removed is a change) to the repository.

somebodysysop’s picture

Got it. Thank you very much. OGUR 6.x-dev version now finally released.

somebodysysop’s picture

Got it. Thank you very much. OGUR 6.x-dev version now finally released.