Difference between revisions of "Learning how to branch and merge exercise - OOP344 20121"

From CDOT Wiki
Jump to: navigation, search
Line 1: Line 1:
Under construction (Incomplete)
 
 
 
Objectives of this exercise it to learn how to branch the trunk into your '''''workspace''''' and merge it back after task is done.
 
Objectives of this exercise it to learn how to branch the trunk into your '''''workspace''''' and merge it back after task is done.
 
This process is taken virtually every time you have a task to add code or documentation to the project:
 
This process is taken virtually every time you have a task to add code or documentation to the project:
Line 8: Line 6:
 
# Go through the code in [[#CFrame|CFrame]] and the description of [[#CFrame|CFrame]] here and understand what it does. Then divide the methods of the [[#CFrame|CFrame]] class between the members of the team so each one of you will be responsible to add comments for few of the functions.
 
# Go through the code in [[#CFrame|CFrame]] and the description of [[#CFrame|CFrame]] here and understand what it does. Then divide the methods of the [[#CFrame|CFrame]] class between the members of the team so each one of you will be responsible to add comments for few of the functions.
 
# Create a directory on your computer in which you are going to '''checkout''' the repository.
 
# Create a directory on your computer in which you are going to '''checkout''' the repository.
#: this direcotry is where, you are going to do your work and development. lets call this direcotory '''locdir'''
+
#: this directory is where, you are going to do your work and development. lets call this directory '''locdir'''
 
# Checkout the repository into '''locdir''':
 
# Checkout the repository into '''locdir''':
#* right click on '''locdir''' and select '''"SVN Chekcout"'''
+
#* right click on '''locdir''' and select '''"SVN Checkout"'''
 
#* In '''"URL of repository"''' type the path to your repository like: ''svn://zenit.senecac.on.ca/oop344_113repXX''.
 
#* In '''"URL of repository"''' type the path to your repository like: ''svn://zenit.senecac.on.ca/oop344_113repXX''.
 
#* Leave the rest to be what they are.
 
#* Leave the rest to be what they are.
 
#* Click on '''OK''' (if prompted for userid and password, enter them)
 
#* Click on '''OK''' (if prompted for userid and password, enter them)
 
#* Or you can issue the following command line:<big><pre>svn co svn://zenit.senecac.on.ca/oop344_113repXX locdir --username stdId --password stpassword</pre></big>
 
#* Or you can issue the following command line:<big><pre>svn co svn://zenit.senecac.on.ca/oop344_113repXX locdir --username stdId --password stpassword</pre></big>
# Branch the trunk into your workspace under a directory with a proper name, lets call the direcotry ''"CommentingCFrame"''  
+
# Branch the trunk into your workspace under a directory with a proper name, lets call the directory ''"CommentingCFrame"''  
#* Right click on '''trunk''' in '''locdir''' and under "TortoiseSVN" submenu click on "Branch/tag"
+
#* Right click on '''trunk''' in '''locdir''' and under "TortoiseSVN" sub-menu click on "Branch/tag"
#* Click on the button at right side of '''To URL''' and browse and find your '''workspace''' under branches direcotry (i.e. ''svn://zenit.senecac.on.ca/oop344_113repXX/branches/stdId'') and select it.
+
#* Click on the button at right side of '''To URL''' and browse and find your '''workspace''' under branches directory (i.e. ''svn://zenit.senecac.on.ca/oop344_113repXX/branches/stdId'') and select it.
 
#* Add the branch name to the end of the selected path: <big><pre>svn://zenit.senecac.on.ca/oop344_113repXX/branches/stdId/CommentingCFrame</pre></big>
 
#* Add the branch name to the end of the selected path: <big><pre>svn://zenit.senecac.on.ca/oop344_113repXX/branches/stdId/CommentingCFrame</pre></big>
#* In '''Log message''' type ''"Braching to add comments to CFrame methods"''
+
#* In '''Log message''' type ''"Branching to add comments to CFrame methods"''
 
#* Leave the rest of the options to remain as they are and click on ok.
 
#* Leave the rest of the options to remain as they are and click on ok.
 
#*: This will make a copy of trunk under your '''workspace/CommentingCFrame''' on the server.
 
#*: This will make a copy of trunk under your '''workspace/CommentingCFrame''' on the server.
#* Or you can issue the following commanline:<big><pre>svn copy svn://zenit.senecac.on.ca/oop344_113repXX/trunk svn://zenit.senecac.on.ca/oop344_113repXX/branches/stdId/CommentingCFrame -m "Braching to add comments to CFrame methods"</pre></big>
+
#* Or you can issue the following commanline:<big><pre>svn copy svn://zenit.senecac.on.ca/oop344_113repXX/trunk svn://zenit.senecac.on.ca/oop344_113repXX/branches/stdId/CommentingCFrame -m "Branching to add comments to CFrame methods"</pre></big>
 
#* Note that the type of branching we use in this subject is called [http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.branchmerge.commonpatterns.feature Feature Branch]
 
#* Note that the type of branching we use in this subject is called [http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.branchmerge.commonpatterns.feature Feature Branch]
 
# Update the repository to get the new branch on the local computer
 
# Update the repository to get the new branch on the local computer
Line 31: Line 29:
 
#* Right click on '''CommentingCFrame''' and click on '''SVN Commit'''   
 
#* Right click on '''CommentingCFrame''' and click on '''SVN Commit'''   
 
#* In Commit Dialog box write a short description (few words) to explain what is being committed and click on ok.
 
#* In Commit Dialog box write a short description (few words) to explain what is being committed and click on ok.
#* Or you can issue the following command:<big><pre>svn commit locdir\branches\stdId\CommentingCFrame -m "Added commnets to foo() and faa() methods"</pre></big>
+
#* Or you can issue the following command:<big><pre>svn commit locdir\branches\stdId\CommentingCFrame -m "Added comments to foo() and faa() methods"</pre></big>
 
# Now that the work is done, we want to merge the changes back to trunk
 
# Now that the work is done, we want to merge the changes back to trunk
 
#* First update the whole repository.
 
#* First update the whole repository.

Revision as of 20:39, 11 October 2011

Objectives of this exercise it to learn how to branch the trunk into your workspace and merge it back after task is done. This process is taken virtually every time you have a task to add code or documentation to the project:


  1. Go through the code in CFrame and the description of CFrame here and understand what it does. Then divide the methods of the CFrame class between the members of the team so each one of you will be responsible to add comments for few of the functions.
  2. Create a directory on your computer in which you are going to checkout the repository.
    this directory is where, you are going to do your work and development. lets call this directory locdir
  3. Checkout the repository into locdir:
    • right click on locdir and select "SVN Checkout"
    • In "URL of repository" type the path to your repository like: svn://zenit.senecac.on.ca/oop344_113repXX.
    • Leave the rest to be what they are.
    • Click on OK (if prompted for userid and password, enter them)
    • Or you can issue the following command line:
      svn co svn://zenit.senecac.on.ca/oop344_113repXX locdir --username stdId --password stpassword
  4. Branch the trunk into your workspace under a directory with a proper name, lets call the directory "CommentingCFrame"
    • Right click on trunk in locdir and under "TortoiseSVN" sub-menu click on "Branch/tag"
    • Click on the button at right side of To URL and browse and find your workspace under branches directory (i.e. svn://zenit.senecac.on.ca/oop344_113repXX/branches/stdId) and select it.
    • Add the branch name to the end of the selected path:
      svn://zenit.senecac.on.ca/oop344_113repXX/branches/stdId/CommentingCFrame
    • In Log message type "Branching to add comments to CFrame methods"
    • Leave the rest of the options to remain as they are and click on ok.
      This will make a copy of trunk under your workspace/CommentingCFrame on the server.
    • Or you can issue the following commanline:
      svn copy svn://zenit.senecac.on.ca/oop344_113repXX/trunk svn://zenit.senecac.on.ca/oop344_113repXX/branches/stdId/CommentingCFrame -m "Branching to add comments to CFrame methods"
    • Note that the type of branching we use in this subject is called Feature Branch
  5. Update the repository to get the new branch on the local computer
    • Right click on locdir and click on "SVN update"
    • Or you can issue the following commandline:
      svn update locdir
  6. Now open CommentingCFrame workspace and start working on your task and comment the methods assigned to you.
  7. After the work is complete, (tested and compiled and run) commit your work to the repository
    • Right click on CommentingCFrame and click on SVN Commit
    • In Commit Dialog box write a short description (few words) to explain what is being committed and click on ok.
    • Or you can issue the following command:
      svn commit locdir\branches\stdId\CommentingCFrame -m "Added comments to foo() and faa() methods"
  8. Now that the work is done, we want to merge the changes back to trunk
    • First update the whole repository.
    • Right click on trunk and then in TortoiseSVN sub-menu click on merge
    • In merge options, select the second one that is Reintegrate a branch and then click on next
    • In From Url browse and find the branch you just completed your task on and then click on next. (i.e. svn://zenit.senecac.on.ca/oop344_113repXX/branches/stdId/CommentingCFrame)
      If browsing is not available you can use the repo browser to find the path to the branch and copy and paste it.
    • Before merging you can click on test merge to run a simulation and see if the merge is successful
    • click on merge to merge the branch back into trunk.
      note that the merging is happening on your local copy of the code and not the repository
    • Edit and resolve possible conflicts
    • Compile and test the trunk
    • Go to your team page and make sure no one else is committing to trunk (if they are wait for them to finish)
    • Set the status of trunk in your team page to committing
    • commit the changes to trunk
    • Set the status of trunk in your team page back to committed.
    • Or you can issue the following commands:
cd locdir
svn update
cd trunk
svn merge --reintegrate svn://zenit.senecac.on.ca/oop344_113repXX/branches/stdId/CommentingCFrame -m "merging back the comments to trunk"
  • Compile and test the trunk
  • Go to your team page and make sure no one else is committing to trunk (if they are wait for them to finish)
  • Set the status of trunk in your team page to committing
svn commit -m "committing comments added to CFrame"

Note that if the userid and password is not set to be saved, then you need to add

 --username stdId --password stpassword

to the end if each svn command