Introduction
The goal of this page is to describe how to use the Gitorious mirror.
The mirror is basically a svn import of major branch to not polute the branch namespace. Every branch can be added on demand easily.
A cron push each 15minutes the last commits by using a temporary repo that is git-svn aware.
It can be use to do:
- disconnected works with ease.
- repository lookup by various ways
...
You can't commit on the main repo but creating a clone repo on gitorious is easy to track your current work on the internet. Patch management can be done either with raw git or using TopGit for example.
Some numbers
Getting full repo with major branches + full history at 726 KiB/s:
- real 8m18.196s
- user 0m30.498s
- sys 0m15.119s
Size of metadata: 260MB
Create a branch: instant
Full history search with grep mode: git log --pretty=oneline --grep="OpenBSD"
- real 0m1.278s
- user 0m0.652s
- sys 0m0.622s
Account
To work with Gitorious you will need to create an account but it is not mandatory you can work only with the mirror and local git / local server to backup your branches. The main interest in gitorious is that your branch is public and every people can clone your repo and submit merge request using the provided web interface.
Sample scenario
The goal is to simulate an external submission to an official committer.
- The committer: the guy with the commit bit.
- The submitter: the guy that work for the committer.
Everyone need to be registered to gitorious with the ssh key added.
Committer:
The commiter will create his own tree to work on projects
To do that go to http://www.gitorious.org/~fabient/freebsd.
Click on "clone this repository on gitorious" for the example the name is fabient-sandbox.
get the tree using the push url:
[~]$ git clone git@gitorious.org:~fabient/freebsd/fabient-sandbox.git Enter passphrase for key '/home/fabient/.ssh/id_rsa_p': remote: Counting objects: 443130, done. remote: Compressing objects: 100% (101887/101887), done. remote: Total 443130 (delta 335059), reused 442492 (delta 334637) Receiving objects: 100% (443130/443130), 244.18 MiB | 726 KiB/s, done. Resolving deltas: 100% (335059/335059), done. Checking out files: 100% (41509/41509), done. [~]$ cd fabient-sandbox.git
First things is to add upstream remote to keep up to date the clone (they are forked).
[fabient-sandbox (master)]$ git remote add upstream git://gitorious.org/freebsd/freebsd.git
Update to latest upstream
[fabient-sandbox (master)]$ git fetch upstream Enter passphrase for key '/home/fabient/.ssh/id_rsa_p': remote: Counting objects: 913, done. remote: Compressing objects: 100% (469/469), done. remote: Total 475 (delta 378), reused 1 (delta 1) Receiving objects: 100% (475/475), 72.54 KiB | 90 KiB/s, done. Resolving deltas: 100% (378/378), completed with 150 local objects. From git://gitorious.org/freebsd/freebsd * [new branch] master -> upstream/master * [new branch] svn_release_4_11_0 -> upstream/svn_release_4_11_0 * [new branch] svn_release_6_3_0 -> upstream/svn_release_6_3_0 * [new branch] svn_release_6_4_0 -> upstream/svn_release_6_4_0 * [new branch] svn_release_7_0_0 -> upstream/svn_release_7_0_0 * [new branch] svn_release_7_1_0 -> upstream/svn_release_7_1_0 * [new branch] svn_release_7_2_0 -> upstream/svn_release_7_2_0 * [new branch] svn_releng_6_3 -> upstream/svn_releng_6_3 * [new branch] svn_releng_6_4 -> upstream/svn_releng_6_4 * [new branch] svn_releng_7_0 -> upstream/svn_releng_7_0 * [new branch] svn_releng_7_1 -> upstream/svn_releng_7_1 * [new branch] svn_releng_7_2 -> upstream/svn_releng_7_2 * [new branch] svn_stable_6 -> upstream/svn_stable_6 * [new branch] svn_stable_7 -> upstream/svn_stable_7 * [new branch] svn_stable_8 -> upstream/svn_stable_8 * [new branch] svn_svctest -> upstream/svn_svctest * [new branch] svn_trunk -> upstream/svn_trunk
When finished you will create you work branch based on head (master)
[fabient-sandbox (master)]$ git branch work/hwpmc_kcachegrind remotes/upstream/master Branch work/hwpmc_kcachegrind set up to track remote branch master from upstream. [fabient-sandbox (master)]$ git checkout work/hwpmc_kcachegrind Switched to branch 'work/hwpmc_kcachegrind'
Work work work / commit / work /commit
Now after a hard journey push to backup your work
[fabient-sandbox (work/hwpmc_kcachegrind)]$ git push origin work/hwpmc_kcachegrind Enter passphrase for key '/home/fabient/.ssh/id_rsa_p': Total 0 (delta 0), reused 0 (delta 0) => Syncing Gitorious... [OK] To git@gitorious.org:~fabient/freebsd/fabient-sandbox.git * [new branch] work/hwpmc_kcachegrind -> work/hwpmc_kcachegrind
Submitter:
First steps are the same but shifted by one repository. The cloned repository name is fabient-sandbox-clone.
After adding the upstream remote (that point to fabient-sandbox):
[fabient-sandbox-clone (master)]$ git fetch upstream
create a local work tree based on commiter work:
[fabient-sandbox-clone (master)]$ git branch work/hwpmc_kcachegrind remotes/upstream/work/hwpmc_kcachegrind Branch work/hwpmc_kcachegrind set up to track remote branch work/hwpmc_kcachegrind from upstream. [fabient-sandbox-clone (master)]$ git checkout work/hwpmc_kcachegrind Switched to branch 'work/hwpmc_kcachegrind'
work work commit work push work commit push FINISHED
Create a merge request using the gitorious interface by clicking on merge and following the assistant.
Committer:
Handle merge request and if ok follow the intructions to apply to your local tree:
[fabient-sandbox (master)]$ git pull git://gitorious.org/~fabient/freebsd/fabient-sandbox.git refs/merge-requests/1535
Last step commit the git branch to SVN:
[fabient-sandbox (work/hwpmc_kcachegrind)]$ git svn commit-diff -m "git branch to svn" -rHEAD upstream/master work/ hwpmc_kcachegrind svn+ssh://svn.freebsd.org/base/user/fabient/svctest/
Enter passphrase for key '/home/fabient/.ssh/id_rsa_p':
M usr.sbin/pmcstat/Makefile
M usr.sbin/pmcstat/pmcstat.c
M usr.sbin/pmcstat/pmcstat.h
A usr.sbin/pmcstat/pmcstat_logct.c
Committed r197319Git handle add / remove...
If you want a more advanced svn commit with properties:
git diff upstream/master work/hwpmc_kcachegrind
and apply manually
Done!
Merging changes in from upstream
(Ref: http://www.gitready.com/intermediate/2009/02/12/easily-fetching-upstream-changes.html)
Sometimes you may wish to merge changes from the upstream FreeBSD tree. This is different from "git pull", which pulls in changes related to what your current branch is.)
Using the above instructions, which uses a similar naming scheme to this wiki page:
$ git fetch origin -v $ git fetch upstream -v $ git merge upstream/master