Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a55632

Browse files
committed
docs: update git guide
svn path=/trunk/matplotlib/; revision=7957
1 parent af9954d commit 8a55632

1 file changed

Lines changed: 67 additions & 11 deletions

File tree

doc/devel/coding_guide.rst

Lines changed: 67 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,14 @@ Cloning the git mirror
166166
~~~~~~~~~~~~~~~~~~~~~~
167167

168168
There is an experimental `matplotlib github mirror`_ of the subversion
169-
repository. To make a local clone of it in the directory ``mpl.git``,
169+
repository. To make a local clone of it in the directory ``matplotlib``,
170170
enter the following commands::
171171

172-
173-
# Download the entire git repository into "mpl.git", name the source repository "svn".
174-
git clone --origin svn [email protected]:astraw/matplotlib.git mpl.git
172+
# Download the entire git repository into "matplotlib", name the source repository "svn".
173+
git clone --origin svn [email protected]:astraw/matplotlib.git
175174

176175
# Change into the newly created git repository.
177-
cd mpl.git
176+
cd matplotlib
178177

179178
# Setup the subversion mirroring.
180179
git svn init --trunk=trunk/matplotlib --prefix=svn/ https://matplotlib.svn.sourceforge.net/svnroot/matplotlib
@@ -187,11 +186,15 @@ enter the following commands::
187186
To install from this cloned repository, use the commands in the
188187
:ref:`svn installation <install-svn>` section::
189188

190-
> cd mpl.git
189+
> cd matplotlib
191190
> python setup.py install
192191

193-
Using git
194-
~~~~~~~~~
192+
Note that it is not possible to interact with the matplotlib
193+
maintenance branches through git due to different representations of
194+
source code repositories in svnmerge and git.
195+
196+
An example git workflow
197+
~~~~~~~~~~~~~~~~~~~~~~~
195198

196199
The following is a suggested workflow for git/git-svn.
197200

@@ -227,10 +230,63 @@ rebase it to the new trunk::
227230
git checkout whizbang-branch
228231
git rebase trunk
229232

230-
Working on a maintenance branch from git
231-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
233+
How was this git mirror set up?
234+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
235+
236+
These are notes for those interested in mirroring a subversion
237+
repository on github. I pieced this together by lots of
238+
trial-and-error.
239+
240+
Step 1: Create a local mirror of the svn repository
241+
242+
::
243+
244+
rsync -avzP rsync://matplotlib.svn.sourceforge.net/svn/matplotlib/ matplotlib-svn-rsync/
245+
246+
Step 2: Import the svn history into a new git repository
247+
248+
::
249+
250+
#!/bin/bash
251+
set -e
252+
253+
TARGET=mpl.git.fixed
254+
GIT=/home/astraw/git/bin/git
255+
TRUNKBRANCH=trunk
256+
SVNBRANCHPREFIX="svn/"
257+
258+
rm -rf $TARGET
259+
mkdir $TARGET
260+
cd $TARGET
261+
262+
$GIT init
263+
$GIT svn init --rewrite-root=https://matplotlib.svn.sourceforge.net/svnroot/matplotlib \
264+
--trunk=trunk/matplotlib --prefix=$SVNBRANCHPREFIX file:///mnt/workdisk/tmp/matplotlib-svn-rsync
265+
$GIT svn fetch
266+
267+
# now, make master branch track ${SVNBRANCHPREFIX}trunk
268+
$GIT checkout master -b tmp
269+
$GIT branch -d master
270+
$GIT checkout ${SVNBRANCHPREFIX}trunk -b $TRUNKBRANCH
271+
$GIT branch -D tmp
272+
$GIT svn rebase -l
273+
274+
Step 3: Upload the git repository to github
275+
276+
::
277+
278+
#!/bin/bash
279+
set -e
280+
281+
TARGET=mpl.git.fixed
282+
GIT=/home/astraw/git/bin/git
283+
TRUNKBRANCH=trunk
284+
SVNBRANCHPREFIX="svn/"
285+
286+
cd $TARGET
232287

233-
The matplotlib maintenance branches are not available through git.
288+
$GIT remote add github [email protected]:astraw/matplotlib.git
289+
git push github $TRUNKBRANCH:master
234290

235291
.. _style-guide:
236292

0 commit comments

Comments
 (0)