Difference between pages "Git: Cloning" and "Handle an OpenMRS Ticket (Activity)"

From TeachingOpenSource
(Difference between pages)
 
 
Line 1: Line 1:
__NOTOC__
= OpenMRS Tickets =
{| border="1"
|-
|'''Title''' ||Cloning
|-   
|'''Overview''' ||


Open source community comes with many different applications and modules which are constantly under development. In order to become familiar with a particular module, you need to clone the module on your virtual machine. Almost all the open source modules developed by the community use version control systems to manage and organize the changes. This document provides steps to clone a module from one such version control system.
* '''Description''': Use git and Eclipse to handle an OpenMRS ticket.
* '''Source''': Ben Coleman
* '''Prerequisite Knowledge''': A working github account, Eclipse configured for OpenMRS
* '''Estimate Time to Completion''': 60 minutes plus time to solve the ticket
* '''Learning Objectives''': Ability to
** fork, clone, checkout, and commit code using git and github.
** follow the process defined by OpenMRS for tickets.
* '''Materials/Environment''': Access to Internet / Web and web browser, git, Eclipse
* '''Additional Information''': N/A
* '''Rights & Licensed''': CC BY-SA FIXME check that this license is appropriate
* '''Turn In''': None


Version Control:
== Video ==
A version control system is a repository of files that records the changes to a file or set of files often the files for the source code of computer programs, with monitored access. Every change made to the source is tracked, along with who made the change, why they made it, and references to problems fixed, or enhancements introduced, by the change so that you can recall specific versions later.
In this lab we will be using a git version control system.


Git version control:
Watch the OpenMRS University video, http://www.youtube.com/watch?v=SbbDvMVgRWo entitled, “OpenMRS University: Contributing Code.
git is an open source distributed version control system originally developed by Linus Torvalds to support the development of the Linux kernel. Every Git working directory is a full-fledged repository with complete history and full version tracking capabilities, not dependent on network access or a central server.
git can be used as a local version control system without having any central repository.


== Handle a Ticket ==


 
# Claim the ticket
|-
# Fork the appropriate repository on github.
|'''Prerequisite Knowledge''' ||Cloning
#* The project name is in the upper-left corner of the ticket next to the ticket id.
|-
# Clone the repository to your local machine.
|'''Learning Objectives''' ||Cloning using Git   
#* git clone <math><</math>repository url<math>></math>
|}
#* The repository url should point to the forked copy on ''your'' github account.
 
# Set the upstream repository
=== Background: ===
#* git remote add upstream <math><</math>repository url<math>></math>
Originally designed and developed by Linus Torvalds for Linux Kernel development, it is a distributed revision control system. The terminology 'distributed version control' , also known as 'decentralized version control', is designed to allow team of software developers from different organizations to work on a project. The software revisions are stored in a distributed revision control system (DRCS), also known as a distributed version control system (DVCS).
#* The repository url should point to the original copy of the project on github.
 
#* You must be in the project directory for this command to succeed.
=== Directions: ===
# Fetch all the current branches of the project.
 
#* get fetch –all
== Check to make sure Git is installed: ==
#* FIXME I don’t quite understand why this is necessary. What did we have after the clone?
 
# Pull all changes from the upstream master
 
#* git pull –rebase upstream master
The installed version of Fedora Operating system has git version control system preinstalled. If not, please refer to Git Set Up and install it before proceeding further.
#* FIXME In the video and on my sample ticket, there were no changes. I don’t understand how there could be after the fetch (much less after the clone).
 
# Create a branch to work in
To check if git was installed and working correctly, open VirtualBox and start Fedora 22 Operating System.
#* git checkout -b <math><</math>branch name<math>></math>
 
#* Use the ticket identifier as the branch name.
After logging in to the Virtual Machine using the user credentials created during installation, open terminal program as shown below.
# Import the project into Eclipse
 
#* Use the “Browse..” button to point at the directory containing the project.
1. Click on “Activities” on the top left and type “Terminal” in the search bar.
# Tell Eclipse that the project uses git.
 
#* Select all the projects, and then right click. Select “Team” and then “Share Project...” The default opens are correct.
2. Now click on the Terminal Button displayed in the search results and type the command “git” in the command line.
#* Do not use “Share Projects” (plural). This is for adding a new form of sharing.
 
# Handle the issue described in the ticket...
If everything goes fine, you should see git command reference now.
# Add your changes to the staging area of your local repository.
 
#* git add -i for an interactive add.
Please refer to https://git-scm.com/docs for getting familiar with all the git commands available.
#* git add <math><</math>filename<math>></math> to add specific files
 
# Commit your changes to your local repository
#* git commit -m &quot;<math><</math>ticket id<math>></math>: <math><</math>commit message<math>></math>&quot;
 
# Push the changes in your branch back to the origin on github.
 
#* git push origin <math><</math>branch id<math>></math>
 
# Change to the branch on github, and make a pull request
== Cloning a Module using Git: ==
#* Include the URL of the ticket.
 
#* Be sure to check the “Commits” and “Files Changed” tabs to be sure you are sending the correct changes.
 
# Request a code review on the ticket page
Cloning a module of a git repository is done using any of the three protocols (git, https, or ssh). There is no need to worry about the protocol and git automatically takes care of it. Just follow the steps below:
#* Include the URL of the pull request in the comment for the code review.
 
# Wait. Someone from OpenMRS will respond to the pull request.
In this lab, we will be cloning gnome-photos module as an example into the local workstation. All the changes we make to the source are maintained independent from the master copy using branches without messing up with the original source.
gnome-photos clone links:
 
git://git.gnome.org/gnome-photos
 
• https://git.gnome.org/browse/gnome-photos
 
• ssh://USERNAME@git.gnome.org/git/gnome-photos
 
Any of the above three URI’s can be used in the cloning process.
 
1. To clone a module from git central repository, we use the command “git clone”.
 
$ git clone [git/ssh/https URI]
 
 
 
 
 
== Documentation: ==
 
 
Create a file using your favorite editor. Add all your screenshots of the steps.  Then, answer the questions in the next section and include them in your file.
For your convenience, the following rubric is provided. Please review that carefully while generating and submitting your work.  Once you are completely done with your lab, create a pdf file and name it as  FossCloneWithGitLab_yourlastnamefirstinitial.pdf. Submit your work as instructed by your instructor.
 
=== Deliverables: ===
Create a document (such as word, etc.) and include screenshots of different stages of using Git for cloing in it. In addition, answer the following questions.
 
 
'''Cloning Lab Rubric (100 points)'''
 
Screenshots of the above steps (include caption for each screenshot explaining the steps) (60 points)
 
Lab Questions (40 points) 
• What is Cloning process and how is that different from copying? (10 points)   
• What do we mean by dependencies in the cloning process? (10 points)     
•    What protocols can git use to transfer? (10 points)
• Grammar, Spelling and Neatness (5 points) – named file correctly and submitted properly on time. (5 points)
 
=== Additional Information: ===
{| border="1"
|-
|'''Knowledge Area/Knowledge Unit''' ||  Cloning
|-
|'''Topic''' ||  Cloning with Git
|-
|'''Level of Difficulty''' || Easy
|-
|'''Estimated Time to Completion''' || 2 hours
|-
|'''Materials/Environment''' || Fedora
|-
|'''Author''' ||  Mohsen Dorodchi
|-
|'''Source''' ||
|-
|'''License''' ||
|}
 
 
--------------------
 
 
[[Category: Learning_Activity]]
[[Category: Subcategory: Cloning]]

Revision as of 15:19, 13 June 2013

OpenMRS Tickets

  • Description: Use git and Eclipse to handle an OpenMRS ticket.
  • Source: Ben Coleman
  • Prerequisite Knowledge: A working github account, Eclipse configured for OpenMRS
  • Estimate Time to Completion: 60 minutes plus time to solve the ticket
  • Learning Objectives: Ability to
    • fork, clone, checkout, and commit code using git and github.
    • follow the process defined by OpenMRS for tickets.
  • Materials/Environment: Access to Internet / Web and web browser, git, Eclipse
  • Additional Information: N/A
  • Rights & Licensed: CC BY-SA FIXME check that this license is appropriate
  • Turn In: None

Video

Watch the OpenMRS University video, http://www.youtube.com/watch?v=SbbDvMVgRWo entitled, “OpenMRS University: Contributing Code.”

Handle a Ticket

  1. Claim the ticket
  2. Fork the appropriate repository on github.
    • The project name is in the upper-left corner of the ticket next to the ticket id.
  3. Clone the repository to your local machine.
    • git clone <math><</math>repository url<math>></math>
    • The repository url should point to the forked copy on your github account.
  4. Set the upstream repository
    • git remote add upstream <math><</math>repository url<math>></math>
    • The repository url should point to the original copy of the project on github.
    • You must be in the project directory for this command to succeed.
  5. Fetch all the current branches of the project.
    • get fetch –all
    • FIXME I don’t quite understand why this is necessary. What did we have after the clone?
  6. Pull all changes from the upstream master
    • git pull –rebase upstream master
    • FIXME In the video and on my sample ticket, there were no changes. I don’t understand how there could be after the fetch (much less after the clone).
  7. Create a branch to work in
    • git checkout -b <math><</math>branch name<math>></math>
    • Use the ticket identifier as the branch name.
  8. Import the project into Eclipse
    • Use the “Browse..” button to point at the directory containing the project.
  9. Tell Eclipse that the project uses git.
    • Select all the projects, and then right click. Select “Team” and then “Share Project...” The default opens are correct.
    • Do not use “Share Projects” (plural). This is for adding a new form of sharing.
  10. Handle the issue described in the ticket...
  11. Add your changes to the staging area of your local repository.
    • git add -i for an interactive add.
    • git add <math><</math>filename<math>></math> to add specific files
  12. Commit your changes to your local repository
    • git commit -m "<math><</math>ticket id<math>></math>: <math><</math>commit message<math>></math>"
  13. Push the changes in your branch back to the origin on github.
    • git push origin <math><</math>branch id<math>></math>
  14. Change to the branch on github, and make a pull request
    • Include the URL of the ticket.
    • Be sure to check the “Commits” and “Files Changed” tabs to be sure you are sending the correct changes.
  15. Request a code review on the ticket page
    • Include the URL of the pull request in the comment for the code review.
  16. Wait. Someone from OpenMRS will respond to the pull request.