=encoding utf8 =for comment Consistent formatting of this file is achieved with: perl ./Porting/podtidy pod/perlrepository.pod =head1 NAME perlrepository - Using the Perl source repository =head1 SYNOPSIS All of Perl's source code is kept centrally in a Git repository at I. The repository contains many Perl revisions from Perl 1 onwards and all the revisions from Perforce, the version control system we were using previously. This repository is accessible in different ways. The full repository takes up about 80MB of disk space. A check out of the blead branch (that is, the main development branch, which contains bleadperl, the development version of perl 5) takes up about 160MB of disk space (including the repository). A build of bleadperl takes up about 200MB (including the repository and the check out). =head1 Getting access to the repository =head2 Read access via the web You may access the repository over the web. This allows you to browse the tree, see recent commits, subscribe to RSS feeds for the changes, search for particular commits and more. You may access it at: http://perl5.git.perl.org/perl.git A mirror of the repository is found at: http://github.com/mirrors/perl =head2 Read access via Git You will need a copy of Git for your computer. You can fetch a copy of the repository using the Git protocol (which uses port 9418): % git clone git://perl5.git.perl.org/perl.git perl-git This clones the repository and makes a local copy in the F directory. If your local network does not allow you to use port 9418, then you can fetch a copy of the repository over HTTP (this is at least 4x slower): % git clone http://perl5.git.perl.org/perl.git perl-http This clones the repository and makes a local copy in the F directory. =head2 Write access to the repository If you are a committer, then you can fetch a copy of the repository that you can push back on with: % git clone ssh://perl5.git.perl.org/perl.git perl-ssh This clones the repository and makes a local copy in the F directory. If you cloned using the git protocol, which is faster than ssh, then you will need to modify the URL for the origin remote to enable pushing. To do that edit F<.git/config> with git-config(1) like this: % git config remote.origin.url ssh://perl5.git.perl.org/perl.git You can also set up your user name and e-mail address. Most people do this once globally in their F<~/.gitconfig> by doing something like: % git config --global user.name "Ævar Arnfjörð Bjarmason" % git config --global user.email avarab@gmail.com However if you'd like to override that just for perl then execute then execute something like the following in F: % git config user.email avar@cpan.org It is also possible to keep C as a git remote, and add a new remote for ssh access: % git remote add camel perl5.git.perl.org:/perl.git This allows you to update your local repository by pulling from C, which is faster and doesn't require you to authenticate, and to push your changes back with the C remote: % git fetch camel % git push camel The C command just updates the C refs, as the objects themselves should have been fetched when pulling from C. =head2 A note on camel and dromedary The committers have SSH access to the two servers that serve C. One is C itself (I), which is the 'master' repository. The second one is C (I), which can be used for general testing and development. Dromedary syncs the git tree from camel every few minutes, you should not push there. Both machines also have a full CPAN mirror in /srv/CPAN, please use this. To share files with the general public, dromedary serves your ~/public_html/ as C These hosts have fairly strict firewalls to the outside. Outgoing, only rsync, ssh and git are allowed. For http and ftp, you can use http://webproxy:3128 as proxy. Incoming, the firewall tries to detect attacks and blocks IP addresses with suspicious activity. This sometimes (but very rarely) has false positives and you might get blocked. The quickest way to get unblocked is to notify the admins. These two boxes are owned, hosted, and operated by booking.com. You can reach the sysadmins in #p5p on irc.perl.org or via mail to C =head1 Overview of the repository Once you have changed into the repository directory, you can inspect it. After a clone the repository will contain a single local branch, which will be the current branch as well, as indicated by the asterisk. % git branch * blead Using the -a switch to C will also show the remote tracking branches in the repository: % git branch -a * blead origin/HEAD origin/blead ... The branches that begin with "origin" correspond to the "git remote" that you cloned from (which is named "origin"). Each branch on the remote will be exactly tracked by theses branches. You should NEVER do work on these remote tracking branches. You only ever do work in a local branch. Local branches can be configured to automerge (on pull) from a designated remote tracking branch. This is the case with the default branch C which will be configured to merge from the remote tracking branch C. You can see recent commits: % git log And pull new changes from the repository, and update your local repository (must be clean first) % git pull Assuming we are on the branch C immediately after a pull, this command would be more or less equivalent to: % git fetch % git merge origin/blead In fact if you want to update your local repository without touching your working directory you do: % git fetch And if you want to update your remote-tracking branches for all defined remotes simultaneously you can do % git remote update Neither of these last two commands will update your working directory, however both will update the remote-tracking branches in your repository. To make a local branch of a remote branch: % git checkout -b maint-5.10 origin/maint-5.10 To switch back to blead: % git checkout blead =head2 Finding out your status The most common git command you will use will probably be % git status This command will produce as output a description of the current state of the repository, including modified files and unignored untracked files, and in addition it will show things like what files have been staged for the next commit, and usually some useful information about how to change things. For instance the following: $ git status # On branch blead # Your branch is ahead of 'origin/blead' by 1 commit. # # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: pod/perlrepository.pod # # Changed but not updated: # (use "git add ..." to update what will be committed) # # modified: pod/perlrepository.pod # # Untracked files: # (use "git add ..." to include in what will be committed) # # deliberate.untracked This shows that there were changes to this document staged for commit, and that there were further changes in the working directory not yet staged. It also shows that there was an untracked file in the working directory, and as you can see shows how to change all of this. It also shows that there is one commit on the working branch C which has not been pushed to the C remote yet. B: that this output is also what you see as a template if you do not provide a message to C. Assuming that you'd like to commit all the changes you've just made as a a single atomic unit, run this command: % git commit -a (That C<-a> tells git to add every file you've changed to this commit. New files aren't automatically added to your commit when you use C If you want to add files or to commit some, but not all of your changes, have a look at the documentation for C.) Git will start up your favorite text editor, so that you can craft a commit message for your change. See L below for more information about what makes a good commit message. Once you've finished writing your commit message and exited your editor, git will write your change to disk and tell you something like this: Created commit daf8e63: explain git status and stuff about remotes 1 files changed, 83 insertions(+), 3 deletions(-) If you re-run C, you should see something like this: % git status # On branch blead # Your branch is ahead of 'origin/blead' by 2 commits. # # Untracked files: # (use "git add ..." to include in what will be committed) # # deliberate.untracked nothing added to commit but untracked files present (use "git add" to track) When in doubt, before you do anything else, check your status and read it carefully, many questions are answered directly by the git status output. =head1 Submitting a patch If you have a patch in mind for Perl, you should first get a copy of the repository: % git clone git://perl5.git.perl.org/perl.git perl-git Then change into the directory: % cd perl-git Alternatively, if you already have a Perl repository, you should ensure that you're on the I branch, and your repository is up to date: % git checkout blead % git pull It's preferable to patch against the latest blead version, since this is where new development occurs for all changes other than critical bug fixes. Critical bug fix patches should be made against the relevant maint branches, or should be submitted with a note indicating all the branches where the fix should be applied. Now that we have everything up to date, we need to create a temporary new branch for these changes and switch into it: % git checkout -b orange which is the short form of % git branch orange % git checkout orange Creating a topic branch makes it easier for the maintainers to rebase or merge back into the master blead for a more linear history. If you don't work on a topic branch the maintainer has to manually cherry pick your changes onto blead before they can be applied. That'll get you scolded on perl5-porters, so don't do that. Be Awesome. Then make your changes. For example, if Leon Brocard changes his name to Orange Brocard, we should change his name in the AUTHORS file: % perl -pi -e 's{Leon Brocard}{Orange Brocard}' AUTHORS You can see what files are changed: % git status # On branch orange # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: AUTHORS # And you can see the changes: % git diff diff --git a/AUTHORS b/AUTHORS index 293dd70..722c93e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -541,7 +541,7 @@ Lars Hecking Laszlo Molnar Leif Huhn Len Johnson -Leon Brocard +Orange Brocard Les Peters Lesley Binks Lincoln D. Stein For changes significant enough to warrant a F entry, the porters would greatly appreciate it if you submit an entry along with your actual change. Significant changes include, but are not limited to: =over 4 =item * adding, deprecating, or removing core features =item * adding, deprecating, removing, or upgrading core or dual-life modules =item * adding new core tests =item * fixing security issues and user-visible bugs in the core =item * changes that might break existing code, either on the perl or C level =item * significant performance improvements =item * adding, removing, or significantly changing documentation in the F directory =item * important platform-specific changes =back Please make sure you add the perldelta entry to the right section within F. More information on how to write good perldelta entries is available in the C