Show More
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -0,0 +1,89 | |||||
|
1 | .. _configure-git: | |||
|
2 | ||||
|
3 | =============== | |||
|
4 | Configure git | |||
|
5 | =============== | |||
|
6 | ||||
|
7 | .. _git-config-basic: | |||
|
8 | ||||
|
9 | Overview | |||
|
10 | ======== | |||
|
11 | ||||
|
12 | :: | |||
|
13 | ||||
|
14 | git config --global user.email you@yourdomain.example.com | |||
|
15 | git config --global user.name "Your Name Comes Here" | |||
|
16 | ||||
|
17 | ||||
|
18 | In detail | |||
|
19 | ========= | |||
|
20 | ||||
|
21 | This is to tell git_ who you are, for labeling any changes you make to | |||
|
22 | the code. The simplest way to do this is from the command line:: | |||
|
23 | ||||
|
24 | git config --global user.email you@yourdomain.example.com | |||
|
25 | git config --global user.name "Your Name Comes Here" | |||
|
26 | ||||
|
27 | This will write the settings into your git configuration file - a file | |||
|
28 | called ``.gitconfig`` in your home directory. | |||
|
29 | ||||
|
30 | Advanced git configuration | |||
|
31 | ========================== | |||
|
32 | ||||
|
33 | You might well benefit from some aliases to common commands. | |||
|
34 | ||||
|
35 | For example, you might well want to be able to shorten ``git checkout`` to ``git co``. | |||
|
36 | ||||
|
37 | The easiest way to do this, is to create a ``.gitconfig`` file in your | |||
|
38 | home directory, with contents like this:: | |||
|
39 | ||||
|
40 | [core] | |||
|
41 | editor = emacs | |||
|
42 | [user] | |||
|
43 | email = you@yourdomain.example.com | |||
|
44 | name = Your Name Comes Here | |||
|
45 | [alias] | |||
|
46 | st = status | |||
|
47 | stat = status | |||
|
48 | co = checkout | |||
|
49 | [color] | |||
|
50 | diff = auto | |||
|
51 | status = true | |||
|
52 | ||||
|
53 | (of course you'll need to set your email and name, and may want to set | |||
|
54 | your editor). If you prefer, you can do the same thing from the command | |||
|
55 | line:: | |||
|
56 | ||||
|
57 | git config --global core.editor emacs | |||
|
58 | git config --global user.email you@yourdomain.example.com | |||
|
59 | git config --global user.name "Your Name Comes Here" | |||
|
60 | git config --global alias.st status | |||
|
61 | git config --global alias.stat status | |||
|
62 | git config --global alias.co checkout | |||
|
63 | git config --global color.diff auto | |||
|
64 | git config --global color.status true | |||
|
65 | ||||
|
66 | These commands will write to your user's git configuration file | |||
|
67 | ``~/.gitconfig``. | |||
|
68 | ||||
|
69 | To set up on another computer, you can copy your ``~/.gitconfig`` file, | |||
|
70 | or run the commands above. | |||
|
71 | ||||
|
72 | Other configuration recommended by Yarik | |||
|
73 | ======================================== | |||
|
74 | ||||
|
75 | In your ``~/.gitconfig`` file alias section:: | |||
|
76 | ||||
|
77 | wdiff = diff --color-words | |||
|
78 | ||||
|
79 | so that ``git wdiff`` gives a nicely formatted output of the diff. | |||
|
80 | ||||
|
81 | To enforce summaries when doing merges(``~/.gitconfig`` file again):: | |||
|
82 | ||||
|
83 | [merge] | |||
|
84 | summary = true | |||
|
85 | ||||
|
86 | ||||
|
87 | .. include:: git_links.txt | |||
|
88 | ||||
|
89 |
@@ -0,0 +1,233 | |||||
|
1 | .. _development-workflow: | |||
|
2 | ||||
|
3 | ==================== | |||
|
4 | Development workflow | |||
|
5 | ==================== | |||
|
6 | ||||
|
7 | You already have your own forked copy of the ipython_ repository, by | |||
|
8 | following :ref:`forking`, :ref:`set-up-fork`, and you have configured | |||
|
9 | git_ by following :ref:`configure-git`. | |||
|
10 | ||||
|
11 | Workflow summary | |||
|
12 | ================ | |||
|
13 | ||||
|
14 | * Keep your ``master`` branch clean of edits that have not been merged | |||
|
15 | to the main ipython_ development repo. Your ``master`` then will follow | |||
|
16 | the main ipython_ repository. | |||
|
17 | * Start a new *feature branch* for each set of edits that you do. | |||
|
18 | * If you can avoid it, try not to merge other branches into your feature | |||
|
19 | branch while you are working. | |||
|
20 | * Ask for review! | |||
|
21 | ||||
|
22 | This way of working really helps to keep work well organized, and in | |||
|
23 | keeping history as clear as possible. | |||
|
24 | ||||
|
25 | See - for example - `linux git workflow`_. | |||
|
26 | ||||
|
27 | Making a new feature branch | |||
|
28 | =========================== | |||
|
29 | ||||
|
30 | :: | |||
|
31 | ||||
|
32 | git branch my-new-feature | |||
|
33 | git checkout my-new-feature | |||
|
34 | ||||
|
35 | Generally, you will want to keep this also on your public github_ fork | |||
|
36 | of ipython_. To do this, you `git push`_ this new branch up to your github_ | |||
|
37 | repo. Generally (if you followed the instructions in these pages, and | |||
|
38 | by default), git will have a link to your github_ repo, called | |||
|
39 | ``origin``. You push up to your own repo on github_ with:: | |||
|
40 | ||||
|
41 | git push origin my-new-feature | |||
|
42 | ||||
|
43 | From now on git_ will know that ``my-new-feature`` is related to the | |||
|
44 | ``my-new-feature`` branch in the github_ repo. | |||
|
45 | ||||
|
46 | The editing workflow | |||
|
47 | ==================== | |||
|
48 | ||||
|
49 | Overview | |||
|
50 | -------- | |||
|
51 | ||||
|
52 | :: | |||
|
53 | ||||
|
54 | # hack hack | |||
|
55 | git add my_new_file | |||
|
56 | git commit -am 'NF - some message' | |||
|
57 | git push | |||
|
58 | ||||
|
59 | In more detail | |||
|
60 | -------------- | |||
|
61 | ||||
|
62 | #. Make some changes | |||
|
63 | #. See which files have changed with ``git status`` (see `git status`_). | |||
|
64 | You'll see a listing like this one:: | |||
|
65 | ||||
|
66 | # On branch ny-new-feature | |||
|
67 | # Changed but not updated: | |||
|
68 | # (use "git add <file>..." to update what will be committed) | |||
|
69 | # (use "git checkout -- <file>..." to discard changes in working directory) | |||
|
70 | # | |||
|
71 | # modified: README | |||
|
72 | # | |||
|
73 | # Untracked files: | |||
|
74 | # (use "git add <file>..." to include in what will be committed) | |||
|
75 | # | |||
|
76 | # INSTALL | |||
|
77 | no changes added to commit (use "git add" and/or "git commit -a") | |||
|
78 | ||||
|
79 | #. Check what the actual changes are with ``git diff`` (`git diff`_). | |||
|
80 | #. Add any new files to version control ``git add new_file_name`` (see | |||
|
81 | `git add`_). | |||
|
82 | #. To commit all modified files into the local copy of your repo,, do | |||
|
83 | ``git commit -am 'A commit message'``. Note the ``-am`` options to | |||
|
84 | ``commit``. The ``m`` flag just signals that you're going to type a | |||
|
85 | message on the command line. The ``a`` flag - you can just take on | |||
|
86 | faith - or see `why the -a flag?`_. See also the `git commit`_ manual | |||
|
87 | page. | |||
|
88 | #. To push the changes up to your forked repo on github_, do a ``git | |||
|
89 | push`` (see `git push`). | |||
|
90 | ||||
|
91 | Asking for code review | |||
|
92 | ====================== | |||
|
93 | ||||
|
94 | #. Go to your repo URL - e.g. ``http://github.com/your-user-name/ipython``. | |||
|
95 | #. Click on the *Branch list* button: | |||
|
96 | ||||
|
97 | .. image:: branch_list.png | |||
|
98 | ||||
|
99 | #. Click on the *Compare* button for your feature branch - here ``my-new-feature``: | |||
|
100 | ||||
|
101 | .. image:: branch_list_compare.png | |||
|
102 | ||||
|
103 | #. If asked, select the *base* and *comparison* branch names you want to | |||
|
104 | compare. Usually these will be ``master`` and ``my-new-feature`` | |||
|
105 | (where that is your feature branch name). | |||
|
106 | #. At this point you should get a nice summary of the changes. Copy the | |||
|
107 | URL for this, and post it to the `ipython mailing list`_, asking for | |||
|
108 | review. The URL will look something like: | |||
|
109 | ``http://github.com/your-user-name/ipython/compare/master...my-new-feature``. | |||
|
110 | There's an example at | |||
|
111 | http://github.com/matthew-brett/nipy/compare/master...find-install-data | |||
|
112 | See: http://github.com/blog/612-introducing-github-compare-view for | |||
|
113 | more detail. | |||
|
114 | ||||
|
115 | The generated comparison, is between your feature branch | |||
|
116 | ``my-new-feature``, and the place in ``master`` from which you branched | |||
|
117 | ``my-new-feature``. In other words, you can keep updating ``master`` | |||
|
118 | without interfering with the output from the comparison. More detail? | |||
|
119 | Note the three dots in the URL above (``master...my-new-feature``) and | |||
|
120 | see :ref:`dot2-dot3`. | |||
|
121 | ||||
|
122 | Asking for your changes to be merged with the main repo | |||
|
123 | ======================================================= | |||
|
124 | ||||
|
125 | When you are ready to ask for the merge of your code: | |||
|
126 | ||||
|
127 | #. Go to the URL of your forked repo, say | |||
|
128 | ``http://github.com/your-user-name/ipython.git``. | |||
|
129 | #. Click on the 'Pull request' button: | |||
|
130 | ||||
|
131 | .. image:: pull_button.png | |||
|
132 | ||||
|
133 | Enter a message; we suggest you select only ``ipython`` as the | |||
|
134 | recipient. The message will go to the `ipython mailing list`_. Please | |||
|
135 | feel free to add others from the list as you like. | |||
|
136 | ||||
|
137 | Merging from trunk | |||
|
138 | ================== | |||
|
139 | ||||
|
140 | This updates your code from the upstream `ipython github`_ repo. | |||
|
141 | ||||
|
142 | Overview | |||
|
143 | -------- | |||
|
144 | ||||
|
145 | :: | |||
|
146 | ||||
|
147 | # go to your master branch | |||
|
148 | git checkout master | |||
|
149 | # pull changes from github | |||
|
150 | git fetch upstream | |||
|
151 | # merge from upstream | |||
|
152 | git merge upstream master | |||
|
153 | ||||
|
154 | In detail | |||
|
155 | --------- | |||
|
156 | ||||
|
157 | We suggest that you do this only for your ``master`` branch, and leave | |||
|
158 | your 'feature' branches unmerged, to keep their history as clean as | |||
|
159 | possible. This makes code review easier:: | |||
|
160 | ||||
|
161 | git checkout master | |||
|
162 | ||||
|
163 | Make sure you have done :ref:`linking-to-upstream`. | |||
|
164 | ||||
|
165 | Merge the upstream code into your current development by first pulling | |||
|
166 | the upstream repo to a copy on your local machine:: | |||
|
167 | ||||
|
168 | git fetch upstream | |||
|
169 | ||||
|
170 | then merging into your current branch:: | |||
|
171 | ||||
|
172 | git merge upstream/master | |||
|
173 | ||||
|
174 | Deleting a branch on github_ | |||
|
175 | ============================ | |||
|
176 | ||||
|
177 | :: | |||
|
178 | ||||
|
179 | git checkout master | |||
|
180 | # delete branch locally | |||
|
181 | git branch -D my-unwanted-branch | |||
|
182 | # delete branch on github | |||
|
183 | git push origin :my-unwanted-branch | |||
|
184 | ||||
|
185 | (Note the colon ``:`` before ``test-branch``. See also: | |||
|
186 | http://github.com/guides/remove-a-remote-branch | |||
|
187 | ||||
|
188 | Several people sharing a single repository | |||
|
189 | ========================================== | |||
|
190 | ||||
|
191 | If you want to work on some stuff with other people, where you are all | |||
|
192 | committing into the same repository, or even the same branch, then just | |||
|
193 | share it via github_. | |||
|
194 | ||||
|
195 | First fork ipython into your account, as from :ref:`forking`. | |||
|
196 | ||||
|
197 | Then, go to your forked repository github page, say | |||
|
198 | ``http://github.com/your-user-name/ipython`` | |||
|
199 | ||||
|
200 | Click on the 'Admin' button, and add anyone else to the repo as a | |||
|
201 | collaborator: | |||
|
202 | ||||
|
203 | .. image:: pull_button.png | |||
|
204 | ||||
|
205 | Now all those people can do:: | |||
|
206 | ||||
|
207 | git clone git@githhub.com:your-user-name/ipython.git | |||
|
208 | ||||
|
209 | Remember that links starting with ``git@`` use the ssh protocol and are | |||
|
210 | read-write; links starting with ``git://`` are read-only. | |||
|
211 | ||||
|
212 | Your collaborators can then commit directly into that repo with the | |||
|
213 | usual:: | |||
|
214 | ||||
|
215 | git commit -am 'ENH - much better code' | |||
|
216 | git push origin master # pushes directly into your repo | |||
|
217 | ||||
|
218 | Exploring your repository | |||
|
219 | ========================= | |||
|
220 | ||||
|
221 | To see a graphical representation of the repository branches and | |||
|
222 | commits:: | |||
|
223 | ||||
|
224 | gitk --all | |||
|
225 | ||||
|
226 | To see a linear list of commits for this branch:: | |||
|
227 | ||||
|
228 | git log | |||
|
229 | ||||
|
230 | You can also look at the `network graph visualizer`_ for your github_ | |||
|
231 | repo. | |||
|
232 | ||||
|
233 | .. include:: git_links.txt |
@@ -0,0 +1,28 | |||||
|
1 | .. _dot2-dot3: | |||
|
2 | ||||
|
3 | ======================================== | |||
|
4 | Two and three dots in difference specs | |||
|
5 | ======================================== | |||
|
6 | ||||
|
7 | Thanks to Yarik Halchenko for this explanation. | |||
|
8 | ||||
|
9 | Imagine a series of commits A, B, C, D... Imagine that there are two | |||
|
10 | branches, *topic* and *master*. You branched *topic* off *master* when | |||
|
11 | *master* was at commit 'E'. The graph of the commits looks like this:: | |||
|
12 | ||||
|
13 | ||||
|
14 | A---B---C topic | |||
|
15 | / | |||
|
16 | D---E---F---G master | |||
|
17 | ||||
|
18 | Then:: | |||
|
19 | ||||
|
20 | git diff master..topic | |||
|
21 | ||||
|
22 | will output the difference from G to C (i.e. with effects of F and G), | |||
|
23 | while:: | |||
|
24 | ||||
|
25 | git diff master...topic | |||
|
26 | ||||
|
27 | would output just differences in the topic branch (i.e. only A, B, and | |||
|
28 | C). |
@@ -0,0 +1,36 | |||||
|
1 | .. _following-latest: | |||
|
2 | ||||
|
3 | ============================= | |||
|
4 | Following the latest source | |||
|
5 | ============================= | |||
|
6 | ||||
|
7 | These are the instructions if you just want to follow the latest | |||
|
8 | *ipython* source, but you don't need to do any development for now. | |||
|
9 | ||||
|
10 | The steps are: | |||
|
11 | ||||
|
12 | * :ref:`install-git` | |||
|
13 | * get local copy of the git repository from github_ | |||
|
14 | * update local copy from time to time | |||
|
15 | ||||
|
16 | Get the local copy of the code | |||
|
17 | ============================== | |||
|
18 | ||||
|
19 | From the command line:: | |||
|
20 | ||||
|
21 | git clone git://github.com/ipython/ipython.git | |||
|
22 | ||||
|
23 | You now have a copy of the code tree in the new ``ipython`` directory. | |||
|
24 | ||||
|
25 | Updating the code | |||
|
26 | ================= | |||
|
27 | ||||
|
28 | From time to time you may want to pull down the latest code. Do this with:: | |||
|
29 | ||||
|
30 | cd ipython | |||
|
31 | git pull | |||
|
32 | ||||
|
33 | The tree in ``ipython`` will now have the latest changes from the initial | |||
|
34 | repository. | |||
|
35 | ||||
|
36 | .. include:: git_links.txt |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -0,0 +1,33 | |||||
|
1 | .. _forking: | |||
|
2 | ||||
|
3 | ========================================== | |||
|
4 | Making your own copy (fork) of ipython | |||
|
5 | ========================================== | |||
|
6 | ||||
|
7 | You need to do this only once. The instructions here are very similar | |||
|
8 | to the instructions at http://help.github.com/forking/ - please see that | |||
|
9 | page for more detail. We're repeating some of it here just to give the | |||
|
10 | specifics for the ipython_ project, and to suggest some default names. | |||
|
11 | ||||
|
12 | Set up and configure a github_ account | |||
|
13 | ====================================== | |||
|
14 | ||||
|
15 | If you don't have a github_ account, go to the github_ page, and make one. | |||
|
16 | ||||
|
17 | You then need to configure your account to allow write access - see the | |||
|
18 | ``Generating SSH keys`` help on `github help`_. | |||
|
19 | ||||
|
20 | Create your own forked copy of ipython_ | |||
|
21 | ========================================= | |||
|
22 | ||||
|
23 | #. Log into your github_ account. | |||
|
24 | #. Go to the ipython_ github home at `ipython github`_. | |||
|
25 | #. Click on the *fork* button: | |||
|
26 | ||||
|
27 | .. image:: forking_button.png | |||
|
28 | ||||
|
29 | Now, after a short pause and some 'Hardcore forking action', you | |||
|
30 | should find yourself at the home page for your own forked copy of ipython_. | |||
|
31 | ||||
|
32 | .. include:: git_links.txt | |||
|
33 |
@@ -0,0 +1,16 | |||||
|
1 | .. _git-development: | |||
|
2 | ||||
|
3 | ===================== | |||
|
4 | Git for development | |||
|
5 | ===================== | |||
|
6 | ||||
|
7 | Contents: | |||
|
8 | ||||
|
9 | .. toctree:: | |||
|
10 | :maxdepth: 2 | |||
|
11 | ||||
|
12 | forking_hell | |||
|
13 | set_up_fork | |||
|
14 | configure_git | |||
|
15 | development_workflow | |||
|
16 |
@@ -0,0 +1,26 | |||||
|
1 | .. _install-git: | |||
|
2 | ||||
|
3 | ============= | |||
|
4 | Install git | |||
|
5 | ============= | |||
|
6 | ||||
|
7 | Overview | |||
|
8 | ======== | |||
|
9 | ||||
|
10 | ================ ============= | |||
|
11 | Debian / Ubuntu ``sudo apt-get install git-core`` | |||
|
12 | Fedora ``sudo yum install git-core`` | |||
|
13 | Windows Download and install msysGit_ | |||
|
14 | OS X Use the git-osx-installer_ | |||
|
15 | ================ ============= | |||
|
16 | ||||
|
17 | In detail | |||
|
18 | ========= | |||
|
19 | ||||
|
20 | See the git_ page for the most recent information. | |||
|
21 | ||||
|
22 | Have a look at the github_ install help pages available from `github help`_ | |||
|
23 | ||||
|
24 | There are good instructions here: http://book.git-scm.com/2_installing_git.html | |||
|
25 | ||||
|
26 | .. include:: git_links.txt |
@@ -0,0 +1,18 | |||||
|
1 | ============== | |||
|
2 | Introduction | |||
|
3 | ============== | |||
|
4 | ||||
|
5 | These pages describe a git_ and github_ workflow for the ipython_ | |||
|
6 | project. | |||
|
7 | ||||
|
8 | There are several different workflows here, for different ways of | |||
|
9 | working with *ipython*. | |||
|
10 | ||||
|
11 | This is not a comprehensive git_ reference, it's just a workflow for our | |||
|
12 | own project. It's tailored to the github_ hosting service. You may well | |||
|
13 | find better or quicker ways of getting stuff done with git_, but these | |||
|
14 | should get you started. | |||
|
15 | ||||
|
16 | For general resources for learning git_ see :ref:`git-resources`. | |||
|
17 | ||||
|
18 | .. include:: git_links.txt |
@@ -0,0 +1,67 | |||||
|
1 | .. This (-*- rst -*-) format file contains commonly used link targets | |||
|
2 | and name substitutions. It may be included in many files, | |||
|
3 | therefore it should only contain link targets and name | |||
|
4 | substitutions. Try grepping for "^\.\. _" to find plausible | |||
|
5 | candidates for this list. | |||
|
6 | ||||
|
7 | .. NOTE: reST targets are | |||
|
8 | __not_case_sensitive__, so only one target definition is needed for | |||
|
9 | nipy, NIPY, Nipy, etc... | |||
|
10 | ||||
|
11 | .. PROJECTNAME placeholders | |||
|
12 | .. _PROJECTNAME: http://neuroimaging.scipy.org | |||
|
13 | .. _`PROJECTNAME github`: http://github.com/nipy | |||
|
14 | .. _`PROJECTNAME mailing list`: http://projects.scipy.org/mailman/listinfo/nipy-devel | |||
|
15 | ||||
|
16 | .. nipy | |||
|
17 | .. _nipy: http://nipy.org/nipy | |||
|
18 | .. _`nipy github`: http://github.com/nipy/nipy | |||
|
19 | .. _`nipy mailing list`: http://mail.scipy.org/mailman/listinfo/nipy-devel | |||
|
20 | ||||
|
21 | .. ipython | |||
|
22 | .. _ipython: http://ipython.scipy.org | |||
|
23 | .. _`ipython github`: http://github.com/ipython | |||
|
24 | .. _`ipython mailing list`: http://mail.scipy.org/mailman/listinfo/IPython-dev | |||
|
25 | ||||
|
26 | .. nipy | |||
|
27 | .. _dipy: http://nipy.org/dipy | |||
|
28 | .. _`dipy github`: http://github.com/Garyfallidis/dipy | |||
|
29 | .. _`dipy mailing list`: http://mail.scipy.org/mailman/listinfo/nipy-devel | |||
|
30 | ||||
|
31 | .. git stuff | |||
|
32 | .. _git: http://git-scm.com/ | |||
|
33 | .. _github: http://github.com | |||
|
34 | .. _github help: http://help.github.com | |||
|
35 | .. _msysgit: http://code.google.com/p/msysgit/downloads/list | |||
|
36 | .. _git-osx-installer: http://code.google.com/p/git-osx-installer/downloads/list | |||
|
37 | .. _subversion: http://subversion.tigris.org/ | |||
|
38 | .. _git cheat sheet: http://github.com/guides/git-cheat-sheet | |||
|
39 | .. _pro git book: http://progit.org/ | |||
|
40 | .. _git svn crash course: http://git-scm.com/course/svn.html | |||
|
41 | .. _learn.github: http://learn.github.com/ | |||
|
42 | .. _network graph visualizer: http://github.com/blog/39-say-hello-to-the-network-graph-visualizer | |||
|
43 | .. _git user manual: http://www.kernel.org/pub/software/scm/git/docs/user-manual.html | |||
|
44 | .. _git tutorial: http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html | |||
|
45 | .. _git community book: http://book.git-scm.com/ | |||
|
46 | .. _git ready: http://www.gitready.com/ | |||
|
47 | .. _git casts: http://www.gitcasts.com/ | |||
|
48 | .. _Fernando's git page: http://www.fperez.org/py4science/git.html | |||
|
49 | .. _git magic: http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html | |||
|
50 | .. _git concepts: http://www.eecs.harvard.edu/~cduan/technical/git/ | |||
|
51 | .. _git clone: http://www.kernel.org/pub/software/scm/git/docs/git-clone.html | |||
|
52 | .. _git checkout: http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html | |||
|
53 | .. _git commit: http://www.kernel.org/pub/software/scm/git/docs/git-commit.html | |||
|
54 | .. _git push: http://www.kernel.org/pub/software/scm/git/docs/git-push.html | |||
|
55 | .. _git pull: http://www.kernel.org/pub/software/scm/git/docs/git-pull.html | |||
|
56 | .. _git add: http://www.kernel.org/pub/software/scm/git/docs/git-add.html | |||
|
57 | .. _git status: http://www.kernel.org/pub/software/scm/git/docs/git-status.html | |||
|
58 | .. _git diff: http://www.kernel.org/pub/software/scm/git/docs/git-diff.html | |||
|
59 | .. _git log: http://www.kernel.org/pub/software/scm/git/docs/git-log.html | |||
|
60 | .. _git branch: http://www.kernel.org/pub/software/scm/git/docs/git-branch.html | |||
|
61 | .. _git remote: http://www.kernel.org/pub/software/scm/git/docs/git-remote.html | |||
|
62 | .. _git config: http://www.kernel.org/pub/software/scm/git/docs/git-config.html | |||
|
63 | .. _why the -a flag?: http://www.gitready.com/beginner/2009/01/18/the-staging-area.html | |||
|
64 | .. _git staging area: http://www.gitready.com/beginner/2009/01/18/the-staging-area.html | |||
|
65 | .. _git management: http://kerneltrap.org/Linux/Git_Management | |||
|
66 | .. _linux git workflow: http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html | |||
|
67 | .. _git parable: http://tom.preston-werner.com/2009/05/19/the-git-parable.html |
@@ -0,0 +1,57 | |||||
|
1 | .. _git-resources: | |||
|
2 | ||||
|
3 | ================ | |||
|
4 | git_ resources | |||
|
5 | ================ | |||
|
6 | ||||
|
7 | Tutorials and summaries | |||
|
8 | ======================= | |||
|
9 | ||||
|
10 | * `github help`_ has an excellent series of how-to guides. | |||
|
11 | * `learn.github`_ has an excellent series of tutorials | |||
|
12 | * The `pro git book`_ is a good in-depth book on git. | |||
|
13 | * A `git cheat sheet`_ is a page giving summaries of common commands. | |||
|
14 | * The `git user manual`_ | |||
|
15 | * The `git tutorial`_ | |||
|
16 | * The `git community book`_ | |||
|
17 | * `git ready`_ - a nice series of tutorials | |||
|
18 | * `git casts`_ - video snippets giving git how-tos. | |||
|
19 | * `git magic`_ - extended introduction with intermediate detail | |||
|
20 | * Fernando Perez' git page - `Fernando's git page`_ - many links and tips | |||
|
21 | * A good but technical page on `git concepts`_ | |||
|
22 | * Th `git parable`_ is an easy read explaining the concepts behind git. | |||
|
23 | * `git svn crash course`_: git_ for those of us used to subversion_ | |||
|
24 | ||||
|
25 | Advanced git workflow | |||
|
26 | ===================== | |||
|
27 | ||||
|
28 | There are many ways of working with git_; here are some posts on the | |||
|
29 | rules of thumb that other projects have come up with: | |||
|
30 | ||||
|
31 | * Linus Torvalds on `git management`_ | |||
|
32 | * Linus Torvalds on `linux git workflow`_ . Summary; use the git tools | |||
|
33 | to make the history of your edits as clean as possible; merge from | |||
|
34 | upstream edits as little as possible in branches where you are doing | |||
|
35 | active development. | |||
|
36 | ||||
|
37 | Manual pages online | |||
|
38 | =================== | |||
|
39 | ||||
|
40 | You can get these on your own machine with (e.g) ``git help push`` or | |||
|
41 | (same thing) ``git push --help``, but, for convenience, here are the | |||
|
42 | online manual pages for some common commands: | |||
|
43 | ||||
|
44 | * `git add`_ | |||
|
45 | * `git branch`_ | |||
|
46 | * `git checkout`_ | |||
|
47 | * `git clone`_ | |||
|
48 | * `git commit`_ | |||
|
49 | * `git config`_ | |||
|
50 | * `git diff`_ | |||
|
51 | * `git log`_ | |||
|
52 | * `git pull`_ | |||
|
53 | * `git push`_ | |||
|
54 | * `git remote`_ | |||
|
55 | * `git status`_ | |||
|
56 | ||||
|
57 | .. include:: git_links.txt |
@@ -0,0 +1,18 | |||||
|
1 | .. _using-git: | |||
|
2 | ||||
|
3 | Working with *ipython* source code | |||
|
4 | ====================================== | |||
|
5 | ||||
|
6 | Contents: | |||
|
7 | ||||
|
8 | .. toctree:: | |||
|
9 | :maxdepth: 2 | |||
|
10 | ||||
|
11 | git_intro | |||
|
12 | git_install | |||
|
13 | following_latest | |||
|
14 | patching | |||
|
15 | git_development | |||
|
16 | git_resources | |||
|
17 | ||||
|
18 |
@@ -0,0 +1,123 | |||||
|
1 | ================ | |||
|
2 | Making a patch | |||
|
3 | ================ | |||
|
4 | ||||
|
5 | You've discovered a bug or something else you want to change in ipython_ - excellent! | |||
|
6 | ||||
|
7 | You've worked out a way to fix it - even better! | |||
|
8 | ||||
|
9 | You want to tell us about it - best of all! | |||
|
10 | ||||
|
11 | The easiest way is to make a *patch* or set of patches. Here we explain | |||
|
12 | how. Making a patch is the simplest and quickest, but if you're going | |||
|
13 | to be doing anything more than simple quick things, please consider | |||
|
14 | following the :ref:`git-development` model instead. | |||
|
15 | ||||
|
16 | .. _making-patches: | |||
|
17 | ||||
|
18 | Making patches | |||
|
19 | ============== | |||
|
20 | ||||
|
21 | Overview | |||
|
22 | -------- | |||
|
23 | ||||
|
24 | :: | |||
|
25 | ||||
|
26 | # tell git who you are | |||
|
27 | git config --global user.email you@yourdomain.example.com | |||
|
28 | git config --global user.name "Your Name Comes Here" | |||
|
29 | # get the repository if you don't have it | |||
|
30 | git clone git://github.com/ipython/ipython.git | |||
|
31 | # make a branch for your patching | |||
|
32 | cd ipython | |||
|
33 | git branch the-fix-im-thinking-of | |||
|
34 | git checkout the-fix-im-thinking-of | |||
|
35 | # hack, hack, hack | |||
|
36 | # Tell git about any new files you've made | |||
|
37 | git add somewhere/tests/test_my_bug.py | |||
|
38 | # commit work in progress as you go | |||
|
39 | git commit -am 'BF - added tests for Funny bug' | |||
|
40 | # hack hack, hack | |||
|
41 | git commit -am 'BF - added fix for Funny bug' | |||
|
42 | # make the patch files | |||
|
43 | git format-patch -M -C master | |||
|
44 | ||||
|
45 | Then, send the generated patch files to the `ipython mailing list`_ - where we will thank you warmly. | |||
|
46 | ||||
|
47 | In detail | |||
|
48 | --------- | |||
|
49 | ||||
|
50 | #. Tell git_ who you are so it can label the commits you've made:: | |||
|
51 | ||||
|
52 | git config --global user.email you@yourdomain.example.com | |||
|
53 | git config --global user.name "Your Name Comes Here" | |||
|
54 | ||||
|
55 | #. If you don't already have one, clone a copy of the ipython_ repository:: | |||
|
56 | ||||
|
57 | git clone git://github.com/ipython/ipython.git | |||
|
58 | cd ipython | |||
|
59 | ||||
|
60 | #. Make a 'feature branch'. This will be where you work on your bug | |||
|
61 | fix. It's nice and safe and leaves you with access to an unmodified | |||
|
62 | copy of the code in the main branch:: | |||
|
63 | ||||
|
64 | git branch the-fix-im-thinking-of | |||
|
65 | git checkout the-fix-im-thinking-of | |||
|
66 | ||||
|
67 | #. Do some edits, and commit them as you go:: | |||
|
68 | ||||
|
69 | # hack, hack, hack | |||
|
70 | # Tell git about any new files you've made | |||
|
71 | git add somewhere/tests/test_my_bug.py | |||
|
72 | # commit work in progress as you go | |||
|
73 | git commit -am 'BF - added tests for Funny bug' | |||
|
74 | # hack hack, hack | |||
|
75 | git commit -am 'BF - added fix for Funny bug' | |||
|
76 | ||||
|
77 | Note the ``-am`` options to ``commit``. The ``m`` flag just signals | |||
|
78 | that you're going to type a message on the command line. The ``a`` | |||
|
79 | flag - you can just take on faith - or see `why the -a flag?`_. | |||
|
80 | ||||
|
81 | #. When you have finished, check you have committed all your changes:: | |||
|
82 | ||||
|
83 | git status | |||
|
84 | ||||
|
85 | #. Finally, make your commits into patches. You want all the commits | |||
|
86 | since you branched from the ``master`` branch:: | |||
|
87 | ||||
|
88 | git format-patch -M -C master | |||
|
89 | ||||
|
90 | You will now have several files named for the commits:: | |||
|
91 | ||||
|
92 | 0001-BF-added-tests-for-Funny-bug.patch | |||
|
93 | 0002-BF-added-fix-for-Funny-bug.patch | |||
|
94 | ||||
|
95 | Send these files to the `ipython mailing list`_. | |||
|
96 | ||||
|
97 | When you are done, to switch back to the main copy of the code, just | |||
|
98 | return to the ``master`` branch:: | |||
|
99 | ||||
|
100 | git checkout master | |||
|
101 | ||||
|
102 | Moving from patching to development | |||
|
103 | =================================== | |||
|
104 | ||||
|
105 | If you find you have done some patches, and you have one or more feature | |||
|
106 | branches, you will probably want to switch to development mode. You can | |||
|
107 | do this with the repository you have. | |||
|
108 | ||||
|
109 | Fork the ipython_ repository on github_ - :ref:`forking`. Then:: | |||
|
110 | ||||
|
111 | # checkout and refresh master branch from main repo | |||
|
112 | git checkout master | |||
|
113 | git pull origin master | |||
|
114 | # rename pointer to main repository to 'upstream' | |||
|
115 | git remote rename origin upstream | |||
|
116 | # point your repo to default read / write to your fork on github | |||
|
117 | git remote add origin git@github.com:your-user-name/ipython.git | |||
|
118 | # push up any branches you've made and want to keep | |||
|
119 | git push origin the-fix-im-thinking-of | |||
|
120 | ||||
|
121 | Then you can, if you want, follow the :ref:`development-workflow`. | |||
|
122 | ||||
|
123 | .. include:: git_links.txt |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -0,0 +1,68 | |||||
|
1 | .. _set-up-fork: | |||
|
2 | ||||
|
3 | ================== | |||
|
4 | Set up your fork | |||
|
5 | ================== | |||
|
6 | ||||
|
7 | First you follow the instructions for :ref:`forking`. | |||
|
8 | ||||
|
9 | Overview | |||
|
10 | ======== | |||
|
11 | ||||
|
12 | :: | |||
|
13 | ||||
|
14 | git clone git@github.com/your-user-name/ipython.git | |||
|
15 | cd ipython | |||
|
16 | git remote add upstream git://github.com/ipython/ipython.git | |||
|
17 | ||||
|
18 | In detail | |||
|
19 | ========= | |||
|
20 | ||||
|
21 | Clone your fork | |||
|
22 | --------------- | |||
|
23 | ||||
|
24 | #. Clone your fork to the local computer with ``git clone | |||
|
25 | git@github.com:your-user-name/ipython.git`` | |||
|
26 | #. Investigate. Change directory to your new repo: ``cd ipython``. Then | |||
|
27 | ``git branch -a`` to show you all branches. You'll get something | |||
|
28 | like:: | |||
|
29 | ||||
|
30 | * master | |||
|
31 | remotes/origin/master | |||
|
32 | ||||
|
33 | This tells you that you are currently on the ``master`` branch, and | |||
|
34 | that you also have a ``remote`` connection to ``origin/master``. | |||
|
35 | What remote repository is ``remote/origin``? Try ``git remote -v`` to | |||
|
36 | see the URLs for the remote. They will point to your github_ fork. | |||
|
37 | ||||
|
38 | Now you want to connect to the upstream `ipython github`_ repository, so | |||
|
39 | you can merge in changes from trunk. | |||
|
40 | ||||
|
41 | .. _linking-to-upstream: | |||
|
42 | ||||
|
43 | Linking your repository to the upstream repo | |||
|
44 | -------------------------------------------- | |||
|
45 | ||||
|
46 | :: | |||
|
47 | ||||
|
48 | cd ipython | |||
|
49 | git remote add upstream git://github.com/ipython/ipython.git | |||
|
50 | ||||
|
51 | ``upstream`` here is just the arbitrary name we're using to refer to the | |||
|
52 | main ipython_ repository at `ipython github`_. | |||
|
53 | ||||
|
54 | Note that we've used ``git://`` for the URL rather than ``git@``. The | |||
|
55 | ``git://`` URL is read only. This means we that we can't accidentally | |||
|
56 | (or deliberately) write to the upstream repo, and we are only going to | |||
|
57 | use it to merge into our own code. | |||
|
58 | ||||
|
59 | Just for your own satisfaction, show yourself that you now have a new | |||
|
60 | 'remote', with ``git remote -v show``, giving you something like:: | |||
|
61 | ||||
|
62 | upstream git://github.com/ipython/ipython.git (fetch) | |||
|
63 | upstream git://github.com/ipython/ipython.git (push) | |||
|
64 | origin git@github.com:your-user-name/ipython.git (fetch) | |||
|
65 | origin git@github.com:your-user-name/ipython.git (push) | |||
|
66 | ||||
|
67 | .. include:: git_links.txt | |||
|
68 |
@@ -0,0 +1,106 | |||||
|
1 | ===================== | |||
|
2 | Message Specification | |||
|
3 | ===================== | |||
|
4 | ||||
|
5 | Note: not all of these have yet been fully fleshed out, but the key ones are, | |||
|
6 | see kernel and frontend files for actual implementation details. | |||
|
7 | ||||
|
8 | General Message Format | |||
|
9 | ===================== | |||
|
10 | ||||
|
11 | General message format:: | |||
|
12 | ||||
|
13 | { | |||
|
14 | header : { 'msg_id' : 10, # start with 0 | |||
|
15 | 'username' : 'name', | |||
|
16 | 'session' : uuid | |||
|
17 | }, | |||
|
18 | parent_header : dict, | |||
|
19 | msg_type : 'string_message_type', | |||
|
20 | content : blackbox_dict , # Must be a dict | |||
|
21 | } | |||
|
22 | ||||
|
23 | Side effect: (PUB/SUB) | |||
|
24 | ====================== | |||
|
25 | ||||
|
26 | # msg_type = 'stream':: | |||
|
27 | ||||
|
28 | content = { | |||
|
29 | name : 'stdout', | |||
|
30 | data : 'blob', | |||
|
31 | } | |||
|
32 | ||||
|
33 | # msg_type = 'pyin':: | |||
|
34 | ||||
|
35 | content = { | |||
|
36 | code = 'x=1', | |||
|
37 | } | |||
|
38 | ||||
|
39 | # msg_type = 'pyout':: | |||
|
40 | ||||
|
41 | content = { | |||
|
42 | data = 'repr(obj)', | |||
|
43 | prompt_number = 10 | |||
|
44 | } | |||
|
45 | ||||
|
46 | # msg_type = 'pyerr':: | |||
|
47 | ||||
|
48 | content = { | |||
|
49 | traceback : 'full traceback', | |||
|
50 | exc_type : 'TypeError', | |||
|
51 | exc_value : 'msg' | |||
|
52 | } | |||
|
53 | ||||
|
54 | # msg_type = 'file': | |||
|
55 | content = { | |||
|
56 | path = 'cool.jpg', | |||
|
57 | data : 'blob' | |||
|
58 | } | |||
|
59 | ||||
|
60 | Request/Reply | |||
|
61 | ============= | |||
|
62 | ||||
|
63 | Execute | |||
|
64 | ------- | |||
|
65 | ||||
|
66 | Request: | |||
|
67 | ||||
|
68 | # msg_type = 'execute_request':: | |||
|
69 | ||||
|
70 | content = { | |||
|
71 | code : 'a = 10', | |||
|
72 | } | |||
|
73 | ||||
|
74 | Reply: | |||
|
75 | ||||
|
76 | # msg_type = 'execute_reply':: | |||
|
77 | ||||
|
78 | content = { | |||
|
79 | 'status' : 'ok' OR 'error' OR 'abort' | |||
|
80 | # data depends on status value | |||
|
81 | } | |||
|
82 | ||||
|
83 | Complete | |||
|
84 | -------- | |||
|
85 | ||||
|
86 | # msg_type = 'complete_request':: | |||
|
87 | ||||
|
88 | content = { | |||
|
89 | text : 'a.f', # complete on this | |||
|
90 | line : 'print a.f' # full line | |||
|
91 | } | |||
|
92 | ||||
|
93 | # msg_type = 'complete_reply':: | |||
|
94 | ||||
|
95 | content = { | |||
|
96 | matches : ['a.foo', 'a.bar'] | |||
|
97 | } | |||
|
98 | ||||
|
99 | Control | |||
|
100 | ------- | |||
|
101 | ||||
|
102 | # msg_type = 'heartbeat':: | |||
|
103 | ||||
|
104 | content = { | |||
|
105 | # XXX - unfinished | |||
|
106 | } |
@@ -0,0 +1,151 | |||||
|
1 | #!/usr/bin/env python | |||
|
2 | ''' Checkout gitwash repo into directory and do search replace on name ''' | |||
|
3 | ||||
|
4 | import os | |||
|
5 | from os.path import join as pjoin | |||
|
6 | import shutil | |||
|
7 | import sys | |||
|
8 | import re | |||
|
9 | import glob | |||
|
10 | import fnmatch | |||
|
11 | import tempfile | |||
|
12 | from subprocess import call | |||
|
13 | ||||
|
14 | ||||
|
15 | verbose = False | |||
|
16 | ||||
|
17 | ||||
|
18 | def clone_repo(url, branch): | |||
|
19 | cwd = os.getcwd() | |||
|
20 | tmpdir = tempfile.mkdtemp() | |||
|
21 | try: | |||
|
22 | cmd = 'git clone %s %s' % (url, tmpdir) | |||
|
23 | call(cmd, shell=True) | |||
|
24 | os.chdir(tmpdir) | |||
|
25 | cmd = 'git checkout %s' % branch | |||
|
26 | call(cmd, shell=True) | |||
|
27 | except: | |||
|
28 | shutil.rmtree(tmpdir) | |||
|
29 | raise | |||
|
30 | finally: | |||
|
31 | os.chdir(cwd) | |||
|
32 | return tmpdir | |||
|
33 | ||||
|
34 | ||||
|
35 | def cp_files(in_path, globs, out_path): | |||
|
36 | try: | |||
|
37 | os.makedirs(out_path) | |||
|
38 | except OSError: | |||
|
39 | pass | |||
|
40 | out_fnames = [] | |||
|
41 | for in_glob in globs: | |||
|
42 | in_glob_path = pjoin(in_path, in_glob) | |||
|
43 | for in_fname in glob.glob(in_glob_path): | |||
|
44 | out_fname = in_fname.replace(in_path, out_path) | |||
|
45 | pth, _ = os.path.split(out_fname) | |||
|
46 | if not os.path.isdir(pth): | |||
|
47 | os.makedirs(pth) | |||
|
48 | shutil.copyfile(in_fname, out_fname) | |||
|
49 | out_fnames.append(out_fname) | |||
|
50 | return out_fnames | |||
|
51 | ||||
|
52 | ||||
|
53 | def filename_search_replace(sr_pairs, filename, backup=False): | |||
|
54 | ''' Search and replace for expressions in files | |||
|
55 | ||||
|
56 | ''' | |||
|
57 | in_txt = open(filename, 'rt').read(-1) | |||
|
58 | out_txt = in_txt[:] | |||
|
59 | for in_exp, out_exp in sr_pairs: | |||
|
60 | in_exp = re.compile(in_exp) | |||
|
61 | out_txt = in_exp.sub(out_exp, out_txt) | |||
|
62 | if in_txt == out_txt: | |||
|
63 | return False | |||
|
64 | open(filename, 'wt').write(out_txt) | |||
|
65 | if backup: | |||
|
66 | open(filename + '.bak', 'wt').write(in_txt) | |||
|
67 | return True | |||
|
68 | ||||
|
69 | ||||
|
70 | def copy_replace(replace_pairs, | |||
|
71 | out_path, | |||
|
72 | repo_url, | |||
|
73 | repo_branch = 'master', | |||
|
74 | cp_globs=('*',), | |||
|
75 | rep_globs=('*',), | |||
|
76 | renames = ()): | |||
|
77 | repo_path = clone_repo(repo_url, repo_branch) | |||
|
78 | try: | |||
|
79 | out_fnames = cp_files(repo_path, cp_globs, out_path) | |||
|
80 | finally: | |||
|
81 | shutil.rmtree(repo_path) | |||
|
82 | renames = [(re.compile(in_exp), out_exp) for in_exp, out_exp in renames] | |||
|
83 | fnames = [] | |||
|
84 | for rep_glob in rep_globs: | |||
|
85 | fnames += fnmatch.filter(out_fnames, rep_glob) | |||
|
86 | if verbose: | |||
|
87 | print '\n'.join(fnames) | |||
|
88 | for fname in fnames: | |||
|
89 | filename_search_replace(replace_pairs, fname, False) | |||
|
90 | for in_exp, out_exp in renames: | |||
|
91 | new_fname, n = in_exp.subn(out_exp, fname) | |||
|
92 | if n: | |||
|
93 | os.rename(fname, new_fname) | |||
|
94 | break | |||
|
95 | ||||
|
96 | ||||
|
97 | USAGE = ''' <output_directory> <project_name> | |||
|
98 | ||||
|
99 | If not set with options, the repository name is the same as the <project | |||
|
100 | name> | |||
|
101 | ||||
|
102 | If not set with options, the main github user is the same as the | |||
|
103 | repository name.''' | |||
|
104 | ||||
|
105 | ||||
|
106 | GITWASH_CENTRAL = 'git://github.com/matthew-brett/gitwash.git' | |||
|
107 | GITWASH_BRANCH = 'master' | |||
|
108 | ||||
|
109 | ||||
|
110 | if __name__ == '__main__': | |||
|
111 | from optparse import OptionParser | |||
|
112 | parser = OptionParser() | |||
|
113 | parser.set_usage(parser.get_usage().strip() + USAGE) | |||
|
114 | parser.add_option("--repo-name", dest="repo_name", | |||
|
115 | help="repository name - e.g. nitime", | |||
|
116 | metavar="REPO_NAME") | |||
|
117 | parser.add_option("--github-user", dest="main_gh_user", | |||
|
118 | help="github username for main repo - e.g fperez", | |||
|
119 | metavar="MAIN_GH_USER") | |||
|
120 | parser.add_option("--gitwash-url", dest="gitwash_url", | |||
|
121 | help="URL to gitwash repository - default %s" | |||
|
122 | % GITWASH_CENTRAL, | |||
|
123 | default=GITWASH_CENTRAL, | |||
|
124 | metavar="GITWASH_URL") | |||
|
125 | parser.add_option("--gitwash-branch", dest="gitwash_branch", | |||
|
126 | help="branch in gitwash repository - default %s" | |||
|
127 | % GITWASH_BRANCH, | |||
|
128 | default=GITWASH_BRANCH, | |||
|
129 | metavar="GITWASH_BRANCH") | |||
|
130 | parser.add_option("--source-suffix", dest="source_suffix", | |||
|
131 | help="suffix of ReST source files - default '.rst'", | |||
|
132 | default='.rst', | |||
|
133 | metavar="SOURCE_SUFFIX") | |||
|
134 | (options, args) = parser.parse_args() | |||
|
135 | if len(args) < 2: | |||
|
136 | parser.print_help() | |||
|
137 | sys.exit() | |||
|
138 | out_path, project_name = args | |||
|
139 | if options.repo_name is None: | |||
|
140 | options.repo_name = project_name | |||
|
141 | if options.main_gh_user is None: | |||
|
142 | options.main_gh_user = options.repo_name | |||
|
143 | copy_replace((('PROJECTNAME', project_name), | |||
|
144 | ('REPONAME', options.repo_name), | |||
|
145 | ('MAIN_GH_USER', options.main_gh_user)), | |||
|
146 | out_path, | |||
|
147 | options.gitwash_url, | |||
|
148 | options.gitwash_branch, | |||
|
149 | cp_globs=(pjoin('gitwash', '*'),), | |||
|
150 | rep_globs=('*.rst',), | |||
|
151 | renames=(('\.rst$', options.source_suffix),)) |
@@ -29,6 +29,7 help: | |||||
29 | @echo "pdf latex and then runs the PDF generation" |
|
29 | @echo "pdf latex and then runs the PDF generation" | |
30 | @echo "all html and pdf" |
|
30 | @echo "all html and pdf" | |
31 | @echo "dist all, and then puts the results in dist/" |
|
31 | @echo "dist all, and then puts the results in dist/" | |
|
32 | @echo "gitwash-update update git workflow from source repo" | |||
32 |
|
33 | |||
33 | clean: |
|
34 | clean: | |
34 | -rm -rf build/* dist/* $(SRCDIR)/api/generated |
|
35 | -rm -rf build/* dist/* $(SRCDIR)/api/generated | |
@@ -93,3 +94,7 linkcheck: | |||||
93 | @echo |
|
94 | @echo | |
94 | @echo "Link check complete; look for any errors in the above output " \ |
|
95 | @echo "Link check complete; look for any errors in the above output " \ | |
95 | "or in build/linkcheck/output.txt." |
|
96 | "or in build/linkcheck/output.txt." | |
|
97 | ||||
|
98 | gitwash-update: | |||
|
99 | python ../tools/gitwash_dumper.py source/development ipython | |||
|
100 | cd source/development/gitwash && rename 's/.rst/.txt/' *.rst |
@@ -7,177 +7,20 How to contribute to IPython | |||||
7 | Overview |
|
7 | Overview | |
8 | ======== |
|
8 | ======== | |
9 |
|
9 | |||
10 |
IPython development is done using |
|
10 | IPython development is done using Git [Git]_ and Github.com [Github.com]_. | |
11 | This makes it easy for people to contribute to the development of IPython. |
|
11 | This makes it easy for people to contribute to the development of IPython. | |
12 | There are several ways in which you can join in. |
|
12 | There are several ways in which you can join in. | |
13 |
|
13 | |||
14 | If you have a small change that you want to contribute, you can edit your |
|
|||
15 | Bazaar checkout of IPython (see below) in-place, and ask Bazaar for the |
|
|||
16 | differences: |
|
|||
17 |
|
||||
18 | .. code-block:: bash |
|
|||
19 |
|
||||
20 | $ cd /path/to/your/copy/of/ipython |
|
|||
21 | $ bzr diff > my_fixes.diff |
|
|||
22 |
|
||||
23 | This produces a patch file with your fixes, which we can apply to the source |
|
|||
24 | tree. This file should then be attached to a ticket in our `bug tracker |
|
|||
25 | <https://bugs.launchpad.net/ipython>`_, indicating what it does. |
|
|||
26 |
|
||||
27 | This model of creating small, self-contained patches works very well and there |
|
|||
28 | are open source projects that do their entire development this way. However, |
|
|||
29 | in IPython we have found that for tracking larger changes, making use of |
|
|||
30 | Bazaar's full capabilities in conjunction with Launchpad's code hosting |
|
|||
31 | services makes for a much better experience. |
|
|||
32 |
|
||||
33 | Making your own branch of IPython allows you to refine your changes over time, |
|
|||
34 | track the development of the main team, and propose your own full version of |
|
|||
35 | the code for others to use and review, with a minimum amount of fuss. The next |
|
|||
36 | parts of this document will explain how to do this. |
|
|||
37 |
|
||||
38 | Install Bazaar and create a Launchpad account |
|
|||
39 | --------------------------------------------- |
|
|||
40 |
|
||||
41 | First make sure you have installed Bazaar (see their `website |
|
|||
42 | <http://bazaar-vcs.org/>`_). To see that Bazaar is installed and knows about |
|
|||
43 | you, try the following: |
|
|||
44 |
|
||||
45 | .. code-block:: bash |
|
|||
46 |
|
||||
47 | $ bzr whoami |
|
|||
48 | Joe Coder <jcoder@gmail.com> |
|
|||
49 |
|
||||
50 | This should display your name and email. Next, you will want to create an |
|
|||
51 | account on the `Launchpad website <http://www.launchpad.net>`_ and setup your |
|
|||
52 | ssh keys. For more information of setting up your ssh keys, see `this link |
|
|||
53 | <https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair>`_. |
|
|||
54 |
|
||||
55 | Get the main IPython branch from Launchpad |
|
|||
56 | ------------------------------------------ |
|
|||
57 |
|
||||
58 | Now, you can get a copy of the main IPython development branch (we call this |
|
|||
59 | the "trunk"): |
|
|||
60 |
|
||||
61 | .. code-block:: bash |
|
|||
62 |
|
||||
63 | $ bzr branch lp:ipython |
|
|||
64 |
|
||||
65 | Create a working branch |
|
|||
66 | ----------------------- |
|
|||
67 |
|
||||
68 | When working on IPython, you won't actually make edits directly to the |
|
|||
69 | :file:`lp:ipython` branch. Instead, you will create a separate branch for your |
|
|||
70 | changes. For now, let's assume you want to do your work in a branch named |
|
|||
71 | "ipython-mybranch". Create this branch by doing: |
|
|||
72 |
|
||||
73 | .. code-block:: bash |
|
|||
74 |
|
||||
75 | $ bzr branch ipython ipython-mybranch |
|
|||
76 |
|
||||
77 | When you actually create a branch, you will want to give it a name that |
|
|||
78 | reflects the nature of the work that you will be doing in it, like |
|
|||
79 | "install-docs-update". |
|
|||
80 |
|
||||
81 | Make edits in your working branch |
|
|||
82 | --------------------------------- |
|
|||
83 |
|
||||
84 | Now you are ready to actually make edits in your :file:`ipython-mybranch` |
|
|||
85 | branch. Before doing this, it is helpful to install this branch so you can |
|
|||
86 | test your changes as you work. This is easiest if you have setuptools |
|
|||
87 | installed. Then, just do: |
|
|||
88 |
|
||||
89 | .. code-block:: bash |
|
|||
90 |
|
||||
91 | $ cd ipython-mybranch |
|
|||
92 | $ python setupegg.py develop |
|
|||
93 |
|
||||
94 | Now, make some changes. After a while, you will want to commit your changes. |
|
|||
95 | This let's Bazaar know that you like the changes you have made and gives you |
|
|||
96 | an opportunity to keep a nice record of what you have done. This looks like |
|
|||
97 | this: |
|
|||
98 |
|
||||
99 | .. code-block:: bash |
|
|||
100 |
|
||||
101 | $ ...do work in ipython-mybranch... |
|
|||
102 | $ bzr commit -m "the commit message goes here" |
|
|||
103 |
|
||||
104 | Please note that since we now don't use an old-style linear ChangeLog (that |
|
|||
105 | tends to cause problems with distributed version control systems), you should |
|
|||
106 | ensure that your log messages are reasonably detailed. Use a docstring-like |
|
|||
107 | approach in the commit messages (including the second line being left |
|
|||
108 | *blank*):: |
|
|||
109 |
|
||||
110 | Single line summary of changes being committed. |
|
|||
111 |
|
||||
112 | * more details when warranted ... |
|
|||
113 | * including crediting outside contributors if they sent the |
|
|||
114 | code/bug/idea! |
|
|||
115 |
|
||||
116 | As you work, you will repeat this edit/commit cycle many times. If you work on |
|
|||
117 | your branch for a long time, you will also want to get the latest changes from |
|
|||
118 | the :file:`lp:ipython` branch. This can be done with the following sequence of |
|
|||
119 | commands: |
|
|||
120 |
|
||||
121 | .. code-block:: bash |
|
|||
122 |
|
||||
123 | $ ls |
|
|||
124 | ipython |
|
|||
125 | ipython-mybranch |
|
|||
126 |
|
||||
127 | $ cd ipython |
|
|||
128 | $ bzr pull |
|
|||
129 | $ cd ../ipython-mybranch |
|
|||
130 | $ bzr merge ../ipython |
|
|||
131 | $ bzr commit -m "Merging changes from trunk" |
|
|||
132 |
|
||||
133 | Post your branch and request a code review |
|
|||
134 | ------------------------------------------ |
|
|||
135 |
|
||||
136 | Once you are done with your edits, you should post your branch on Launchpad so |
|
|||
137 | that other IPython developers can review the changes and help you merge your |
|
|||
138 | changes into the main development branch. To post your branch on Launchpad, |
|
|||
139 | do: |
|
|||
140 |
|
||||
141 | .. code-block:: bash |
|
|||
142 |
|
||||
143 | $ cd ipython-mybranch |
|
|||
144 | $ bzr push lp:~yourusername/ipython/ipython-mybranch |
|
|||
145 |
|
||||
146 | Then, go to the `IPython Launchpad site <http://www.launchpad.net/ipython>`_, |
|
|||
147 | and you should see your branch under the "Code" tab. If you click on your |
|
|||
148 | branch, you can provide a short description of the branch as well as mark its |
|
|||
149 | status. Most importantly, you should click the link that reads "Propose for |
|
|||
150 | merging into another branch". What does this do? |
|
|||
151 |
|
||||
152 | This let's the other IPython developers know that your branch is ready to be |
|
|||
153 | reviewed and merged into the main development branch. During this review |
|
|||
154 | process, other developers will give you feedback and help you get your code |
|
|||
155 | ready to be merged. What types of things will we be looking for: |
|
|||
156 |
|
||||
157 | * All code is documented. How to document your code is described in |
|
|||
158 | :ref:`this section <documenting-ipython>`. |
|
|||
159 | * All code has tests. How to write and run tests is described in |
|
|||
160 | :ref:`this section <testing>`. |
|
|||
161 | * The entire IPython test suite passes. |
|
|||
162 |
|
||||
163 | You should also provide us with a list of changes that your branch contains. |
|
|||
164 | See the :ref:`What's new <whatsnew_index>` section of our documentation |
|
|||
165 | (:file:`docs/source/whatsnew`) for details on the format and content of this. |
|
|||
166 |
|
||||
167 | Once your changes have been reviewed and approved, someone will merge them |
|
|||
168 | into the main development branch. |
|
|||
169 |
|
||||
170 |
|
14 | |||
171 | Merging a branch into trunk |
|
15 | Merging a branch into trunk | |
172 | =========================== |
|
16 | =========================== | |
173 |
|
17 | |||
174 | Core developers, who ultimately merge any approved branch (from themselves, |
|
18 | Core developers, who ultimately merge any approved branch (from themselves, | |
175 | another developer, or any third-party contribution) will typically use |
|
19 | another developer, or any third-party contribution) will typically use | |
176 |
:command:` |
|
20 | :command:`git merge` to merge the branch into the trunk and push it to the main | |
177 |
|
|
21 | Git repository. There are a number of things to keep in mind when doing this, | |
178 |
|
|
22 | so that the project history is easy to understand in the long run, and that | |
179 |
|
|
23 | generating release notes is as painless and accurate as possible. | |
180 | possible. |
|
|||
181 |
|
24 | |||
182 | * When you merge any non-trivial functionality (from one small bug fix to a |
|
25 | * When you merge any non-trivial functionality (from one small bug fix to a | |
183 | big feature branch), please remember to always edit the appropriate file in |
|
26 | big feature branch), please remember to always edit the appropriate file in | |
@@ -197,13 +40,13 possible. | |||||
197 | committing something that is completely (or almost so) a third-party |
|
40 | committing something that is completely (or almost so) a third-party | |
198 | contribution, do the commit as:: |
|
41 | contribution, do the commit as:: | |
199 |
|
42 | |||
200 |
$ |
|
43 | $ git commit --author="Someone Else" | |
201 |
|
44 | |||
202 | This way it will show that name separately in the log, which makes it even |
|
45 | This way it will show that name separately in the log, which makes it even | |
203 | easier to spot. Obviously we often rework third party contributions |
|
46 | easier to spot. Obviously we often rework third party contributions | |
204 |
extensively |
|
47 | extensively ,but this is still good to keep in mind for cases when we don't | |
205 | touch the code too much. |
|
48 | touch the code too much. | |
206 |
|
49 | |||
207 |
|
50 | |||
208 | .. [Bazaar] Bazaar. http://bazaar-vcs.org/ |
|
51 | .. [Git] The Git version control system. | |
209 | .. [Launchpad] Launchpad. http://www.launchpad.net/ipython |
|
52 | .. [Github.com] Github.com. http://github.com |
General Comments 0
You need to be logged in to leave comments.
Login now