User Tools

Site Tools


newdevs:git:test

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
newdevs:git:test [2019/06/28 17:07] – created tmccannanewdevs:git:test [2023/06/01 11:58] (current) – udpate branch name from main to master gmcharlton
Line 1: Line 1:
 +**New Developers Working Group**
 ====== Git for Windows ====== ====== Git for Windows ======
  
 ===== Using Git to Test Patches ===== ===== Using Git to Test Patches =====
  
-==== 1. Update Your Local Repository ====+===== 1. Get the Commit Hash =====
  
-  - Open Git Bash +Firstyou will need to identify the unique commit ID (hash) of the patch you wish to test. This is most easily found by clicking on a link in the related launchpad bug. Once  there, copy the first 7+ characters from the unique commit code.
-  - Navigate into your Evergreen repository +
-  - If the master branch isn't currently checked outcheck it out: git checkout master +
-  - Make sure your local repository is current: git pull origin master+
  
-==== 2Identify the Commit ID for the Patch ====+{{ :newdevs:commit-id.jpg?direct&600 |}}
  
-Identify the unique commit identifier for the patch you wish to testThis is found by clicking on a link in the related launchpad bug, or navigating to [[https://git.evergreen-ils.org]] > working/Evergreen.git > clicking on the link under "heads", then clicking on the branch. Once  there, copy the first 7+ characters from the unique commit code.+===== 2Load the Patch to Your Test Server =====
  
-{{ :newdevs:commit-id.jpg?direct&600 |}}+The next steps will be somewhat different depending on whether you have direct access to a test server that has Git installed or whether you have file access via WinSCP or another file transfer program. 
  
-==== 3. Create a Local Testing Branch ====+===== Option A: Testing When You Have File Access to Your Test Server =====
  
-  - Create and checkout a local testing branch: git checkout -b lp12345 +==== A1Update Your Local Repository ====
-  - Pull changes into the testing branch using the unique commit id: git cherry-pick 7ab7281f5 +
-  - Test the changes on your test server.+
  
-**//NEED MORE INFO +  - Open Git Bash on your computer. 
-    * If you have direct Git Bash access to your test server... Need Additional Information how do changes get compiled? Through a git merge ?  +  - Navigate into your Evergreen repository. 
-    * If you do not have Git Bash access to your test server, but you have file system access to your test server through WinSCP or a similar FTP-style program, manually copy the changed files to your server for testing. +  If the main branch isn't currently checked out, check it out: **git checkout main** 
-//**+  Make sure your local repository is current: **git pull**
  
-==== 4. Create a Sign-Off Branch ====+==== A2. Create a Testing Branch ====
  
-If testing is //not// successfulupdate the launchpad bug report with details.+  - Create and checkout a local testing branch: **git checkout -b lp12345_branch_name**  
 +    * This branch does not have to have the same name as the branch you will be testingbut it makes it easier to keep track of.  
 +  - Pull changes into the testing branch using the unique commit id: **git cherry-pick 7ab7281f5** 
 +    * If you receive an error while cherry picking, you can stop it: **git cherry-pick --abort** 
 +    * If the branch has multiple commits, you can cherry-pick them one at a time (oldest to newest) or you can cherry-pick a range of commits at once (oldest to newest): **git cherry-pick 7ab7281f5^..8lgls9a34**
  
-If testing //is// successful, acknowledge it by adding a sign-off branch:+==== A3. Upload Changed Files ====
  
-//** NEED BETTER INSTRUCTIONS HERE I still don'quite understand how to create branch that only contains sign-off - does it contain all the changed files AND the sign-off? Or just the sign-off? **//+Using WinSCP (or your other FTP-style program), transfer each of the changed files in the patch from your local repository to the related 'installed' locations on the server. (See [[https://wiki.evergreen-ils.org/doku.php?id=newdevs:landscape:tree]] 
 + 
 + 
 + 
 +===== Option B: Testing When You Have Direct Git Access to Your Test Server ===== 
 + 
 +//Note: Your test server does not need to have an SSH key if you are just pulling branches for testing. Instead, you can set up your connection to the remote working repo as read-only: <nowiki>git://git.evergreen-ils.org:working/Evergreen.git</nowiki>// 
 + 
 +==== B1. Update Your Repository ==== 
 + 
 +  - Open Git Bash on the server as the root user. 
 +  - Navigate into your Evergreen repository. 
 +  - If the main branch isn'currently checked out, check it out: git checkout main 
 +  - Make sure your local repository is current: **git pull** 
 + 
 +==== B2. Create Testing Branch ==== 
 + 
 +  - Create and checkout local testing branch: **git checkout -b lp12345_branch_name**  
 +    * This branch does not have to have the same name as the branch you will be testing, but it makes it easier to keep track of.  
 +  Pull changes into the testing branch using the unique commit id: **git cherry-pick 7ab7281f5** 
 +    * If you receive an error while cherry picking, you can stop it: **git cherry-pick --abort 
 +** 
 +==== B3. Upload Changed Files ==== 
 + 
 +Copy each file to the 'installed' directory. For example:
  
 <code bash> <code bash>
-git push working lp12345:user/my-user-name/lp12345-signoff+cp Open-ILS/src/templates/header.tt2 /openils/var/templates/header.tt2
 </code> </code>
  
 +===== 3. Restart Services as Needed =====
  
-==== 5Update Launchpad ====+If you are only testing changes to template (tt2) files or basic javascript files, then just clearing the browser cache may be sufficient
  
-  - In the relevant launchpad butadd the "signedoff" tag. +If you are testing changes to configuration filesPerl filesor javascript files, you may also need to restart various services (these instructions require command line access to the root user on the test server).
-  - Alsoadd a link in the comments to your sign-off branch.+
  
-===== Useful Git Bash Commands =====+To restart OpenSRF (this restarts Evergreen): 
 +<code bash> 
 +su - opensrf -c "bash -i -c '/openils/bin/osrf_control --localhost --restart-all'" 
 +</code>
  
-**Git Commands** +To restart Autogen (this refreshes the org unit treeincorporates field mapper changes, etc.): 
-  * git add myfile.txt --> stage a specific file +<code bash
-  * git add -A --> stage all modified files in the current directory and subdirectories +su opensrf -/openils/bin/autogen.sh 
-  * git add . --> (Note the period) stage all modified files in the current directory but not subdirectories +</code>
-  * git branch --> list existing local branches +
-  * git branch mynewbranch --> create a new branch +
-  * git branch -m oldbranchname newbranchname --> change name of branch +
-  * git branch -D branchname --> delete a local branch (cannot delete a branch you currently have checked outso switch to different branch first) +
-  * git checkout mybranch --> check out an existing branch +
-  * git checkout -b mynewbranch --> create a new branch and check it out at the same time +
-  * git checkout master --> switch to master branch +
-  * git checkout -- docname.tt2 --> resets a file you've changed back to its original state (like an undo / revert changes command) +
-  * git clone <nowiki>git://git.evergreen-ils.org/Evergreen.git</nowiki> --> clones a remote repository +
-  * git commit --> invoke the default text editor to add a commit message +
-  * git commit -m "my commit message" --> add brief commit message instead of opening the text editor to add a commit message +
-  * git commit <nowiki>--amend --> overwrite your last commit message +
-  * git commit <nowiki>--amend --signoff</nowiki> --> view and amend your sign-off branch +
-  * git commit -a --> combine the git add and git commit steps into a single step (does //not// include newly created files) +
-  * git config <nowiki>--global</nowiki> -l --> list all global configuration values +
-  * git config <nowiki>--global</nowiki> keyname "value" --> create a global value +
-  * git fetch <nowiki>--all</nowiki> --> refresh your local cache from the remote branches (does not download new branches) +
-  * git help --> access the built-in Git help documentation+
-  * git log <nowiki>--oneline</nowiki--> list previous commits with their unique ids +
-  * git pull --> imports all updates from your default remote repo to your default local repo (usually, this is equivalent to 'git pull origin master'+
-  * git pull origin master --> import all updates from remote origin repo to local master repo +
-  * git pull <nowiki>--rebase</nowiki> origin master --> rebases (rather than merges) new remote changes to your local repository +
-  * git push working mybranchname --> push changes to the remote working directory +
-  * git push working <nowiki>--</nowiki>delete mybranchname --> delete a remote branch +
-  * git remote -v --> display remote directories +
-  * git reset HEAD myfile.txt --> unstage a file that has already been staged +
-  * git reset <nowiki>--hard</nowiki> --> reset a current branch to its original state +
-  * git rm badfile.txt --> delete a file (if the file is being tracked, be sure to add a commit message indicating the file has been deleted) +
-  * git show <nowiki>--stat</nowiki> --> see what your commit will look like before you push it +
-  * git status --> display status of current branch +
-  * git version --> displays the installed version of Git+
  
-**Other Commands** +To restart Apache and WebSockets (the underlying servers/protocols): 
-  * cd --move back to the home folder +<code bash
-  * cd foldername --> move from the current folder to a child folder +systemctl restart apache2 websocketd-osrf 
-  * cd .. --move up in the folder hierarchy one level +</code> 
-  * clear --clears your command window giving you a fresh screen to work with + 
-  * ls --> list all of the folders and files in the current folder +//If// your test server is running the NGINX http/proxy server, you can also restart that: 
-  * mkdir newfoldername --> create a new folder +<code bash
-  * notepad++ newdocname.txt --> create a new file and open it in notepad++ +systemctl restart nginx 
-  * notepad++ docname.txt --> edit an existing file in notepad++ +</code> 
-  * pwd --> see what folder you are currently in+ 
 +If you are testing very large changes, or changes that modify the database, you may need to rebuild the Evergreen installation. This requires significant Linux knowledge to do, and instructions are located at: [[https://evergreen-ils.org/documentation/install/README_3_3.html]] 
 + 
 + 
 +===== 4Test ===== 
 + 
 +Test everything thoroughly to be sure it solves the problem that the developer wanted to solve. Be sure to test any other related pages/features to be sure that the new changes do not break any existing functionality. 
 + 
 +===== 5Create a Sign-Off Branch ===== 
 + 
 +If testing is //not// successful, update the launchpad bug report with details.
  
 +If testing //is// successful, acknowledge it by adding a **[[newdevs:git:signoff|sign-off branch]]**.
  
  
newdevs/git/test.1561756029.txt.gz · Last modified: 2022/02/10 13:34 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.