Score:0

Where do source trees for different versions of contrib modules reside?

in flag

I made a contrib module that has a 7.x version. I just created an 8.x version. Do I create a branch within the existing 7.x version for the new code, or create a separate version for the 8.x? If they share the same module, do I switch to the 8.x branch, then delete the 7.x code and add the 8.x code?

apaderno avatar
us flag
With Git, you create a branch from an existing branch. With Drupal, that's not different.
pglatz avatar
in flag
So I use a single git repository for both versions, and changing branches would bring in a whole different set of files? If I maintain two versions, I would pull the repo into two different source trees, pulling a different branch for each one?
Kevin avatar
in flag
Versions are just branches and tags of a single repo.
apaderno avatar
us flag
See what projects hosted on drupal.org, for example the [Token](https://www.drupal.org/project/token) module, do: There is a single repository for the module with branches for different Drupal versions. From the Drupal 7 branch, you create the Drupal 8 branch, which will contain the files for Drupal 7, and then edit the files to make them for Drupal 8.
apaderno avatar
us flag
This is how Git is used, though. There isn't anything Drupal-specific in that. What is specific to Drupal (or better, to drupal.org) is the names given to branches and tags. In projects hosted on drupal.org, you won't have branches that use a name like 2.0.1, nor tags that use a name like 1.x. For Drupal 7, there are more restrictions on tag/branch names: Both are required to start with *7.x-*.
id flag
I can't seem to say this enough. Drupal 8 is end-of-life. You should write code for Drupal 9.
Score:1
id flag

It is ordinary and expected to use a single Git repo for multiple release versions. The release naming conventions are documented. That includes branch naming.

You will check out the Drupal 7 branch of the project then type git checkout -b <new-branch-name>, where the new branch name is according to the conventions above (and is probably 1.x or 1.0.x because semantic versioning is now possible). Then you will upgrade the code to be compatible with Drupal 9, commit, and push the new branch.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.