| 1 |
|
| 2 |
=head1 Developing Qpsmtpd |
| 3 |
|
| 4 |
=head2 Mailing List |
| 5 |
|
| 6 |
All qpsmtpd development happens on the qpsmtpd mailing list. |
| 7 |
|
| 8 |
Subscribe by sending mail to [email protected] |
| 9 |
|
| 10 |
=head2 Git |
| 11 |
|
| 12 |
We use git for version control. |
| 13 |
|
| 14 |
Ask owns the master repository at git://github.com/smtpd/qpsmtpd.git |
| 15 |
|
| 16 |
We suggest using github to host your repository -- it makes your |
| 17 |
changes easily accessible for pulling into the master. After you |
| 18 |
create a github account, go to |
| 19 |
http://github.com/smtpd/qpsmtpd/tree/master and click on the "fork" |
| 20 |
button to get your own repository. |
| 21 |
|
| 22 |
=head3 Making a working Copy |
| 23 |
|
| 24 |
git clone [email protected]:username/qpsmtpd.git qpsmtpd |
| 25 |
|
| 26 |
will check out your copy into a directory called qpsmtpd |
| 27 |
|
| 28 |
=head3 Making a branch for your change |
| 29 |
|
| 30 |
As a general rule, you'll be better off if you do your changes on a |
| 31 |
branch - preferably a branch per unrelated change. |
| 32 |
|
| 33 |
You can use the C<git branch> command to see which branch you are on. |
| 34 |
|
| 35 |
The easiest way to make a new branch is |
| 36 |
|
| 37 |
git checkout -b topic/my-great-change |
| 38 |
|
| 39 |
This will create a new branch with the name "topic/my-great-change" |
| 40 |
(and your current commit as the starting point). |
| 41 |
|
| 42 |
=head3 Committing a change |
| 43 |
|
| 44 |
Edit the appropriate files, and be sure to run the test suite. |
| 45 |
|
| 46 |
emacs lib/Qpsmtpd.pm # for example |
| 47 |
perl Makefile.PL |
| 48 |
make test |
| 49 |
|
| 50 |
When you're ready to check it in... |
| 51 |
|
| 52 |
git add lib/Qpsmtpd.pm # to let git know you changed the file |
| 53 |
git add --patch plugin/tls # interactive choose which changes to add |
| 54 |
git diff --cached # review changes added |
| 55 |
git commit # describe the commit |
| 56 |
git log -p # review your commit a last time |
| 57 |
git push origin # to send to github |
| 58 |
|
| 59 |
=head3 Commit Descriptions |
| 60 |
|
| 61 |
Though not required, it's a good idea to begin the commit message with |
| 62 |
a single short (less than 50 character) line summarizing the change, |
| 63 |
followed by a blank line and then a more thorough description. Tools |
| 64 |
that turn commits into email, for example, use the first line on the |
| 65 |
Subject: line and the rest of the commit in the body. |
| 66 |
(From: L<git-commit(1)>) |
| 67 |
|
| 68 |
=head3 Submit patches by mail |
| 69 |
|
| 70 |
The best way to submit patches to the project is to send them to the |
| 71 |
mailing list for review. Use the C<git format-patch> command to |
| 72 |
generate patches ready to be mailed. For example: |
| 73 |
|
| 74 |
git format-patch HEAD~3 |
| 75 |
|
| 76 |
will put each of the last three changes in files ready to be mailed |
| 77 |
with the C<git send-email> tool (it might be a good idea to send them |
| 78 |
to yourself first as a test). |
| 79 |
|
| 80 |
Sending patches to the mailing list is the most effective way to |
| 81 |
submit changes, although it helps if you at the same time also commit |
| 82 |
them to a git repository (for example on github). |
| 83 |
|
| 84 |
=head3 Merging changes back in from the master repository |
| 85 |
|
| 86 |
Tell git about the master repository. We're going to call it 'smtpd' |
| 87 |
for now, but you could call it anything you want. You only have to do |
| 88 |
this once. |
| 89 |
|
| 90 |
git remote add smtpd git://github.com/smtpd/qpsmtpd.git |
| 91 |
|
| 92 |
Pull in data from all remote branches |
| 93 |
|
| 94 |
git remote update |
| 95 |
|
| 96 |
Forward-port local commits to the updated upstream head |
| 97 |
|
| 98 |
git rebase smtpd/master |
| 99 |
|
| 100 |
If you have a change that conflicts with an upstream change (git will |
| 101 |
let you know) you have two options. |
| 102 |
|
| 103 |
Manually fix the conflict and then do |
| 104 |
|
| 105 |
git add some/file |
| 106 |
git commit |
| 107 |
|
| 108 |
Or if the conflicting upstream commit did the same logical change then |
| 109 |
you might want to just skip the local change: |
| 110 |
|
| 111 |
git rebase --skip |
| 112 |
|
| 113 |
Be sure to decide whether you're going to skip before you merge, or |
| 114 |
you might get yourself into an odd situation. |
| 115 |
|
| 116 |
Conflicts happen because upstream committers may make minor tweaks to |
| 117 |
your change before applying it. |
| 118 |
|
| 119 |
=head3 Throwing away changes |
| 120 |
|
| 121 |
If you get your working copy into a state you don't like, you can |
| 122 |
always revert to the last commit: |
| 123 |
|
| 124 |
git reset --hard HEAD |
| 125 |
|
| 126 |
Or throw away your most recent commit: |
| 127 |
|
| 128 |
git reset --hard HEAD^ |
| 129 |
|
| 130 |
If you make a mistake with this, git is pretty good about keeping your |
| 131 |
commits around even as you merge, rebase and reset away. This log of |
| 132 |
your git changes is called with "git reflog". |
| 133 |
|
| 134 |
=head3 Applying other peoples changes |
| 135 |
|
| 136 |
If you get a change in an email with the patch, one easy way to apply |
| 137 |
other peoples changes is to use C<git am>. That will go ahead and |
| 138 |
commit the change. To modify it, you can use C<git commit --amend>. |
| 139 |
|
| 140 |
If the changes are in a repository, you can add that repository with |
| 141 |
"git remote add" and then either merge them in with "git merge" or |
| 142 |
pick just the relevant commits with "git cherry-pick". |
| 143 |
|