|
Christoph Galuschka |
d68dfa |
First Steps with Gitorious and git
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
This file is intended for beginners with git.
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
A few details can be found at
|
|
Christoph Galuschka |
d68dfa |
http://wiki.centos.org/QaWiki/AutomatedTests/WritingTests/t_functional
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
Hopefully this file will answer the remaining questions
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
Git
|
|
Christoph Galuschka |
d68dfa |
---
|
|
Christoph Galuschka |
d68dfa |
Probably all available options on git can be found with "man git". Specific help on an option ie "git fetch" can be found with "git fetch --help"
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
Getting started with gitorious
|
|
Christoph Galuschka |
d68dfa |
------------------------------
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
First you need an account with gitorious:
|
|
Christoph Galuschka |
d68dfa |
https://gitorious.org/users/new
|
|
Christoph Galuschka |
d68dfa |
After registration you will receive an eMail to verify your eMail-Account.
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
Afterwards you can login to gitorious
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
SSH-Keys
|
|
Christoph Galuschka |
d68dfa |
--------
|
|
Christoph Galuschka |
d68dfa |
If you intend to use SSH with git, you have to register your public key with gitorious. Go to "Manage SSH keys" and then "Add SSH key". Copy the content of your key (home-directory/.ssh/id_rsa.pub or home-directory/.ssh/id_dsa.pub into the window and "Save".
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
Cloning t_functional
|
|
Christoph Galuschka |
d68dfa |
--------------------
|
|
Christoph Galuschka |
d68dfa |
At https://gitorious.org/testautomation/t_functional you will find the button "Clone repository". Next you will be asked for a name for your clone - pick a name at your descretion or use the suggestion. Klick "Clone repository" and you have your own copy of t_functional with an SSH-URL that looks something like this:
|
|
Christoph Galuschka |
d68dfa |
git@gitorious.org:<<username>>/testautomation/<<your clone-name>>.git.
|
|
Christoph Galuschka |
d68dfa |
The HTTPS URL looks something like this:
|
|
Christoph Galuschka |
d68dfa |
https://gitorious.org/<<usernamm>>/testautomation/<<your clone-name>>
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
To work
|
|
Christoph Galuschka |
d68dfa |
-------
|
|
Christoph Galuschka |
d68dfa |
To work with your copy, you have to create a local clone on your linux box.
|
|
Christoph Galuschka |
d68dfa |
"yum -y install git" should install all you need to use git.
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
Cloning:
|
|
Christoph Galuschka |
d68dfa |
"git clone <<SSH-URL>> <<destination-dir>>" will create a clone of your gitorious-repo on your local box. You will find your clone at <<destination-dir>>.
|
|
Christoph Galuschka |
d68dfa |
You should set at least two global settings:
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
git config --global user.name "your username"
|
|
Christoph Galuschka |
d68dfa |
git config --global user.email "your email"
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
All git operations work best if executed within your <<destination-dir>>.
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
Within the destination-dir you will find the folder .git. Go there and edit the config-file. Change your user-credentials and add:
|
|
Christoph Galuschka |
d68dfa |
[remote "upstream"]
|
|
Christoph Galuschka |
d68dfa |
url = https://git.gitorious.org/testautomation/t_functional.git
|
|
Christoph Galuschka |
d68dfa |
fetch = +refs/heads/*:refs/remotes/upstream/*
|
|
Christoph Galuschka |
d68dfa |
This allows you to update your clone from the t_functional-master in later steps.
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
Now to work with the test scripts :)
|
|
Christoph Galuschka |
d68dfa |
Lots of good hints to start with can be found ind doc/WritingTests and in the allready available scripts.
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
After you are satisfied with your work, it has to be commited.
|
|
Christoph Galuschka |
d68dfa |
New files will have to be added to git with "git add <<path-to-file/filename>>". You can also use "git add <<path-to-file/*>>".
|
|
Christoph Galuschka |
d68dfa |
A final "git commit --all" will open a vi-like editor. Please enter some comments regarding your changes. After exiting the vi your changes are commit.
|
|
Christoph Galuschka |
d68dfa |
Use "git push" to push theses changes to gitorious.
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
Merge request
|
|
Christoph Galuschka |
d68dfa |
-------------
|
|
Christoph Galuschka |
d68dfa |
Your push (or pushes) to git need to be merged with the t_functional master. This is done with the web-interface. On the webpage of your clone - something like https://gitorious.org/<<username>>/testautomation/<<your_clone>> - press the button "Request merge". Add some comments/notes, scroll down and select your commits up to the point you want to merge (you can keep the dropdown menues unchanged). "Create merge request" will do just that. On https://gitorious.org/testautomation/t_functional you will now find the number of "Merge requests" being increased by 1. Clicking on "Merge Requests" will show you all current and previous requests (possible states are Open, In Review and Closed).
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
d68dfa |
Keeping in sync
|
|
Christoph Galuschka |
d68dfa |
---------------
|
|
Christoph Galuschka |
d68dfa |
With time your gitorious clone and your local copy will drift from the t_functional master (you work on your copy and others work on their copies/master, pushes/commits and merge request happen and so on). The best way to deal with this is to do a local merge of the current master and your local copy:
|
|
Christoph Galuschka |
518959 |
"git fetch upstream" will fetch the current t_functional master from gitorious.
|
|
Christoph Galuschka |
d68dfa |
"git merge upstream/master" will now merge your local copy with the previously fetched master. This effectively writes all master changes to your local copy.
|
|
Christoph Galuschka |
d68dfa |
|
|
Christoph Galuschka |
518959 |
If you work on two different machines - assuming you commit your work after it is done - you can do something similar to keep your second machine in sync with your work and not always have to delete your local copy and do a "git clone ..." again:
|
|
Christoph Galuschka |
518959 |
"git fetch origin" will fetch the current master of YOUR t_functional-clone from gitorious (not the t_functional master).
|
|
Christoph Galuschka |
518959 |
"git merge origin/master" will now update your local copy to the latest commit you pushed to gitorious.
|
|
Christoph Galuschka |
518959 |
|
|
Christoph Galuschka |
518959 |
During these operations you will also see the "version" numbers of the various commits. i.e.:
|
|
Christoph Galuschka |
518959 |
>>
|
|
Christoph Galuschka |
518959 |
me@centos:~/t_functional>git fetch origin
|
|
Christoph Galuschka |
518959 |
remote: Counting objects: 17, done.
|
|
Christoph Galuschka |
518959 |
remote: Compressing objects: 100% (9/9), done.
|
|
Christoph Galuschka |
518959 |
remote: Total 9 (delta 6), reused 0 (delta 0)
|
|
Christoph Galuschka |
518959 |
Unpacking objects: 100% (9/9), done.
|
|
Christoph Galuschka |
518959 |
From gitorious.org:~<<USERNAME>>/testautomation/<<USERNAME>>s-t_functional
|
|
Christoph Galuschka |
518959 |
4a5d56d..33951fe master -> origin/master
|
|
Christoph Galuschka |
518959 |
>>
|
|
Christoph Galuschka |
518959 |
The fetch operation downloaded the differences from 4a5d56d to 33951fe and put them in origin/master.
|
|
Christoph Galuschka |
518959 |
|
|
Christoph Galuschka |
518959 |
>>
|
|
Christoph Galuschka |
518959 |
me@centos:~/t_functional>git merge origin/master
|
|
Christoph Galuschka |
518959 |
Updating 4a5d56d..33951fe
|
|
Christoph Galuschka |
518959 |
Fast-forward
|
|
Christoph Galuschka |
518959 |
tests/p_freeradius/0-install_freeradius.sh | 4 ++--
|
|
Christoph Galuschka |
518959 |
tests/p_gcc/test_gcc.sh | 11 ++---------
|
|
Christoph Galuschka |
518959 |
tests/p_php/10-php-test.sh | 3 +--
|
|
Christoph Galuschka |
518959 |
3 files changed, 5 insertions(+), 13 deletions(-)
|
|
Christoph Galuschka |
518959 |
>>
|
|
Christoph Galuschka |
518959 |
Now my local copy should match the data available online.
|
|
Christoph Galuschka |
518959 |
|
|
Christoph Galuschka |
518959 |
At the time of writing this 33951fe is also the latest version available on the t_functional - master so:
|
|
Christoph Galuschka |
518959 |
>>
|
|
Christoph Galuschka |
518959 |
me@centos:~/t_functional> git merge upstream/master
|
|
Christoph Galuschka |
518959 |
Already up-to-date.
|
|
Christoph Galuschka |
518959 |
>>
|
|
Christoph Galuschka |
518959 |
There is no difference between the t_functional clone and the t_functiomal master so 'Already up-to-date' (as the last push to the master was the authors last commit to his clone and a subsequent merge request).
|
|
Christoph Galuschka |
518959 |
|
|
Christoph Galuschka |
518959 |
Last ressort
|
|
Christoph Galuschka |
518959 |
------------
|
|
Christoph Galuschka |
518959 |
|
|
Christoph Galuschka |
195fe3 |
If - for any reason - you are unable to sync your repos correctly, you can always delete your clone at gitorious and
|
|
Christoph Galuschka |
195fe3 |
create a new one.
|
|
Christoph Galuschka |
195fe3 |
|
|
Christoph Galuschka |
d68dfa |
Happy git'ing and testing!
|