Actions

Difference between revisions of "Git for Testers and Trackers"

From Joomla! Documentation

m (Eclipse: update)
m (Video applying a patch using Github and PHPstorm: change to widget)
 
Line 1: Line 1:
'''Note''': if you want to try a easy way for testing patches without learning git check this page: [[Component Patchtester for Testers]]
 
 
 
The following tasks are the typical ones needed for the Testing and Tracker teams.
 
The following tasks are the typical ones needed for the Testing and Tracker teams.
  
Line 10: Line 8:
 
# '''Reset files to unmodified state.'''
 
# '''Reset files to unmodified state.'''
 
# '''Work with older versions.'''
 
# '''Work with older versions.'''
 +
 +
{{tip|If you want to try a easy way for testing patches without learning git check this page: [[Component Patchtester for Testers]]}}
  
 
== Testing and Tracker Teams Work Flow ==
 
== Testing and Tracker Teams Work Flow ==
Line 29: Line 29:
  
 
=== CLI Commands ===
 
=== CLI Commands ===
# Navigate to your project root folder ( for example, <code>c:\xampp\htdocs\joomla-cms</code> ).
+
# Navigate to your project root folder, for example: <code>c:\xampp\htdocs\joomla-cms</code>
 
# Enter command: <code>git clone <nowiki>git://github.com/joomla/joomla-cms.git</nowiki></code>. The system will work for a few minutes, copying the entire remote repository to your local system. When you are done, you will have a local copy of the Joomla CMS repository in the current directory, along with a git repository (in the .git subdirectory). Note that this URL points to the joomla-cms project on Github. This project becomes the remote origin for the local git repository. For example, the command <code>git remote -v</code> will now list origin as follows:
 
# Enter command: <code>git clone <nowiki>git://github.com/joomla/joomla-cms.git</nowiki></code>. The system will work for a few minutes, copying the entire remote repository to your local system. When you are done, you will have a local copy of the Joomla CMS repository in the current directory, along with a git repository (in the .git subdirectory). Note that this URL points to the joomla-cms project on Github. This project becomes the remote origin for the local git repository. For example, the command <code>git remote -v</code> will now list origin as follows:
 
<div style="margin-left:42px;">
 
<div style="margin-left:42px;">
Line 71: Line 71:
 
=== TortoiseGit ===
 
=== TortoiseGit ===
 
# Make sure you are on the master branch by entering TortoiseGit&rarr;Switch/Checkout and selecting the "master" branch.
 
# Make sure you are on the master branch by entering TortoiseGit&rarr;Switch/Checkout and selecting the "master" branch.
# Pull changes from origin. Right-click on the project folder, and select TortoiseGit&rarr;Pull as shown below. [[Image:Tortoisegit-tutorial-screenshot-20120612-05.png|Tortoisegit-tutorial-screenshot-20120612-05.png]]
+
# Pull changes from origin. Right-click on the project folder, and select TortoiseGit&rarr;Pull as shown below. {{-}}[[Image:Tortoisegit-tutorial-screenshot-20120612-05.png|Tortoisegit-tutorial-screenshot-20120612-05.png]]
# In Remote, select "origin" as shown below and press OK. [[Image:Tortoisegit-tutorial-screenshot-20120612-06.png|Tortoisegit-tutorial-screenshot-20120612-06.png]]
+
# In Remote, select "origin" as shown below and press OK. {{-}}[[Image:Tortoisegit-tutorial-screenshot-20120612-06.png|Tortoisegit-tutorial-screenshot-20120612-06.png]]
# The system will show a success message as follows. [[Image:Tortoisegit-tutorial-screenshot-20120612-05.png|Tortoisegit-tutorial-screenshot-20120612-05.png]]
+
# The system will show a success message as follows. {{-}}[[Image:Tortoisegit-tutorial-screenshot-20120612-05.png|Tortoisegit-tutorial-screenshot-20120612-05.png]]
  
 
== Important Notes About Patch File Format ==
 
== Important Notes About Patch File Format ==
Line 113: Line 113:
 
# Click Next to show the Target Resource window. Select the PHP project to apply to patch and click Next.
 
# Click Next to show the Target Resource window. Select the PHP project to apply to patch and click Next.
 
# The Review Patch window will show. IMPORTANT: If the patch is in Git format, set "Ignore leading path elements" to 1. If the patch is in SVN format, this is not needed.
 
# The Review Patch window will show. IMPORTANT: If the patch is in Git format, set "Ignore leading path elements" to 1. If the patch is in SVN format, this is not needed.
# At this point, if the patch will apply correctly, the files will show with a blue arrow as shown below.[[File:Git-document-screenshot-20120530-02.png|Git-document-screenshot-20120530-02.png]]
+
# At this point, if the patch will apply correctly, the files will show with a blue arrow as shown below.{{-}}[[File:Git-document-screenshot-20120530-02.png|Git-document-screenshot-20120530-02.png]]
  
 
Note: If a red "X" appears next to a file, it means the patch will not apply correctly. Check the patch file format to make sure you have the right setting for this type. Also, make sure you haven't already applied the patch.
 
Note: If a red "X" appears next to a file, it means the patch will not apply correctly. Check the patch file format to make sure you have the right setting for this type. Also, make sure you haven't already applied the patch.
  
 
=== TortoiseGit ===
 
=== TortoiseGit ===
# To apply a Git format patch: TortoiseGit&rarr;Review/apply single patch. [[File:Tortoisegit-tutorial-screenshot-20120612-08.png|Tortoisegit-tutorial-screenshot-20120612-08.png]]
+
# To apply a Git format patch: TortoiseGit&rarr;Review/apply single patch. {{-}}[[File:Tortoisegit-tutorial-screenshot-20120612-08.png|Tortoisegit-tutorial-screenshot-20120612-08.png]]
# The following windows will show the files to be patched. [[File:Tortoisegit-tutorial-screenshot-20120612-09.png|Tortoisegit-tutorial-screenshot-20120612-09.png]]
+
# The following windows will show the files to be patched. {{-}}[[File:Tortoisegit-tutorial-screenshot-20120612-09.png|Tortoisegit-tutorial-screenshot-20120612-09.png]]
# Click on the button "Patch all items". The screen will now show the changes to the last file in the patch as follows. [[File:Tortoisegit-tutorial-screenshot-20120612-10.png|Tortoisegit-tutorial-screenshot-20120612-10.png]]
+
# Click on the button "Patch all items". The screen will now show the changes to the last file in the patch as follows. {{-}}[[File:Tortoisegit-tutorial-screenshot-20120612-10.png|Tortoisegit-tutorial-screenshot-20120612-10.png]]
  
 
=== Video applying a patch using Github and PHPstorm ===
 
=== Video applying a patch using Github and PHPstorm ===
This 1 minute video shows how a .patch file is downloaded and added to your current PHPStorm project: {{#ev:youtube|7xdwNFPJdWk}}
+
This 1 minute video shows how a .patch or .diff file is downloaded and added to your current PHPStorm project: {{#widget:YouTube|7xdwNFPJdWk}}
  
 
== Apply Patches and Pull Requests Using Branches ==
 
== Apply Patches and Pull Requests Using Branches ==
Line 131: Line 131:
 
# Create a new branch: <code>git branch issue-123</code> (creates a new branch called issue-123).
 
# Create a new branch: <code>git branch issue-123</code> (creates a new branch called issue-123).
 
# Apply the patch as shown earlier.
 
# Apply the patch as shown earlier.
# Commit the code change to the branch: <code>commit -a</code>. Now git will open the editor you chose when you installed git. Enter the commit message in the first line of the editor and save and exit. (If you are unfamiliar with the editor, you can either change the editor or use Eclipse, which bypasses this step in the process.) The commit message should be something short that tells you what you did, for example "Applied patch 123.patch").  
+
# Commit the code change to the branch: <code>commit -a</code>. Now git will open the editor you chose when you installed git. Enter the commit message in the first line of the editor and save and exit. (If you are unfamiliar with the editor, you can either change the editor or use Eclipse, which bypasses this step in the process.) The commit message should be something short that tells you what you did, for example "Applied patch 123.patch"). OR You can commit the code change to the branch wihtout opening editor using <code>commit -a -m "<type_your_message_here>"</code>
 
# At this point, the branch contains the modified version of the Joomla files for you to test. You can easily switch back to the standard files with the command: <code>git checkout master</code>. To switch back to the modified version, use the command: <code>git checkout issue-123</code>.
 
# At this point, the branch contains the modified version of the Joomla files for you to test. You can easily switch back to the standard files with the command: <code>git checkout master</code>. To switch back to the modified version, use the command: <code>git checkout issue-123</code>.
  
Line 137: Line 137:
 
# Create a new branch: Team&rarr;Switch To&rarr;New Branch. The Create a new branch window will show. Enter the name of the branch and click on Finish.
 
# Create a new branch: Team&rarr;Switch To&rarr;New Branch. The Create a new branch window will show. Enter the name of the branch and click on Finish.
 
# Apply the patch as shown earlier.
 
# Apply the patch as shown earlier.
# Commit the code change: Team&rarr;Commit. The Commit Changes window will show. Enter the commit message as shown in the example below.[[Image:Git-document-screenshot-20120530-03.png|Git-document-screenshot-20120530-03.png]]At this point, you can review the code changes or simply press the Commit button to commit the changes.
+
# Commit the code change: Team&rarr;Commit. The Commit Changes window will show. Enter the commit message as shown in the example below.{{-}}[[Image:Git-document-screenshot-20120530-03.png|Git-document-screenshot-20120530-03.png]]{{-}} At this point, you can review the code changes or simply press the Commit button to commit the changes.
 
# To switch back to master or any other branch, again use Team&rarr;Switch To and select master or the desired branch.
 
# To switch back to master or any other branch, again use Team&rarr;Switch To and select master or the desired branch.
  
Line 168: Line 168:
  
 
=== TortoiseGit ===
 
=== TortoiseGit ===
# Use this command to undo any file changes: TortoiseGit&rarr;Revert. [[File:Tortoisegit-tutorial-screenshot-20120612-21.png|Tortoisegit-tutorial-screenshot-20120612-21.png]]  
+
# Use this command to undo any file changes: TortoiseGit&rarr;Revert. {{-}}[[File:Tortoisegit-tutorial-screenshot-20120612-21.png|Tortoisegit-tutorial-screenshot-20120612-21.png]]  
#* Any changed files will show in a window as follows. [[File:Tortoisegit-tutorial-screenshot-20120612-22.png|Tortoisegit-tutorial-screenshot-20120612-22.png]]
+
#* Any changed files will show in a window as follows. {{-}}[[File:Tortoisegit-tutorial-screenshot-20120612-22.png|Tortoisegit-tutorial-screenshot-20120612-22.png]]
#* Check all changed files and click OK. The success screen will show as follows. [[File:Tortoisegit-tutorial-screenshot-20120612-22a.png|Tortoisegit-tutorial-screenshot-20120612-22a.png]]
+
#* Check all changed files and click OK. The success screen will show as follows. {{-}}[[File:Tortoisegit-tutorial-screenshot-20120612-22a.png|Tortoisegit-tutorial-screenshot-20120612-22a.png]]
# Use this command to delete any new files: TortoiseGit&rarr;Clean up. [[File:Tortoisegit-tutorial-screenshot-20120612-23.png|Tortoisegit-tutorial-screenshot-20120612-23.png]] The system will show a success window and the files that were deleted as follows. [[File:Tortoisegit-tutorial-screenshot-20120612-24.png|Tortoisegit-tutorial-screenshot-20120612-24.png]]
+
# Use this command to delete any new files: TortoiseGit&rarr;Clean up. {{-}}[[File:Tortoisegit-tutorial-screenshot-20120612-23.png|Tortoisegit-tutorial-screenshot-20120612-23.png]]{{-}} The system will show a success window and the files that were deleted as follows. {{-}}[[File:Tortoisegit-tutorial-screenshot-20120612-24.png|Tortoisegit-tutorial-screenshot-20120612-24.png]]
  
 
== Restore to Unmodified State With Branches ==
 
== Restore to Unmodified State With Branches ==
Line 185: Line 185:
  
 
===TortoiseGit ===
 
===TortoiseGit ===
# Change back to the master branch: TortoiseGit&rarr;Switch/Checkout. [[File:Tortoisegit-tutorial-screenshot-20120612-13.png|Tortoisegit-tutorial-screenshot-20120612-13.png]]
+
# Change back to the master branch: TortoiseGit&rarr;Switch/Checkout. {{-}}[[File:Tortoisegit-tutorial-screenshot-20120612-13.png|Tortoisegit-tutorial-screenshot-20120612-13.png]]
# Select master as shown here. [[File:Tortoisegit-tutorial-screenshot-20120612-25.png|Tortoisegit-tutorial-screenshot-20120612-25.png]]
+
# Select master as shown here. {{-}}[[File:Tortoisegit-tutorial-screenshot-20120612-25.png|Tortoisegit-tutorial-screenshot-20120612-25.png]]
 
# Delete the desired branch:  
 
# Delete the desired branch:  
#* TortoiseGit&rarr;Show Log as shown here. [[File:Tortoisegit-tutorial-screenshot-20120612-19.png|Tortoisegit-tutorial-screenshot-20120612-19.png]]
+
#* TortoiseGit&rarr;Show Log as shown here. [{{-}}[File:Tortoisegit-tutorial-screenshot-20120612-19.png|Tortoisegit-tutorial-screenshot-20120612-19.png]]
#* Right-click on the HEAD line and select Delete branch/tag&rarr;<name of the branch> as shown here. [[File:Tortoisegit-tutorial-screenshot-20120612-26.png|Tortoisegit-tutorial-screenshot-20120612-26.png]]
+
#* Right-click on the HEAD line and select Delete branch/tag&rarr;<name of the branch> as shown here. {{-}}[[File:Tortoisegit-tutorial-screenshot-20120612-26.png|Tortoisegit-tutorial-screenshot-20120612-26.png]]
  
 
== Testing Older Versions of Trunk ==
 
== Testing Older Versions of Trunk ==
Line 202: Line 202:
 
=== Eclipse ===
 
=== Eclipse ===
  
# Open the History View: Team&rarr;Show in History. This will show a view similar to this:
+
# Open the History View: Team&rarr;Show in History. This will show a view similar to this:{{-}}[[Image:Git-document-screenshot-20120530-04.png|900px]]{{-}}This view shows every commit to the CMS repository. To restore your local files to a prior time, right click on the desired row in the history view and select Checkout. Your local files will be changed to the state as of that commit. You can now test that version.  
:[[Image:Git-document-screenshot-20120530-04.png|900px]]
+
This view shows every commit to the CMS repository. To restore your local files to a prior time, right click on the desired row in the history view and select Checkout. Your local files will be changed to the state as of that commit. You can now test that version.  
+
 
# To change to a different version, repeat this process. To change back to the master branch (the latest version), do Team&rarr;Switch to&rarr;Master.
 
# To change to a different version, repeat this process. To change back to the master branch (the latest version), do Team&rarr;Switch to&rarr;Master.
  
 
=== TortoiseGit ===
 
=== TortoiseGit ===
# Open the Log window. TortoiseGit&rarr;Show Log as shown here. [[File:Tortoisegit-tutorial-screenshot-20120612-19.png|Tortoisegit-tutorial-screenshot-20120612-19.png]]
+
# Open the Log window. TortoiseGit&rarr;Show Log as shown here. {{-}}[[File:Tortoisegit-tutorial-screenshot-20120612-19.png|Tortoisegit-tutorial-screenshot-20120612-19.png]]
# Right-click on the desired commit in the log listing and select Switch/Checkout to this... as shown here. [[File:Tortoisegit-tutorial-screenshot-20120612-27.png|Tortoisegit-tutorial-screenshot-20120612-27.png]] You can now test that version.
+
# Right-click on the desired commit in the log listing and select Switch/Checkout to this... as shown here. {{-}}[[File:Tortoisegit-tutorial-screenshot-20120612-27.png|Tortoisegit-tutorial-screenshot-20120612-27.png]]{{-}} You can now test that version.
 
# To change to a different version, repeat this process. To change back to the master branch (the latest version), do TortoiseGit&rarr;Switch/Checkout and select master.
 
# To change to a different version, repeat this process. To change back to the master branch (the latest version), do TortoiseGit&rarr;Switch/Checkout and select master.
  
Line 216: Line 214:
 
[[Category:GitHub]]
 
[[Category:GitHub]]
 
[[Category:Video]]
 
[[Category:Video]]
 +
[[Category:Testing]]

Latest revision as of 21:22, 15 February 2014