|
4 | 4 | Coding guide |
5 | 5 | ************ |
6 | 6 |
|
7 | | -.. _version-control: |
8 | | - |
9 | | -Version control |
10 | | -=============== |
11 | | - |
12 | | -.. _using-svn: |
13 | | - |
14 | | -svn checkouts |
15 | | -------------- |
16 | | - |
17 | | -Checking out everything in the trunk (matplotlib and toolkits):: |
18 | | - |
19 | | - svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk \ |
20 | | - matplotlib --username=youruser --password=yourpass |
21 | | - |
22 | | -Checking out the main source:: |
23 | | - |
24 | | - svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/\ |
25 | | - matplotlib mpl --username=youruser --password=yourpass |
26 | | - |
27 | | -Branch checkouts, eg the 1.0.x maintenance branch:: |
28 | | - |
29 | | - svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/\ |
30 | | - v1_0_maint mpl1 --username=youruser --password=yourpass |
31 | | - |
32 | | - |
33 | | - |
34 | 7 | Committing changes |
35 | 8 | ------------------ |
36 | 9 |
|
@@ -60,231 +33,7 @@ in mind. |
60 | 33 | :file:`MANIFEST.in`. This file determines what goes into the source |
61 | 34 | distribution of the mpl build. |
62 | 35 |
|
63 | | -* Keep the maintenance branch (0.91) the latest release branch (eg |
64 | | - 0.98.4) and trunk in sync where it makes sense. If there is a bug |
65 | | - on both that needs fixing, use `svnmerge.py |
66 | | - <http://www.orcaware.com/svn/wiki/Svnmerge.py>`_ to keep them in |
67 | | - sync. See :ref:`svn-merge` below. |
68 | | - |
69 | | -.. _svn-merge: |
70 | | - |
71 | | -Using svnmerge |
72 | | --------------- |
73 | | - |
74 | | -svnmerge is useful for making bugfixes to a maintenance branch, and |
75 | | -then bringing those changes into the trunk. |
76 | | - |
77 | | -The basic procedure is: |
78 | | - |
79 | | -* install ``svnmerge.py`` in your PATH:: |
80 | | - |
81 | | - > wget http://svn.apache.org/repos/asf/subversion/trunk/contrib/\ |
82 | | - client-side/svnmerge/svnmerge.py |
83 | | - |
84 | | -* get a svn checkout of the branch you'll be making bugfixes to and |
85 | | - the trunk (see above) |
86 | | - |
87 | | -* Create and commit the bugfix on the branch. |
88 | | - |
89 | | -* Then make sure you svn upped on the trunk and have no local |
90 | | - modifications, and then from your checkout of the svn trunk do:: |
91 | | - |
92 | | - svnmerge.py merge -S BRANCHNAME |
93 | | - |
94 | | - Where BRANCHNAME is the name of the branch to merge *from*, |
95 | | - e.g. v1_0_maint. |
96 | | - |
97 | | - If you wish to merge only specific revisions (in an unusual |
98 | | - situation), do:: |
99 | | - |
100 | | - > svnmerge.py merge -rNNN1-NNN2 |
101 | | - |
102 | | - where the ``NNN`` are the revision numbers. Ranges are also |
103 | | - acceptable. |
104 | | - |
105 | | - The merge may have found some conflicts (code that must be manually |
106 | | - resolved). Correct those conflicts, build matplotlib and test your |
107 | | - choices. If you have resolved any conflicts, you can let svn clean |
108 | | - up the conflict files for you:: |
109 | | - |
110 | | - > svn -R resolved . |
111 | | - |
112 | | - ``svnmerge.py`` automatically creates a file containing the commit |
113 | | - messages, so you are ready to make the commit:: |
114 | | - |
115 | | - > svn commit -F svnmerge-commit-message.txt |
116 | | - |
117 | | - |
118 | | -.. _setting-up-svnmerge: |
119 | | - |
120 | | -Setting up svnmerge |
121 | | -~~~~~~~~~~~~~~~~~~~ |
122 | | - |
123 | | -.. note:: |
124 | | - The following applies only to release managers when there is |
125 | | - a new release. Most developers will not have to concern themselves |
126 | | - with this. |
127 | | - |
128 | | -* Creating a new branch from the trunk (if the release version is |
129 | | - 1.0 at revision 8503):: |
130 | | - |
131 | | - > svn copy \ |
132 | | - https://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib@8503 \ |
133 | | - https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v1_0_maint \ |
134 | | - -m "Creating maintenance branch for 1.0" |
135 | | - |
136 | | -* You can add a new branch for the trunk to "track" using |
137 | | - "svnmerge.py init", e.g., from a working copy of the trunk:: |
138 | | - |
139 | | - > svnmerge.py init https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint |
140 | | - property 'svnmerge-integrated' set on '.' |
141 | | - |
142 | | - After doing a "svn commit" on this, this merge tracking is available |
143 | | - to everyone, so there's no need for anyone else to do the "svnmerge |
144 | | - init". |
145 | | - |
146 | | -* Tracking can later be removed with the "svnmerge.py uninit" command, |
147 | | - e.g.:: |
148 | | - |
149 | | - > svnmerge.py -S v1_0_maint uninit |
150 | | - |
151 | | -.. _using-git: |
152 | | - |
153 | | -Using git |
154 | | ---------- |
155 | | - |
156 | | -Some matplotlib developers are experimenting with using git on top of |
157 | | -the subversion repository. Developers are not required to use git, as |
158 | | -subversion will remain the canonical central repository for the |
159 | | -foreseeable future. |
160 | | - |
161 | | -Cloning the git mirror |
162 | | -~~~~~~~~~~~~~~~~~~~~~~ |
163 | | - |
164 | | -There is an experimental `matplotlib github mirror`_ of the subversion |
165 | | -repository. To make a local clone of it in the directory ``matplotlib``, |
166 | | -enter the following commands:: |
167 | | - |
168 | | - # Download the entire git repository into "matplotlib", name the source repository "svn". |
169 | | - git clone --origin svn [email protected]:astraw/matplotlib.git |
170 | | - |
171 | | - # Change into the newly created git repository. |
172 | | - cd matplotlib |
173 | | - |
174 | | - # Setup the subversion mirroring. |
175 | | - git svn init --trunk=trunk/matplotlib --prefix=svn/ https://matplotlib.svn.sourceforge.net/svnroot/matplotlib |
176 | | - |
177 | | - # Tell git svn to analyze the subversion history |
178 | | - git svn rebase -l |
179 | | - |
180 | | -.. _matplotlib github mirror: http://github.com/astraw/matplotlib |
181 | | - |
182 | | -To install from this cloned repository, use the commands in the |
183 | | -:ref:`svn installation <install-svn>` section:: |
184 | | - |
185 | | - > cd matplotlib |
186 | | - > python setup.py install |
187 | | - |
188 | | -Note that it is not possible to interact with the matplotlib |
189 | | -maintenance branches through git due to different representations of |
190 | | -source code repositories in svnmerge and git. |
191 | | - |
192 | | -An example git workflow |
193 | | -~~~~~~~~~~~~~~~~~~~~~~~ |
194 | | - |
195 | | -The following is a suggested workflow for git/git-svn. |
196 | | - |
197 | | -Start with a virgin tree in sync with the svn trunk on the git branch |
198 | | -"trunk":: |
199 | | - |
200 | | - git checkout trunk |
201 | | - git svn rebase |
202 | | - |
203 | | -To create a new, local branch called "whizbang-branch":: |
204 | | - |
205 | | - git checkout -b whizbang-branch |
206 | | - |
207 | | -Do make commits to the local branch:: |
208 | | - |
209 | | - # hack on a bunch of files |
210 | | - git add bunch of files |
211 | | - git commit -m "modified a bunch of files" |
212 | | - # repeat this as necessary |
213 | | - |
214 | | -Now, go back to the trunk branch and append the history of your branch |
215 | | -to the git trunk branch, which will end up as the svn trunk:: |
216 | | - |
217 | | - git checkout trunk |
218 | | - git svn rebase # Ensure we have most recent svn |
219 | | - git rebase whizbang-branch # Append whizbang changes to trunk branch |
220 | | - git svn dcommit -n # Check that this will apply to svn |
221 | | - git svn dcommit # Actually apply to svn |
222 | | - |
223 | | -Finally, you may want to continue working on your whizbang-branch, so |
224 | | -rebase it to the new trunk:: |
225 | | - |
226 | | - git checkout whizbang-branch |
227 | | - git rebase trunk |
228 | | - |
229 | | -How was this git mirror set up? |
230 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
231 | | - |
232 | | -These are notes for those interested in mirroring a subversion |
233 | | -repository on github. I pieced this together by lots of |
234 | | -trial-and-error. |
235 | | - |
236 | | -Step 1: Create a local mirror of the svn repository |
237 | | - |
238 | | -:: |
239 | | - |
240 | | - rsync -avzP rsync://matplotlib.svn.sourceforge.net/svn/matplotlib/ matplotlib-svn-rsync/ |
241 | | - |
242 | | -Step 2: Import the svn history into a new git repository |
243 | | - |
244 | | -:: |
245 | | - |
246 | | - #!/bin/bash |
247 | | - set -e |
248 | | - |
249 | | - TARGET=mpl.git.fixed |
250 | | - GIT=/home/astraw/git/bin/git |
251 | | - TRUNKBRANCH=trunk |
252 | | - SVNBRANCHPREFIX="svn/" |
253 | | - |
254 | | - rm -rf $TARGET |
255 | | - mkdir $TARGET |
256 | | - cd $TARGET |
257 | | - |
258 | | - $GIT init |
259 | | - $GIT svn init --rewrite-root=https://matplotlib.svn.sourceforge.net/svnroot/matplotlib \ |
260 | | - --trunk=trunk/matplotlib --prefix=$SVNBRANCHPREFIX file:///mnt/workdisk/tmp/matplotlib-svn-rsync |
261 | | - $GIT svn fetch |
262 | | - |
263 | | - # now, make master branch track ${SVNBRANCHPREFIX}trunk |
264 | | - $GIT checkout master -b tmp |
265 | | - $GIT branch -d master |
266 | | - $GIT checkout ${SVNBRANCHPREFIX}trunk -b $TRUNKBRANCH |
267 | | - $GIT branch -D tmp |
268 | | - $GIT svn rebase -l |
269 | | - |
270 | | -Step 3: Upload the git repository to github |
271 | | - |
272 | | -:: |
273 | | - |
274 | | - #!/bin/bash |
275 | | - set -e |
276 | | - |
277 | | - TARGET=mpl.git.fixed |
278 | | - GIT=/home/astraw/git/bin/git |
279 | | - TRUNKBRANCH=trunk |
280 | | - SVNBRANCHPREFIX="svn/" |
281 | | - |
282 | | - cd $TARGET |
283 | | - |
284 | | - $GIT remote add github [email protected]:astraw/matplotlib.git |
285 | | - git push github $TRUNKBRANCH:master |
286 | | - |
287 | | -.. _style-guide: |
| 36 | +* Keep the maintenance branches and trunk in sync where it makes sense. |
288 | 37 |
|
289 | 38 | Style guide |
290 | 39 | =========== |
|
0 commit comments