Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents


Info

The OpenMRS community is currently in the process of evaluating Git as a replacement for SVN.

...

Note

When creating a new module or contrib, please e-mail mail code@openmrs.org to request a module ID or contribution name, including your OpenMRS ID, a description of your module/contribution, and your proposed module ID or contribname.  The conversation with the "code" e-mail group is used to avoid duplicates and maximize consistency of naming; you should expect a module ID to be decided within one day of your request.  Eventually, we hope to create a more automated process for ensuring uniqueness of module identification & awareness of existing modules.

...

The tool that Github recommends is svn2git. It expects your project to be organized in the standard SVN way of trunk, branches and tags, so you should reorganize the project before conversion if necessary.

Copy the list of authors from from /wiki/spaces/docs/pages/25520562 into an authors.txt file and from that folder, start with:

...

Info

If you get an error from svn2git, it's possible that one or more users are missing from the authors.txt file.  Checkout a local copy of the module from svn and list out all authors who contributed to the module:


Code Block
languagebash
$ svn log --quiet | grep "^r" | awk '{print $3}' | sort | uniq


Make sure each of these users has an entry in the authors.txt file.  If anyone is missing, then find their corresponding git name and e-mail (if you cannot find these, e-mail the dev mailing list and ask for help)


NB  Other alternatives to svn2git  include;

  1. svn-git

                Git comes with a pre-installed tool called    svn-git  see https://aboullaite.me/migration-from-svn-to-git-a-developer-guide/

                svn2git is just a wrap up tool around git's svn-git , and  it makes using svn-git more easier and flexible .However in some cases , it may be better to use svn-git directly

       2. The github Importer

               The github Importer is also a great and easy to use tool to use for conversion and migration of repos  from svn to git

                see https://help.github.com/en/articles/importing-a-repository-with-github-importer

Once the complete project is converted from svn to git format, you need to get it up to GitHub.

  1. Create a new repo in Github (or ask for one for the OpenMRS org from code@openmrs.org)
    1. Name: openmrs-module-yourmoduleid
    2. Description: a one-line description of what the module does (look at others for examples)
    3. Make it public
    4. Initialize with a README
    5. Add .gitignore for maven
  2. Edit the module's pom.xml to use the github address

    No Format
    	<scm>
    		<connection>scm:git:https://github.com/openmrs/openmrs-module-yourmoduleid/</connection>
    		<developerConnection>scm:git:https://github.com/openmrs/openmrs-module-yourmoduleid/</developerConnection>
    		<url>https://github.com/openmrs/openmrs-module-yourmoduleid/</url>
    	</scm>


  3. Change the local repo you just converted to point at that one github repo "origin" (below)

    Code Block
    languagebash
    $ git remote add origin https://github.com/openmrs/openmrs-module-yourmoduleid.git


    Code Block
    languagebash
    $ git pull origin master


  4. Assuming that your module uses the OpenMRS license and it wasn't already in subversion's root, add it:

    Code Block
    languagebash
    wget https://raw.github.com/openmrs/openmrs-core/master/license.txt


  5. Commit your changes locally

    Code Block
    languagebash
    $ git add .
    $ git commit -m "migrating from svn to github"


  6. Push the code to github (below)

    Code Block
    languagebash
    $ git push

    Push the tags manually using the following command.

    Code Block
    languagebash
    $ git push --tags


  7. Add default teams to the new github repository:
    1. Full Committers
    2. Partial Committers
    3. Repo Owners
       
  8. Under the Admin section for the new github repository, make sure Wiki & Issues are unchecked (we don't want wiki & issues going into github; rather, we want people using wiki.openmrs.org and jira.openmrs.org)

...

It's preferable that older modules be mavenized prior to migrating to git, since it significantly reduces the size of the repository, making it easier for low-bandwidth developers to clone the repository locally.  If your module is not yet mavenized, see see Converting old code to Maven.

For Mavenized projects, IDE specific files should not be included in the repository. Git supports an ignore file similar to SVN called .gitignore, and so for a typical mavenized module project this will look like:

...

We have a shared authors file. Please use and add to this as needed: /wiki/spaces/docs/pages/25520562!

IDE integration

Include Page

...

Git IDE Integration

...

Git IDE Integration

Best Practices

Here's the set of best practices to follow in distributed OpenSource projects.