There are a number of Allegro-developed scripts having various functions which are maintained under the version control system git. A good introduction with tutorials can be found in the git documentation.
Currently the scripts are divided between four repositories. For each of these, there is an ‘origin’ repository directory under the directory $ALLEGRO_GIT, an active or working copy, and a copy under /home/alma/git_repos/src.
Location of the active copy | $ALLEGRO_GIT repository | Bulk update script |
---|---|---|
$ALLEGRO_STAFF/src/casa/tasks/ | casa/tasks.git | update_buildmytasks |
$ALLEGRO_STAFF/lib/python/site-packages/allegroUtils/ | scripts/allegroUtils.git | update_allegroUtils |
$ALLEGRO_STAFF/bin/ | scripts/project_management.git | update_allegroStaffBin |
$ALLEGRO/bin/ | scripts/allegroScripts.git | update_allegroBin |
Note finally that various documents (including the present guide) are also under git version control, and can be modified by Allegro members via the same procedure. See section Documents under version control for details.
When starting up CASA on one of the Allegro computers, it loads the self-written CASA tasks from the default installation path. However, that is not very convenient if you try to develop a new task and you have to have access to data on chaxa, helada or tebinquiche.
Therefore, you can define an environment variable CASA_MYTASKS with the full path to the mytasks.py in your development environment, which is then loaded instead of the systemwide installation. After removing the variable (or setting it to a non-existing file), the default installation will be loaded during the next startup.
So as an example, in bash you can do:
$ export CASA_MYTASKS=/home/alma/devel/casatasks/mytasks.py
and in c-shell you can do:
> setenv CASA_MYTASKS /home/alma/devel/casatasks/mytasks.py
and it will load your development version at at startup.
If you have a new project that you would like to include in the local github, the following chain of commands should be executed.
Go into your project directory (in this example, called myAllegroProject)
$ cd <my project dir>/myAllegroProject
Initialise git
$ git init
Initialized empty Git repository in <my project dir>/myAllegroProject/.git/
Note down files that should not be shared in .gitignore (e.g. if your project is python, you don’t need to store the compiled *.pyc files.):
$ echo "*.pyc" >> .gitignore
Add all the files that you would like to include into the repository, and (optionally) check the status
$ git add .
$ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to reverse committal of any file)
new file: bar.py
new file: foo.py
Make your first commit, i.e., put these files under version control.
$ git commit -m "Initial commit"
[master (root-commit) 60ee998] Initial Commit
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 bar.py
create mode 100644 foo.py
If you do not specify a message with the tag -m "Message", an editor will open up and ask you to give a quick description of this commit.
Optionally, you can also tag any commit (which allows to quickly return to this point). Typical occasions for a tag are a version release.
$ git tag -a InitialCommit
Clone this directory into a bare repository
$ cd ..
$ git clone --bare myAllegroProject myAllegroProject.git
Cloning into bare repository 'myAllegroProject.git'...
done.
As user alma, copy the repository into the github (taking into account the subdirectory structure of the github), and assign the group the same permission as the user
$ cp -r myAllegroProject.git $ALLEGRO_GIT/scripts
$ cd $ALLEGRO_GIT/scripts
$ chmod -R g=u myAllegroProject.git
Mark the repository as shared repository (to modify the file permissions for the group so that everyone can modify things)
$ cd myAllegroProject.git
$ git config core.sharedRepository true
You are done! All Allegro members can now contribute to this project.
Figure 11: Schematic of the distributed workflow for Allegro projects.
The workflow for Allegro projects (see Figure 11) currently follows closely the scheme of a Centralised Workflow. Developers pull and push from the main branch of the shared repository. The system-wide library is only updated by pulling the most recent changes from the repository, so that they are available for all users on the Allegro computers.
In order to contribute to a project, you first have to clone your local copy
$ git clone $ALLEGRO_GIT/scripts/allegroProject.git
Cloning into 'allegroProject'...
done.
This is a complete mirror of the project in the repository.
A developer pulls the latest version of the project from the repository
$ cd allegroProject
$ git pull origin master
It is then strongly recommended to open a development branch. This can have an arbitrary name
$ git checkout -b devel
You can add, delete, or modify any of the files. Afterwards, the changes must be staged and commited
$ git add foo.py bar.py
$ git commit
or if all the changed files should be committed, this command can also be used
$ git commit -a
Then one should return to the master branch and pull the latest version from the repository
$ git checkout master
$ git pull origin master
The changes in the development branch have to be merged with the main branch now
$ git merge devel
Any conflicts have to be resolved (follow the instructions). Then, the updated sofware must be pushed back into the shared repository
$ git push origin master
Warning
Any conflicts with the master branch in the repository (if, e.g., another developer has also pushed changes) must be resolved locally first, before the final version can be pushed to the repository.
After the pushing, the system-wide installation has to be updated. For this, dedicated scripts are available (see Table in Allegro management scripts).