@@ -9,6 +9,8 @@ Coding guide
99Version control
1010===============
1111
12+ .. _using-svn :
13+
1214svn checkouts
1315-------------
1416
@@ -52,7 +54,7 @@ in mind.
5254* Can you pass :file: `examples/tests/backend_driver.py `? This is our
5355 poor man's unit test.
5456
55- * Can you add a test to file:`unit/nose_tests.py ` to test your changes?
57+ * Can you add a test to : file: `unit/nose_tests.py ` to test your changes?
5658
5759* If you have altered extension code, do you pass
5860 :file: `unit/memleak_hawaii.py `?
@@ -68,6 +70,170 @@ in mind.
6870 <http://www.orcaware.com/svn/wiki/Svnmerge.py> `_ to keep them in
6971 sync. See :ref: `svn-merge ` below.
7072
73+ .. _svn-merge :
74+
75+ Using svnmerge
76+ --------------
77+
78+ svnmerge is useful for making bugfixes to a maintenance branch, and
79+ then bringing those changes into the trunk.
80+
81+ The basic procedure is:
82+
83+ * install ``svnmerge.py `` in your PATH::
84+
85+ > wget http://svn.collab.net/repos/svn/trunk/contrib/client-side/\
86+ svnmerge/svnmerge.py
87+
88+ * get a svn checkout of the branch you'll be making bugfixes to and
89+ the trunk (see above)
90+
91+ * Create and commit the bugfix on the branch.
92+
93+ * Then make sure you svn upped on the trunk and have no local
94+ modifications, and then from your checkout of the svn trunk do::
95+
96+ svnmerge.py merge -S BRANCHNAME
97+
98+ Where BRANCHNAME is the name of the branch to merge *from *,
99+ e.g. v0_98_5_maint.
100+
101+ If you wish to merge only specific revisions (in an unusual
102+ situation), do::
103+
104+ > svnmerge.py merge -rNNN1-NNN2
105+
106+ where the ``NNN `` are the revision numbers. Ranges are also
107+ acceptable.
108+
109+ The merge may have found some conflicts (code that must be manually
110+ resolved). Correct those conflicts, build matplotlib and test your
111+ choices. If you have resolved any conflicts, you can let svn clean
112+ up the conflict files for you::
113+
114+ > svn -R resolved .
115+
116+ ``svnmerge.py `` automatically creates a file containing the commit
117+ messages, so you are ready to make the commit::
118+
119+ > svn commit -F svnmerge-commit-message.txt
120+
121+ Setting up svnmerge
122+ ~~~~~~~~~~~~~~~~~~~
123+
124+ .. note ::
125+ The following applies only to release managers when there is
126+ a new release. Most developers will not have to concern themselves
127+ with this.
128+
129+ * Creating a new branch from the trunk (if the release version is
130+ 0.98.5 at revision 6573)::
131+
132+ > svn copy \
133+ https://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib@6573 \
134+ https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint \
135+ -m "Creating maintenance branch for 0.98.5"
136+
137+ * You can add a new branch for the trunk to "track" using
138+ "svnmerge.py init", e.g., from a working copy of the trunk::
139+
140+ > svnmerge.py init https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint
141+ property 'svnmerge-integrated' set on '.'
142+
143+ After doing a "svn commit" on this, this merge tracking is available
144+ to everyone, so there's no need for anyone else to do the "svnmerge
145+ init".
146+
147+ * Tracking can later be removed with the "svnmerge.py uninit" command,
148+ e.g.::
149+
150+ > svnmerge.py -S v0_9_5_maint uninit
151+
152+ .. _using-git :
153+
154+ Using git
155+ ---------
156+
157+ Some matplotlib developers are experimenting with using git on top of
158+ the subversion repository. Developers are not required to use git, as
159+ subversion will remain the canonical central repository for the
160+ foreseeable future.
161+
162+ Cloning the git mirror
163+ ~~~~~~~~~~~~~~~~~~~~~~
164+
165+ There is an experimental `matplotlib github mirror `_ of the subversion
166+ repository. To make a local clone of it in the directory ``mpl.git ``,
167+ enter the following commands::
168+
169+ # This will create your copy in the mpl.git directory
170+ git clone git://github.com/astraw/matplotlib.git mpl.git
171+ cd mpl.git
172+ git config --add remote.origin.fetch +refs/remotes/*:refs/remotes/*
173+ git fetch
174+ git svn init --trunk=trunk/matplotlib --tags=tags https://matplotlib.svn.sourceforge.net/svnroot/matplotlib
175+
176+ # Now just get the latest svn revisions from the SourceForge SVN repository
177+ git svn fetch -r 6300:HEAD
178+
179+ .. _matplotlib github mirror : http://github.com/astraw/matplotlib
180+
181+ To install from this cloned repository, use the commands in the
182+ :ref: `svn installation <install-svn >` section::
183+
184+ > cd mpl.git
185+ > python setup.py install
186+
187+ Using git
188+ ~~~~~~~~~
189+
190+ The following is a suggested workflow for git/git-svn.
191+
192+ Start with a virgin tree in sync with the svn trunk on the git branch
193+ "master"::
194+
195+ git checkout master
196+ git svn rebase
197+
198+ To create a new, local branch called "whizbang-branch"::
199+
200+ git checkout -b whizbang-branch
201+
202+ Do make commits to the local branch::
203+
204+ # hack on a bunch of files
205+ git add bunch of files
206+ git commit -m "modified a bunch of files"
207+ # repeat this as necessary
208+
209+ Now, go back to the master branch and append the history of your branch
210+ to the master branch, which will end up as the svn trunk::
211+
212+ git checkout master
213+ git svn rebase # Ensure we have most recent svn
214+ git rebase whizbang-branch # Append whizbang changes to master branch
215+ git svn dcommit -n # Check that this will apply to svn
216+ git svn dcommit # Actually apply to svn
217+
218+ Finally, you may want to continue working on your whizbang-branch, so
219+ rebase it to the new master::
220+
221+ git checkout whizbang-branch
222+ git rebase master
223+
224+ A note about git write access
225+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
226+
227+ The matplotlib developers need to figure out if there should be write
228+ access to the git repository. This implies using the personal URL
229+ (``
[email protected] :astraw/matplotlib.git``) rather than the public URL
230+ (``git://github.com/astraw/matplotlib.git ``) for the
231+ repository. However, doing so may make life complicated in the sense
232+ that then there are two writeable matplotlib repositories, which must
233+ be synced to prevent divergence. This is probably not an
234+ insurmountable problem, but it is a problem that the developers should
235+ reach a consensus about. Watch this space...
236+
71237.. _style-guide :
72238
73239Style guide
@@ -352,83 +518,6 @@ external backend via the ``module`` directive. if
352518 > python simple_plot.py -d module://my_backend
353519
354520
355- .. _svn-merge :
356-
357- Using svn-merge
358- ================
359-
360- The basic procedure is:
361-
362- * install ``svnmerge.py `` in your PATH::
363-
364- > wget http://svn.collab.net/repos/svn/trunk/contrib/client-side/\
365- svnmerge/svnmerge.py
366-
367- * get a svn copy of the maintenance branch and the trunk (see above)
368-
369- * Michael advises making the change on the branch and committing it.
370- Make sure you svn upped on the trunk and have no local
371- modifications, and then from the svn trunk do::
372-
373- svnmerge.py merge
374-
375- If you wish to merge only specific revisions (in an unusual
376- situation), do::
377-
378- > svnmerge.py merge -rNNN1-NNN2
379-
380- where the ``NNN `` are the revision numbers. Ranges are also
381- acceptable.
382-
383- The merge may have found some conflicts (code that must be manually
384- resolved). Correct those conflicts, build matplotlib and test your
385- choices. If you have resolved any conflicts, you can let svn clean
386- up the conflict files for you::
387-
388- > svn -R resolved .
389-
390- ``svnmerge.py `` automatically creates a file containing the commit
391- messages, so you are ready to make the commit::
392-
393- > svn commit -F svnmerge-commit-message.txt
394-
395-
396- * You can add a new branch for the trunk to "track" using
397- "svnmerge.py init", e.g., from a working copy of the trunk::
398-
399- > svnmerge.py init https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_4_maint
400- property 'svnmerge-integrated' set on '.'
401-
402- After doing a "svn commit" on this, this merge tracking is available
403- to everyone, so there's no need for anyone else to do the "svnmerge
404- init". I'll go ahead and commit this now.
405-
406- Now, the trunk is tracking two branches for merges, 0.91.x and
407- 0.98.4. This means that when doing a merge, one must manually
408- specify which branch to merge from using the "-S" parameter. You
409- can see which branches are available for merge using "svnmerge.py
410- avail"::
411-
412- > svnmerge.py avail
413- svnmerge: multiple sources found. Explicit source argument (-S/--source) required.
414- The merge sources available are:
415- /branches/v0_91_maint
416- /branches/v0_98_4_maint
417-
418- So to merge from 0.98.4, one would type::
419-
420- > svnmerge.py --source v0_98_4_maint merge
421-
422- (rather than the "svnmerge.py merge" we used to do).
423-
424- * The tracking for 0.98.4 can be removed with the "svnmerge.py
425- uninit" command, e.g.::
426-
427- > svnmerge.py --source v0_9_4_maint uninit
428-
429- This will make merging slightly easier, (since the -S parameter is
430- not required), and it is generally good practice in the long run to
431- not keep extra branches lying around.
432521
433522.. _license-discussion :
434523
0 commit comments