Two months before the release (example: DIRAC13), a release branch (example: release-13) is created from master. This is a feature freeze and from this moment on the release branch ideally only receives cosmetics and bugfixes, no major new features, no merges from master or other branches (except cherry-picks; more about it later). You as developer are responsible to commit or merge the to-be-released code to master, before the release branch is created.
Yes you can! This is one of the reasons we have the release branch and exactly for this reason we will never merge from master to the release branch, only from the release branch to master.
Check out the release branch:
$ git checkout release-13
Now you have it next to master (verify this):
$ git branch
You can switch back to master:
$ git checkout master
And then switch back to the release branch:
$ git checkout release-13
Commit all such changes to the release branch, not to master. This way also no commit or bugfix will get lost. Please do not transfer commits from the release branch to master manually. This is not only unnecessary work but it is harmful (conflicts)! Again, do not commit to master, commit to the release branch:
$ git checkout release-13
$ git pull # update the local release-13 branch
$ git commit # commit your modifications
$ git push # push your changes to release-13 branch
$ git checkout master # switch to the master branch
$ git merge --no-ff release-13 # merge changes to master, fix conflicts if any
$ git push # push your changes to master
If you have no time, you don’t have to merge to master yourself, you can wait until somebody else does it for his/her commits. No commit can get lost this way.
Note that by merging your changes to master you might get conflicts. Git points them out clearly. In such cases open conflicting file(s) and fix discrepancies inside manually. They are marked with “<<<<<<” and “>>>>>>” strings.
What if you accidentally committed something to master which belongs to the release? In this case do not merge master to the release branch, but rather cherry-pick the individual commit(s) to the release branch:
$ git checkout release-13
$ git cherry-pick [hash] # with [hash] that corresponds
# to the commit
You as the developer are responsible for removing your code from the release branch that you do not wish to be released. This is not done by actually removing the code but by using pamadm in combination with CPP statements. So again, do not actually delete code lines, use CPP statements as demonstrated below:
Modules can be excluded from the release version by surrounding the appropriate parts of code by preprocessor statements, e.g.:
#ifdef MOD_KRMC
CALL TKRMCORB
CALL SETDC2(0)
CALL PSIOPT('MCSCF',WFCONV,WORK,LWORK)
IF(DOANA) CALL PAMANA(WORK,LWORK)
#else
CALL QUIT(
& 'Second order KMCSCF optimization not included in this version')
#endif
This means that the calls are included only if MOD_KRMC is defined. Look in pamadm for existing modules and how they define their CPP flags and directories. If your pamadm module is not part of pamadm –release, then the code will be automatically removed by the release script. In the above example, the script would remove the actual MOD_KRMC code and what would be left is:
CALL QUIT(
& 'Second order KMCSCF optimization not included in this version')
If you want to protect code from being released which is not part of any pamadm module, you can use MOD_UNRELEASED:
#ifdef MOD_UNRELEASED
! secret code; this will not end up in the release tarball
#endif
To summarize, you can remove code using either existing CPP filters or using MOD_UNRELEASED. Do this on the release branch and merge to master:
Look in pamadm and search for “unreleased”. All the tests listed there will be removed by the release preparation script. All tests listed under modules which are not part of:
./pamadm --release
are removed as well.
Most important rule: treat unpublished code of others with respect. Do not release code of others without asking.
As a final step create the tarball:
$ ./pamadm --release
$ mkdir build
$ cd build
$ cmake ..
$ make release