Welcome to OpenMRS!
- trunk branch should always be buildable, but may not always be runnable
- branches/ do not need to always be buildable
- tags/ are production worthy releases
- tags/latest is a pointer to the most recent production worthy release
Creating a Branch
- Branches should always be placed under the /branches/ folder in the repository
- Use Subversion's branch feature to create your branch from trunk. Be certain to read the naming conventions below.
- See subversion book
When to Create a Branch
- Any clearly defined project that might touch many aspects of the codebase or make the code non-buildable for any period of time
- Generally, projects that take more than a day or two to complete should be considered for branching
Branch Naming Convention
- Branches should be named for the feature or component, not according to the developer or timeline
- Use lowercase with hyphen ( - ) for spaces, limit to alphanumeric characters (no special characters)
Updating your Branch (Merging from trunk)
Updating Your Branch The First Time
- Bring your local copy up to date — Ideally, make sure your local copy of the branch is updated and changes committed to the branch before proceeding. You can merge trunk without committing all of your current changes to your branch, but it can be messy and error-prone, especially if you have a lot of uncommitted changes to your branch.
- Merge from trunk to your branch — Use Subversion's merge feature to merge trunk to your branch within your working copy. The starting revision number is the revision immediately following the point at which your began your branch.
- I think you're supposed to use the revision of your branch as "from". -DJ
- Commit the merged changes back to your branch — VERY IMPORTANT: commit the change <u>with the comment</u> "Merging trunk into branch x rev:123 - rev:456" where "x" is the name of your branch and "123" and "456" refer to the starting and ending revision numbers that were merged.
Updating Your Branch More Than Once
Similar to the initial merging of trunk into your branch with one important exception.
- Update your working copy of the branch — update and, if possible, commit any changes to the branch in your working copy.
- Merge trunk starting where the last merge left off — Use Subversion's merge feature to merge trunk to your branch within your working copy from the revision of your last merge of trunk
- The "From" and "To" url should be /trunk
- The "To" revision should be "Head"
- Commit the merged changes back to your branch — VERY IMPORTANT: commit the change <u>with the comment</u> "Merging trunk into branch x rev:123 - rev:456" where "x" is the name of your branch and "123" and "456" refer to the starting and ending revision numbers that were merged from trunk.
Handling Branch Conflicts
See subversion book
Closing a Branch
- Make sure all changes are committed to your branch
- Merge/commit all recent changes on trunk to your branch
- Create a new working copy of trunk (/trunk) HEAD (latest version of trunk)
- Use Subversion's Merge feature to merge changes from your branch to trunk
- Start with the revision at which you first created the branch (or last merged the branch*to trunk – very rare)
- End with the HEAD of your branch
- All changes within your branch should now be merged into your working copy of trunk
- Automatic Conflict resolution tip: (only if you've merged latest trunk to your branch) At command line: "svn resolve -R --accept theirs-full *"
- Commit all changes in your working copy of trunk back to the trunk branch with a comment like "Merging branch x into trunk"
- Delete your branch directory
Merging Using Subclipse (within Eclipse)
- Find the revision number of the last merge
- Check out a copy of the trunk as, say, openmrs-trunk:
- Right click on openmrs-trunk and select "Team"-->"Merge"
- URL: http://svn.openmrs.org/openmrs/trunk
- Revision: Find the last merge revision number by clicking on "Show Logs". Use this number.
- Check Use "From:" URL
- Check Head Revision
#...examine the diffs, compile, test, etc...
- Find conflicts (marked in red in merge log with "C .."
- Right click "Team"-->"Edit Conflicts"
- Click "Two Way compare"
- Click "Copy all Non-conflicting changes from left to right"
- Save file
- Right click "Team"-->"Mark Resolved"
- Commit the merged/fixed code with a descriptive description like "Merged xxx branch changes 671:722 into the trunk."
Merging Using the SVN Command line
- Find the revision number of the last merge:
- Done from the trunk directory
- Merge trunk & branch xxx from that merge to the latest revision:
- ...examine the diffs, compile, test, etc...
- Use a descriptive commit description for future ease: