From Fedora Project Wiki

(Update git repository creation commands)
Line 60: Line 60:


== Git Repository ==
== Git Repository ==
You'll need to know three things in order to start the git repository.
You'll need to know several things in order to start the git repository.
# PROJECTNAME -- what the project wants to be called.
# PROJECTNAME -- what the project wants to be called.
# OLDURL -- how to access the project's current source code in their git repository.
# OLDURL -- how to access the project's current source code in their git repository.
Line 72: Line 72:
<pre>
<pre>
$ cd /git
$ cd /git
$ sudo git clone --bare $OLDURL $PROJECTNAME.git (or sudo mkdir $PROJECTNAME.git; pushd $PROJECTNAME.git; GIT_DIR=. sudo git init-db --shared=true; add a file; popd)
 
$ sudo rm $PROJECTNAME.git/hooks/post-update
$ # Clone an existing repository:
$ sudo ln -s /usr/bin/git-update-server-info $PROJECTNAME.git/hooks/post-update
$ sudo git clone --bare $OLDURL $PROJECTNAME.git
$ cd $PROJECTNAME.git; GIT_DIR=. sudo git-update-server-info; cd ../
$ sudo git --git-dir $PROJECTNAME.git config core.sharedRepository true
$ #
$ ## or
$ #
$ # Create a new repository:
$ sudo mkdir $PROJECTNAME.git
$ sudo git --git-dir=$PROJECTNAME.git --bare init --shared=true
 
$ # Give the repository a nice description for gitweb
$ echo $DESCRIPTION | sudo tee description > /dev/null
 
$ # Setup and run post-update hook.
$ # (We symlink this because /git is on a filesystem with noexec set)
$ sudo ln -svf $(git --exec-path)/git-update-server-info $PROJECTNAME.git/hooks/post-update
$ sudo git --git-dir=$PROJECTNAME.git update-server-info
 
$ # Ensure ownership and modes are correct
$ sudo find $PROJECTNAME.git -type d -exec chmod g+s \{\} \;
$ sudo find $PROJECTNAME.git -type d -exec chmod g+s \{\} \;
$ sudo chmod -R g+w $PROJECTNAME.git
$ sudo find $PROJECTNAME.git -perm /u+w -a ! -perm /g+w -exec chmod g+w \{\} \;
$ sudo chown -R $PROJECTOWNER:$PROJECTGROUP $PROJECTNAME.git
$ sudo chown -R $PROJECTOWNER:$PROJECTGROUP $PROJECTNAME.git
</pre>
</pre>


If you don't have any files in the repository then git will balk about it. Do this on hosted1 to make your repo work:
This should setup all the files needed for the repository. The repository owner can push changes into the repo by running:
 
<pre>
<pre>
$ cd
$ git push ssh://git.fedorahosted.org/git/$PROJECTNAME.git/ master
$ git clone /git/$PROJECTNAME.git
$ cd $PROJECTNAME
$ touch file
$ git add file
$ git commit
$ git push /git/$PROJECTNAME.git/ master
</pre>
</pre>
 
from within their local git repository.
This should setup all the files needed for the repository.


=== Commit Mail ===
=== Commit Mail ===
If they want commit mail, then there are a couple of additional steps.
If they want commit mail, then there are a couple of additional steps.
<pre>
<pre>
$ echo $COMMITLIST > commit-list
$ echo $COMMITLIST | sudo tee commit-list > /dev/null
$ echo $DESCRIPTION > description
$ sudo ln -svf /usr/bin/fedora-git-commit-mail-hook hooks/update
$ ln -s /usr/bin/fedora-git-commit-mail-hook hooks/update
</pre>
</pre>



Revision as of 05:43, 18 June 2009


Fedora hosted has public repositories for git, bazaar, mercurial, and subversion. These are instructions for adding a new project to one of them.

Note.png
Monotone support has been discontinued due to both lack of a sysadmin to maintain it and lack of projects wanting to use it.

Mercurial Repository

You'll need to know three things in order to start the mercurial repository.

  1. PROJECTNAME -- what the project wants to be called.
  2. OLDURL -- how to access the project's current sourcecode in their mercurial repository.
  3. PROJECTGROUP -- the group setup in the account system for readwrite access to the repository.

The Mercurial repository lives on the hosted server. Access it by logging into hosted1 Then follow these steps:

$ cd /hg
$ sudo hg clone -U $OLDURL $PROJECTNAME (or sudo mkdir $PROJECTNAME; cd $PROJECTNAME; sudo hg init)
$ sudo find $PROJECTNAME -type d -exec chmod g+s \{\} \;
$ sudo chmod -R g+w $PROJECTNAME
$ sudo chown -R root:$PROJECTGROUP $PROJECTNAME

This should setup all the files needed for the repository.

Commit Mail

The Mercurial Notify extension can be used to send out email when commits are pushed to a Mecurial repository. To enable notifications, create the file /hg/$PROJECTNAME/.hg/hgrc:

[extensions] 
hgext.notify =

[hooks] 
changegroup.notify = python:hgext.notify.hook

[email] 
from = admin@fedoraproject.org

[smtp] 
host = localhost

[web] 
baseurl = http://hg.fedoraproject.org/hg

[notify] 
sources = serve push pull bundle
test = False
config = /hg/$PROJECTNAME/.hg/subscriptions
maxdiff = -1

And the file /hg/$PROJECTNAME/.hg/subscriptions:

[usersubs] 

user@host = *

[reposubs] 

Git Repository

You'll need to know several things in order to start the git repository.

  1. PROJECTNAME -- what the project wants to be called.
  2. OLDURL -- how to access the project's current source code in their git repository.
  3. PROJECTGROUP -- the group setup in the account system for write access to the repository.
  4. COMMITLIST -- comma-separated list of email addresses for commits (optional)
  5. DESCRIPTION -- description of the project (optional)
  6. PROJECTOWNER -- the FAS username of the project owner

The git repository lives on the hosted server. Access it by logging into hosted1 Then follow these steps:

$ cd /git

$ # Clone an existing repository:
$ sudo git clone --bare $OLDURL $PROJECTNAME.git
$ sudo git --git-dir $PROJECTNAME.git config core.sharedRepository true
$ #
$ ## or
$ #
$ # Create a new repository:
$ sudo mkdir $PROJECTNAME.git
$ sudo git --git-dir=$PROJECTNAME.git --bare init --shared=true

$ # Give the repository a nice description for gitweb
$ echo $DESCRIPTION | sudo tee description > /dev/null

$ # Setup and run post-update hook.
$ # (We symlink this because /git is on a filesystem with noexec set)
$ sudo ln -svf $(git --exec-path)/git-update-server-info $PROJECTNAME.git/hooks/post-update
$ sudo git --git-dir=$PROJECTNAME.git update-server-info

$ # Ensure ownership and modes are correct
$ sudo find $PROJECTNAME.git -type d -exec chmod g+s \{\} \;
$ sudo find $PROJECTNAME.git -perm /u+w -a ! -perm /g+w -exec chmod g+w \{\} \;
$ sudo chown -R $PROJECTOWNER:$PROJECTGROUP $PROJECTNAME.git

This should setup all the files needed for the repository. The repository owner can push changes into the repo by running:

$ git push ssh://git.fedorahosted.org/git/$PROJECTNAME.git/ master

from within their local git repository.

Commit Mail

If they want commit mail, then there are a couple of additional steps.

$ echo $COMMITLIST | sudo tee commit-list > /dev/null
$ sudo ln -svf /usr/bin/fedora-git-commit-mail-hook hooks/update

Bazaar Repository

You'll need to know three things in order to start a bazaar repository.

  1. PROJECTNAME -- what the project wants to be called.
  2. OLDBRANCHURL -- how to access the project's current sourcecode in their previous bazaar repository. Note that a project may have multiple branches that they want to import. Each branch will have a separate URL. (The project can import the new branches after the repository is created if they want.)
  3. PROJECTGROUP -- the group setup in the account system for readwrite access to the repository.

The bzr repository lives on the hosted server. Access it by logging into hosted1 then follow these steps:

The first stage is to create the Bazaar repository.

$ cd /srv/bzr/
$ # This creates a Bazaar repository which has shared storage between branches
$ sudo bzr init-repo $PROJECTNAME --no-trees
$ cd $PROJECTNAME
$ sudo bzr branch $OLDURL
$ sudo bzr branch $OLDURL2
$ # [...] 
$ sudo bzr branch $OLDURLN
$ cd ..
$ sudo find $PROJECTNAME -type d -exec chmod g+s \{\} \;
$ sudo chmod -R g+w $PROJECTNAME
$ sudo chown -R root:$PROJECTGROUP $PROJECTNAME

This should be all that is needed. To checkout run:

bzr init-repo $MYLOCALPROJECTREPO
cd $MYLOCALPROJECTREPO
bzr branch bzr+ssh://bzr.fedorahosted.org/bzr/$PROJECTNAME/$BRANCHNAME
bzr branch bzr://bzr.fedorahosted.org/bzr/$PROJECTNAME/$BRANCHNAME/

Note: If the end user checks out a branch without creating their own repository they will need to create a local working tree by doing the following:

cd $BRANCHNAME
bzr checkout --lightweight

SVN Repository

You'll need to know two things in order to start a svn repository.

  1. PROJECTNAME -- what the project wants to be called.
  2. PROJECTGROUP -- The Fedora account system group with read-write access.

SVN lives on the hosted server. Access it by logging into hosted1. Then run the following steps:

$ cd /svn/
$ sudo svnadmin create $PROJECTNAME
$ sudo chgrp -R $GROUPNAME $PROJECTNAME
$ sudo chmod -R g+w $PROJECTNAME
$ find $PROJECTNAME -type d | sudo xargs chmod g+s

This should be all that is needed. To checkout run:

svn co svn+ssh://svn.fedorahosted.org/svn/$PROJECTNAME


Monotone Repository *UNFINISHED DRAFT*

You'll need to know these things in order to start the Monotone repository:

  1. PROJECTNAME -- what the project wants to be called.
  2. PROJECTGROUP -- the group setup in the account system for write access to the repository.

The Monotone repository lives on the hosted server. Access it by logging into hosted1. Then follow these steps:

$ cd /mtn/
$ sudo mkdir -m a=rx,g+ws,u+w $PROJECTNAME
$ sudo mtn --db $PROJECTNAME/db.mtn db init
$ sudo chgrp -R $PROJECTGROUP $PROJECTNAME
$ sudo chmod -R g+w $PROJECTNAME

This should be all that is needed. Now you have an empty database. Anyone in the $PROJECTGROUP group can populate it using:

mtn sync ssh://mtn.fedorahosted.org/mtn/hosted/$PROJECTNAME/db.mtn