Developing

Preamble - Create the Tools

  1. git clone ssh://git@bitbucket.renalregistry.nhs.uk:7999/inf/housekeeping.git
  2. cd housekeeping
  3. /c/Python36/python -m virtualenv venv
  4. venv/scripts/activate

There is also a help command - python scripts/rr_git.py --help


Check out the Code

The following command will checkout SiteValidation, Validation, Editor and Merge into the specified folder, along with any direct requirements from their requirements.txt files.

The destination folder must exist but also MUST be empty beforehand - in particular do not checkout the housekeeping folder under it. Also do not add any other sub-folders to it yourself later.

Before doing this you MUST have done the steps at the end of the Release page to merge and tag the previous branch otherwise the following commands will fail.


The first command clones all the repositories - including those from the requirements.txt. The second creates a new branch based on a particular tag.

rr_git.py --destination C:/MyWork/UKRR/Y.Y.Y
rr_git.py --action branch --tag-label vX.X.X --branch-label Y.Y.Y --destination C:/MyWork/UKRR/Y.Y.Y

Tags should have a 'v' prefix. This is because Git seems to complain if you have a branch and tag with exactly the same name.

The Tag Version vX.X.X should be the latest tag in the Master branch i.e the previous release.  While I think this should be okay I think it would be more correct when doing a non-hotfix build to branch from master. I think this requires  RR-1498 - Getting issue details... STATUS before that can be done.

The above commands seem to be creating the branch but not switching to it. This needs investigating but in the meantime check manually that the version branch is the current one and change if not.


Modifying requirements.txt

For each of the checked out components modify requirements.txt so that they're pointing at the new branch.

E.g. in rr_data on the master file, the subcomponents

-e git+ssh://jira.renalregistry.nhs.uk:7999/rr/utils#egg=rr.utils
-e git+ssh://jira.renalregistry.nhs.uk:7999/rr/rr_logging#egg=rr_logging
-e git+ssh://jira.renalregistry.nhs.uk:7999/rr/rr_common#egg=rr_common

Need to be changed to:

-e git+ssh://jira.renalregistry.nhs.uk:7999/rr/utils@Y.Y.Y#egg=rr.utils
-e git+ssh://jira.renalregistry.nhs.uk:7999/rr/rr_logging@Y.Y.Y#egg=rr_logging
-e git+ssh://jira.renalregistry.nhs.uk:7999/rr/rr_common@Y.Y.Y#egg=rr_common

Where Y.Y.Y is the new version number and the name of our branch.

This can be done with the command.

rr_git.py --action update --branch Y.Y.Y --destination C:/Mywork/UKRR/Y.Y.Y --message "Update requirements.txt"

At the moment the above command willl only work if there isn't an existing branch tag in the URLs in the URLs. If there is the Search/Replace will duplicate the tags and things will break.

There shouldn't be any tags in the URls if the Deployment instructions have been followed correctly so you should be able to use the command.

   RR-1436 - Getting issue details... STATUS needs to be done for this not to be an issue.


Updating Version Numbers

Update:

  • version.txt
  • __init__.py

The version should be kept in sync for rr_validation, rr_merge, rr_editor and rr_site_validation.

You will need to commit each repo after the file has been updated.


Adding the Version to Jira

In Jira go to the "Renal Registry" Project and click the Settings ("Cog") button in the lower left hand side.

Go to the Versions section and add a new Version entry for the new version number


Checking out already branched code (for 2nd person to work on branch)


rr_git.py --branch-label Y.Y.Y --destination C:/MyWork/UKRR/Y.Y.Y

Issues

If you get the following...

In rr_validation
Running git checkout v1.1.13 -b 1.1.14
Switched to a new branch '1.1.14'
Running git push -u origin 1.1.14
To ssh://bitbucket.renalregistry.nhs.uk:7999/rr/rr_validation.git
 ! [rejected]        1.1.14 -> 1.1.14 (non-fast-forward)
error: failed to push some refs to 'ssh://git@bitbucket.renalregistry.nhs.uk:799
9/rr/rr_validation.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

And then you get...

C:\Temp\UKRR\1.1.14\rr_validation>git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> 1.1.14

The solution seems to be -

C:\Temp\UKRR\1.1.14\rr_validation>git branch --set-upstream-to=origin/1.1.14 1.1.14
Branch '1.1.14' set up to track remote branch '1.1.14' from 'origin'.