Jump to content

Guidelines:DeveloperWorkflow: Difference between revisions

From Sahana Eden Wiki
Dominic (talk | contribs)
Dominic (talk | contribs)
No edit summary
Line 27: Line 27:
When you get to [https://eden-asp.readthedocs.io/en/latest/dev/setup.html#installing-eden '''Installing Eden'''], make sure to clone your own fork:
When you get to [https://eden-asp.readthedocs.io/en/latest/dev/setup.html#installing-eden '''Installing Eden'''], make sure to clone your own fork:


<code>
  git clone --recursive https://github.com/[yourname]/eden.git ~/eden
git clone --recursive https://github.com/[yourname]/eden.git ~/eden
</code>


...instead of ''sahana/eden''.
...instead of ''sahana/eden''.
Line 35: Line 33:
Finally, configure ''sahana/eden'' as upstream repository for your clone:
Finally, configure ''sahana/eden'' as upstream repository for your clone:


<code>
  git remote add upstream https://github.com/sahana/eden.git
git remote add upstream https://github.com/sahana/eden.git
</code>


Now you can use this local instance to test-run and verify your changes.
Now you can use this local instance to test-run and verify your changes.
Line 45: Line 41:
All development should be based on the <code>dev</code> branch of ''sahana/eden''. To get a copy of that branch into your local clone, change into the ''eden'' folder and run these two commands:
All development should be based on the <code>dev</code> branch of ''sahana/eden''. To get a copy of that branch into your local clone, change into the ''eden'' folder and run these two commands:


<code>
  git checkout -b dev
git checkout -b dev
  git pull upstream dev
</code>
 
<code>
git pull upstream dev
</code>


This adds a copy of the Sahana Eden dev branch to your local clone, and checks out the latest developer version of the code.
This adds a copy of the Sahana Eden dev branch to your local clone, and checks out the latest developer version of the code.
Line 61: Line 52:
To create a new story branch, change into your eden folder, and checkout the dev branch:
To create a new story branch, change into your eden folder, and checkout the dev branch:


<code>
  git checkout dev
git checkout dev
</code>


From this, create the new story branch:
From this, create the new story branch:


<code>
  git checkout -b story_branch
git checkout -b story_branch
</code>


...replacing ''story_branch'' with a descriptive name for the change set (e.g. ''bugfix_org_menu'').
...replacing ''story_branch'' with a descriptive name for the change set (e.g. ''bugfix_org_menu'').


You can have multiple story branches, and switch between them. However, remember that you should either stash or commit your changes before switching branches.
Make your changes to the story branch, and test-run and verify them with your local instance.
 
You can have multiple story branches, and switch between them. However, remember that you should either stash or commit your changes before switching branches. Further, you make changes to data models, only the story branch will have them - so it will become necessary to reset the database of your local instance when switching branches.


=== Publishing Changes ===
=== Publishing Changes ===
Line 79: Line 68:
To publish your changes, commit them to the story branch:
To publish your changes, commit them to the story branch:


<code>
  git checkout story_branch
git commit -a
  git commit -a
</code>


...and then push that branch to your GitHub repo:
...and then push that branch to your GitHub repo:


<code>
  git push origin story_branch
git push origin story_branch_name
</code>


This will copy the story branch to your repository on GitHub, or update that branch if it already exists there.
This will copy the story branch to your repository on GitHub, or update that branch there if it already exists.


=== Submitting Pull Requests ===
=== Submitting Pull Requests ===

Revision as of 13:19, 23 October 2025

Developer Workflow

Prerequisites

Additionally, you will need:

  • git
  • a suitable programming editor (e.g. Kate)

Forking Sahana Eden

Start by creating your own fork of Sahana Eden:

  • Login to GitHub (create yourself an account, if you don't have one yet)
  • Navigate to https://github.com/sahana/eden
  • Click on the Fork button, and follow the instructions to create a new fork

This will create a new GitHub repository [yourname]/eden*, which is your own copy of sahana/eden - and the repository you will work on.

* [yourname] here stands for your GitHub username

Creating a Local Clone

Follow the steps in the Developer Handbook to set up a local instance of Sahana Eden.

When you get to Installing Eden, make sure to clone your own fork:

 git clone --recursive https://github.com/[yourname]/eden.git ~/eden

...instead of sahana/eden.

Finally, configure sahana/eden as upstream repository for your clone:

 git remote add upstream https://github.com/sahana/eden.git

Now you can use this local instance to test-run and verify your changes.

Adding the Development Branch

All development should be based on the dev branch of sahana/eden. To get a copy of that branch into your local clone, change into the eden folder and run these two commands:

 git checkout -b dev
 git pull upstream dev

This adds a copy of the Sahana Eden dev branch to your local clone, and checks out the latest developer version of the code.

Creating Story Branches

Rather than making changes in the dev branch directly, you should use a new branch for every set of changes you make, a so-called story branch.

To create a new story branch, change into your eden folder, and checkout the dev branch:

 git checkout dev

From this, create the new story branch:

 git checkout -b story_branch

...replacing story_branch with a descriptive name for the change set (e.g. bugfix_org_menu).

Make your changes to the story branch, and test-run and verify them with your local instance.

You can have multiple story branches, and switch between them. However, remember that you should either stash or commit your changes before switching branches. Further, you make changes to data models, only the story branch will have them - so it will become necessary to reset the database of your local instance when switching branches.

Publishing Changes

To publish your changes, commit them to the story branch:

 git checkout story_branch
 git commit -a

...and then push that branch to your GitHub repo:

 git push origin story_branch

This will copy the story branch to your repository on GitHub, or update that branch there if it already exists.

Submitting Pull Requests

To get your changes merged into the main Sahana Eden repository, you need to submit a pull request. Follow the GitHub documentation to create a pull request.

Make sure that you compare:

  • your story branch (head repository)
  • against the sahana/eden dev branch (base repository)

Create a pull request (rather than a draft pull request) to submit your changes for review. Anyone can comment on your pull request, and you can discuss with them directly on GitHub.

Eventually, a maintainer will decide whether to accept and merge your changes, or to reject them.

Once they have been merged successfully into the sahana/eden dev branch, you can update your local copy of it:

 git checkout dev
 git pull upstream dev

You can also discard your story branch:

 git branch -d story_branch
 git push -d origin story_branch